LD: Use same input section in multiple output sections

OP #1918378
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!

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.