Hi friend, I encountered this bug. The reason is that when jumping to the app, the program will jump to the Reset_Handler of the app. In the Reset_Handler function, the VTOR register is reset to address 0x0800 0000 (Default). Solution: Reset VTOR at the beginning of main()
After investigating the binaries of both the bare-metal and FreeRTOS applications, I discovered the following: although both apps use the same linker script and startup code, FreeRTOS enforces a stricter alignment on memory sections. This caused the .text section to shift by three words, leaving a gap of three words filled with 0x00 after the .isr_vector section, which ultimately led to the PRECISERR fault.
Adding the linker option --gap-fill=0xFF in the post-build steps resolved the issue. By default, .bin and .hex files do not include gap-filling, whereas flashing the memory via the debugger automatically fills these gaps. This explains why the application worked when flashed through the debugger but not when loaded by my bootloader.
Additionally, in the bare-metal build, the .text section starts immediately after the .isr_vector section, whereas in the FreeRTOS build, a 16-byte alignment is enforced instead of the 4-byte alignment used in bare metal.
I haven’t yet identified exactly where FreeRTOS enforces this alignment, but the issue is now resolved, and the bootloader is running smoothly.