EmbDev.net

Forum: ARM programming with GCC/GNU tools LD: Use same input section in multiple output sections


von Oliver B. (irq)


Rate this post
useful
not useful
In Short: Is it possible, to tell the linker, to place the same piece of 
code in multiple flash locations?

What I'm trying to do is, to write a linker script, to run an 
application either in "standalone mode" or with a bootloader installed, 
for in application programming.

For this I want the isr vector table to be located at the controllers 
default location - where it gets overridden, if the bootloader is 
flashed - and in the applications section, where the bootloader jumps 
to, when it is finished.

This is how the parts in my linker script look like:
[code]
.bootloader :
{
  . = ALIGN(0x80);     /* PM0056, Rev.1 (4/2009), 4.3.3 */
  KEEP(*(.isr_vector)) /* Initial isr table. It gets overridden, as
                          soon as bootloader is installed. */
} >BL

.application :
{
  . = ALIGN(0x80);                          /* PM0056, Rev.1 (4/2009), 
4.3.3 */
  _app_isr_vectors_offset = . - 0x08000000;
  KEEP(*(.isr_vector))                      /* This is the application
                                               vector table to use, when
                                               bootloader is installed. 
*/
} >APP

The result is, that the KEEP(*(.isr_vector)) in the .application section 
produces no output in the binary file. Maybe already used input sections 
are marked as used and cannot be inserted again?

I searched the GNU LD manual, but did not find a hint how to do this. 
Can you tell me, if this is possible and if yes, how?

Thanks!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.