0

I have an embedded C project (on an STM32 MCU) to which I am linking a static library. Right now, my linker script places all the .text, .rodata, etc... in the same section. Is there a way I can write the linker script such that the static library code is placed in its own section?

For reference, I am compiling the code something like

gcc -L[Static Library Path] -l[Static Library Name] ...

And my linker script looks something like:

/* Memories definition */
MEMORY
{
  RAM   (xrw)   : ORIGIN = 0x20000000,  LENGTH = 256K
  FLASH (rx)    : ORIGIN = 0x8000000,   LENGTH = 512K
}

/* Sections */
SECTIONS
{
  ...

  /* The program code and other data into "FLASH" Rom type memory */
  .text :
  {
    . = ALIGN(4);
    *(.text)           /* .text sections (code) */
    *(.text*)          /* .text* sections (code) */
    *(.glue_7)         /* glue arm to thumb code */
    *(.glue_7t)        /* glue thumb to arm code */
    *(.eh_frame)

    KEEP (*(.init))
    KEEP (*(.fini))

    . = ALIGN(4);
    _etext = .;        /* define a global symbols at end of code */
  } >FLASH

  ...

}

I would like to add something like the following to my linker script

.libs :
{
  . = ALIGN(4);
  /* WHAT DO I PUT HERE */
  . = ALIGN(4);
}
Patrick Wright
  • 1,401
  • 7
  • 13

0 Answers0