2019-07-26 05:05 AM
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?
2019-07-26 05:08 AM
Linker magic can do. However sharing code between application and bootloder will inhibiit updating functions used by both bootloader and application. Think again.
2019-07-26 05:12 AM
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.
2019-07-26 05:38 AM
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.