cancel
Showing results for 
Search instead for 
Did you mean: 

IAP problem - user app not working

Michal Dubovsky
Associate II
Posted on August 15, 2017 at 14:11

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 = 40K

CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 8K

FLASH (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 #iap
3 REPLIES 3
Posted on August 15, 2017 at 14:31

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 15, 2017 at 15:05

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.

0690X00000607r2QAA.png
Posted on August 15, 2017 at 16:36

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..