avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Reusing code and variables from bootloader in main pr


From: Lars Noschinski
Subject: Re: [avr-gcc-list] Reusing code and variables from bootloader in main program
Date: Sat, 26 Jun 2010 23:19:56 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

* Andrey Demenev <address@hidden> [10-06-27 00:04]:
> I have atmega64 with SD card connected. The card is used for storing
> WAV files, logs, etc. I want to add a bootloader that would upgrade
> the main program if certain file is present on the card. Using
> separate copies of filesystem library in main program and bootloader
> is too expensive in terms of flash space. I am thinking about this
> solution: 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. Obviously, main program also needs to know
> addresses of all global variables used by filesystem lib.  The problem
> is : how do I make both program use same addresses for certain
> variables?

An alternative to placing the function addresses in a structure would be
to place a jump table with the entry points at a well-known position
in the flash.

Then you can use the --defsym option to the linker to tell the main
program where to find those entry points.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]