2011-11-20 02:44 PM
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,2011-11-20 05:07 PM
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.2011-11-21 04:10 AM
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