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

von Oliver B. (irq)

Rate this post
0 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:
.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?



Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.