cancel
Showing results for 
Search instead for 
Did you mean: 

Update only one section with code/functions

machinist
Associate III

Hello,

I was wondering if it was allways necassary to implement a bootloader and load the entire app to flash. Would it be possible to place some frequently updated functions in an own section (with variables stored in own section in Ram) and only update that section out of the app itself? Is this commonly used? Advantage would be that a lot of code could be used for app and bl (for example when using USB and there is not enough flash for app and bl with USB drivers).

Any thoughts on this?

3 REPLIES 3
Uwe Bonnes
Principal II

Linker magic can do. However sharing code between application and bootloder will inhibiit updating functions used by both bootloader and application. Think again.

machinist
Associate III

Yes that is rather obvious, isnt it. As I wrote "some frequently updated functions". Only the one updateable section would be flashed whilst leaving the rest as it is.

You'd create a definition (.DEF) file you could pass to the linker, probably achievable with an enumerated list in the GNU linker script, or a .LIB/.OBJ with absolute address.

I've done this in RealView with math and other routines I had ROMed. These would need to be stand-alone routines using stack (local/auto) variables, you can't use static allocations as the RAM will be mapped entirely differently in loader vs application. Also functions couldn't call malloc()/free()

You could have a specific area of RAM, but the call trees are very hard to contain, and it also tends to be a finite resource.

You are also tied to specific pairings, the way to avoid that is to construct a call table describing entry points.

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