Running multiple applications in STM32 flash

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2008-10-19T09:33:01Z Indexed on 2010/03/31 22:03 UTC
Read the original article Hit count: 348

Filed under:
|

Hey!

I would like to have two applications in my STM32 flash, one is basically a boot and the other the 'main' application. I have figured out how to load each of them into different areas of flash, and after taking a memory dump everything looks like it is in the right place.

So when I do a reset it loads the boot, all the boot does at the moment is jump to the application. Debugging the boot, this all appears to work correctly. However the problems arrives after i've made the jump to the application, it just executes one instruction (assembly) and then jumps back to the boot. It should stay in the application indefinitely.

My question is then, where should I 'jump' to in the app?

It seems that there are a few potential spots, such as the interrupt vectors, the reset handler, the main function of the app. Actually I've tried all of those with no success.

Hopefully that makes sense, i'll update the question if not.

thanks for your help! Richard

Updates:

  • I had a play around in the debugger and manually changed the program counter to the main of the application, and well that worked a charm, so it makes me think there is something wrong with my jump, why doesn't the program counter keep going after the jump?
  • Actually it seems to be the PSR, the 'T' gets reset on the jump, if I set that again after the jump it continues on with the app as I desire
  • Ok found a solution, seems that you need to have the PC LSB set to 1 when you do a branch or it falls into the 'ARM' mode (32 bit instruction instead of 16 bit instructions like in the 'thumb' mode. Quite an obscure little problem, thanks for letting me share it with you!

© Stack Overflow or respective owner

Related posts about stm32

Related posts about embedded