Main application at address 0x08040000

Hi, I’m using a STM32F417IG on which I want to have a bootloader (at the beginning of the flash, i.e. address 0x08000000) and two applications using FreeRTOS (one at address 0x08004000 and the other one at address 0x08040000). I’m using IAR EWARM and FreeRTOS v10.0.0. The bootloader and the first application are working fine, but when it comes to jump to the second application, the programm crashes (i.e. going in hardfault handler). To try to find where the problem comes from, I have loaded only application 1 (without bootlaoder) at address 0x08004000 : that works. Then application 1 at address 0x08040000 : programm crashes. I have of course relocated interrupt vector (using VTOR) at address 0x08040000, and I have changed my linker accordingly. When I go in debug mode, I can see that programm never crashes at the same point. Going further, I tried to load application at addresse 0x08006000 (it’s working), 0x08008000 (it’s working) and 0x0800A000. With this last test, the programm seems to work but strange behavior starts to appear when I use printf : the output shows some format arguments instead of values (i.e. “[%u/%u/%u-%u:%u:%u UTC]” instead of “[11/12/17-19:28:30 UTC]”). With application at address 0x0800F000 this behavior appears more often, and with application at address 0x08020000 program crashes. Does it exist a limit address when we can start an application/relocate interrupt vector ? Or do I miss some FreeRTOS configuration to run an application at a given address ? Thanks, Thomas

Main application at address 0x08040000

There is nothing in FreeRTOS that is address specific. Normally support requests related to running FreeRTOS with a bootloader are tracked down to problems remapping the vector table. When the MCU boots it will always read the reset vector and start of stack addresses from the first two addresses in the vector table which must start from address 0 – that is a hardware dependency though, not a FreeRTOS dependency. Also check the way the vector table is populated to ensure it is not attempting to branch further than the address ued to effect the branch can reach (for example, trying to use a 16 bit offset from a base address when attempting to jump further than a 16-bit value).

Main application at address 0x08040000

Thanks Richard for your answer but I’ve just figured out the problem: the value for flash latency was wrong (according to my supply voltage and the value of the HCLK I use). I don’t really understand why it was working for low flash address though, but anyway it’s working fine now!