cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 code relocation

marknorman9
Associate II
Posted on March 31, 2009 at 13:54

STM32 code relocation

15 REPLIES 15
joseph239955
Associate II
Posted on May 17, 2011 at 13:07

NVIC Vector Table Offset Register is documented in the Cortex-M3 TRM

http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337e/DDI0337E_cortex_m3_r1p1_trm.pdf

marknorman9
Associate II
Posted on May 17, 2011 at 13:07

Trevor

I hope you are still monitoring this thread, i'd like to ask you a direct question. I have posted this question on another thread but have not had an answer yet, but given your previous answer to this I think you may know the answer. If I am running the main application from a position in the flash, can it rewrite other sections of that flash with impunity, assuming we do not rewrite the section that it is running from? I've been looking at another similar chip we are using and that does not allow it, so I'm just making sure that this does.

BTW you may be wondering why I am not using your suggestion of just allowing the boot loader to copy across the new code into the old section, it is because we need to be able to keep our code running to service devices during an upgrade. Its called None Traffic Affecting (NTA) and it means that we can only take the code off line for a small period of time. If we had to do a boot that then does a download before the code starts up again, we would be in trouble.

[ This message was edited by: mark.norman on 30-03-2009 16:44 ]

trevor1
Associate II
Posted on May 17, 2011 at 13:07

Hi Mark,

Yes, you can erase/write pages of flash that you are not running out of. This is easy when you have two different projects (a bootloader project and an application project) as they are built to ''live'' at different addresses. This is much harder if you start trying to place certain functions at certain addresses etc.

Yes, I see why you need to keep your current app running while programming new app to flash and hence your approach. In my case I can afford 1 or 2 seconds to copy the new app over the old one.

Regards

Trevor

marknorman9
Associate II
Posted on May 17, 2011 at 13:07

That's great, what are the programming rules? Is it page at a time? Also do you know of any application notes or projects that would help program and I2C loader?

trevor1
Associate II
Posted on May 17, 2011 at 13:07

You can erase all required pages and then write them (you write 16 bit word at a time). See the The IAP app note.

marknorman9
Associate II
Posted on May 17, 2011 at 13:07

Trevor

How do I work out how long it would take to copy 100K of program from one section of flash to another?