|Subject:||RE: [avr-gcc-list] Reusing code and variables from bootloader in main program|
|Date:||Sat, 26 Jun 2010 22:41:32 +0300|
Unfortunately you can't do this w/o playing with linker, because in the generic linker script the .noinit section is in the 3 position (start with .data then .bss, then .noinit ) so you can not control the position of the .noinit i.e. your communication (control) table.|
you have two possibilities:
1) write your own linker script with your .noinit section on the top (at 0x800000), or
2) do the same by hand - move the begging of the .data section with the size of your control structure (with -Wl,-Tdata,addr) and cast a pointer to this structure to the begging of the RAM.
Regards I. Dimitrov
> From: address@hidden
> Date: Sun, 27 Jun 2010 01:44:07 +1100
> Subject: Re: [avr-gcc-list] Reusing code and variables from bootloader in main program
> To: address@hidden
> CC: address@hidden
> How can I do this without using custom linker script?
> Simply placing variables into a dedicated section and locating it to
> absolute address with --section-start would overlap this section with
> other data.
> 2010/6/27 Ivan Dimitrov <address@hidden>:
> > you have to put all vars in one structure (or if you use only function
> > pointers you can pack them in array of functions) and place them in the very
> > begging of the RAM. This can be done with dedicated linker section.
> > Regards I. Dimitrov
> >> From: address@hidden
> >> Date: Sun, 27 Jun 2010 00:04:22 +1100
> >> To: address@hidden
> >> Subject: [avr-gcc-list] Reusing code and variables from bootloader in main
> >> program
> >> 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?
> >> _______________________________________________
> >> AVR-GCC-list mailing list
> >> address@hidden
> >> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
> > ________________________________
> > Hotmail: Powerful Free email with security by Microsoft. Get it now.
Hotmail: Free, trusted and rich email service. Get it now.
|[Prev in Thread]||Current Thread||[Next in Thread]|