cancel
Showing results for 
Search instead for 
Did you mean: 

Full upgrade of flash

wadi
Associate II
Posted on November 20, 2011 at 23:44

Hej

I want to write procedure that upgrades code in internal flash. It will be full upgrade of flash with executing mass erase command, so I should copy upgrade procedure to ram, execute it from ram and upgrade program.

And I have questions:

1. when I copying function to RAM, i copying data from flash address to ram address, but how detect size of function (it will not be only one function but more functions, so I want collect them...)

2. how to execute program from RAm after copy ? simple jump ?

3. how tell the linker to locate pocedures in flash at specified address ? (I want them to be inside first page of flash)

4. how tell the linker to locate some constants at special flash address ? (for veryfing flash contents)

with best regards,

2 REPLIES 2
Posted on November 21, 2011 at 02:07

A great proportion of your questions can be solved by using assembler and putting it with the start-up code.

The rest of your questions will depend on what compiler/linker you are talking about. Check the use of #pragmas, and code sections, and how to add those to linker scripts, or scatter files to achieve placement. Definition files can specify absolute addresses.

Don't use firmware library code. Use assembler directives to flush the literal pool, and specify opening/closing points for code to copy. Separate the firmware into two pieces, with a small boot loader to flash the rest of the application code. The alternative of a single image makes it far too easy to brick the device.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
wadi
Associate II
Posted on November 21, 2011 at 13:10

Well, I wolud like to avoid assembler.

Is it possible to do it in C ? (I use gcc with Ride-7 enviroment)

with best regards