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

 Author: Oliver B. (irq) Posted on: 2010-10-31 12:44

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:
[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!

### Reply

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]
• [avrasm]AVR assembler code[/avrasm]
• [code]code in other languages, ASCII drawings[/code]
• $formula (LaTeX syntax)$
 Name: E-mail address (not visible): Subject: Searching for similar topics... Attachment: Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one. Text: