2020-12-06 10:31 AM
I write a program, send 0x55 via UART, and set the system timer for 1000 calls per second.
the program is recorded to FLASH and works as expected.
then I change the address for the firmware in the linker, instead of the flash drive I write to RAM.
I change the code, stop using UART in the system timer handler at all, and lower the timer call rate to 10 per second.
in the Makefile, for reliability, the first line is deleting old files.
when i write to RAM, the system timer run on new values. and UART works as on the old firmware, although I don't use it at all.
here are the lines in the make file
rm $(FIRMWARE_NAME).elf $(FIRMWARE_NAME).hex $(FIRMWARE_NAME).asm
$(COLORIZER) arm-none-eabi-gcc $(CFLAGS) -o $(FIRMWARE_NAME).elf $(SRCS) $(LDSCRIPTS) $(LDFLAGS)
$(COLORIZER) arm-none-eabi-objcopy -O ihex $(FIRMWARE_NAME).elf $(FIRMWARE_NAME).hex
$(COLORIZER) arm-none-eabi-objdump -h -d $(FIRMWARE_NAME).elf > $(FIRMWARE_NAME).asm
st-flash --format ihex write $(FIRMWARE_NAME).hex
arm-none-eabi-size $(FIRMWARE_NAME).elf
and linker
FLASH(rx) : ORIGIN = 0x20004E20, LENGTH = 20K
RAM(xrw) : ORIGIN = 0x20000000, LENGTH = 20K
CCM(rw) : ORIGIN = 0x10000000, LENGTH = 8K
}
SECTIONS
{
.isr_vector :
{
. = ALIGN(4);
_isr_vectors_offs = . - 0x20004E20;
2020-12-06 11:18 AM
The vector table on most STM32 needs to be aligned on a 512-byte boundary
2020-12-07 03:25 AM
1. where is this described in the documentation? I didn't see it, honestly.
2. why is this problem not present when writing to a flash drive ?
2020-12-07 04:01 AM
ARM describes the low order bits of VTOR as not being used, the NVIC doing the generation for the vector read, and the size then being a power of two sufficient to hold the vectors.
Try the TRM or Programming Manual.