2017-08-15 05:11 AM
Hello. I am trying to implement an in application programming to an F303 processor.
I got to a point where I can successfully download a whole new firmware to my desired location (0x08010000) through UART. I checked whether the data are OK with STLINK and there is no difference between the firmware and memory starting from 0x08010000.
The custom firmware should blink the LED but when I make a jump to the user application the LED just lights up and doesn't blink so there clearly must be something wrong.
In my custom 'blink' firmware I changed the linker script so that the FLASH starts from 0x08010000
MEMORY
{RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 40KCCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 8KFLASH (rx) : ORIGIN = 0x8010000, LENGTH = 192K}My 'jump' code:
&sharpdefine USER_PROG_ADDRESS FLASH_BASE+(uint32_t)0x10000
typedef void (*pFunction)(void);
pFunction JumpToApplication;uint32_t JumpAddress;
JumpAddress = *(__IO uint32_t*) (USER_PROG_ADDRESS + 4); JumpToApplication = (pFunction) JumpAddress; __set_MSP(*(__IO uint32_t*) USER_PROG_ADDRESS); JumpToApplication();What am I missing? Did I forget to do something?
#stm32f303 #iap2017-08-15 05:31 AM
This is a topic covered many times, review some other threads for ideas.
Use a debugger, step the transition.
Make sure the SCB->VTOR is set to the new vector table address in your SystemInit() or equivalent code.
2017-08-15 08:05 AM
I have searched forum for ideas beforehand but none of them solved my issue.
I have modified the code slightly. This is what I got from the debugger.
2017-08-15 09:36 AM
That's not going to help if code in your app changes it. Step into the application code and follow it through to main()
Make sure you don't call from within interrupt context.