Andrey Demenev schrieb:

link the bootloader with filesystem libraries, and in main
program have a set of pointers to filesystem library functions in
.noinit section. When bootloader is started , it upgrades main program
if necessary, and then initializes the prointers with correct
addresses and jumps to address zero, starting the main program. Since
variables are in .noinit, main program would not initialize them,
preserving the addresses.

Needlessly complicated.
Place a table of jumps to the filesystem functions in the bootloader
section at a fixed address (e.g. at the very end of the Flash).
Then that functions have a (virtual) known fixed address, because you
can simply "call" the table entries in the main program.

Obviously, main program also needs to know
addresses of all global variables used by filesystem lib.

Best way is to *not* use any global variables in that functions.
Instead let them operate on structures passed in by pointer.
E.g. like this:

FileStruct file;
open(&file, ...
read(&file, ...



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to