This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Linker is slowed down extremely by splitting sections into several flash regions

Dear developer collegues,

I have the follwing linker script snippet:

.....

/* Memories definition */
MEMORY
{
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K - 0x200
RAM_COMMAND(xrw) : ORIGIN = 0x38003E00, LENGTH = 0x200
FLASH (rx) : ORIGIN = FLASH_ORIGIN, LENGTH = FLASH_LENGTH
FLASH_EXT (rx) : ORIGIN = EXTERN_FLASH_ORIGIN, LENGTH = EXTERN_FLASH_LENGTH
}

/* Sections */
SECTIONS
{
/* The startup code into "FLASH" Rom type memory */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
.bootstrapping_code :
{
. = ALIGN(4);
*generated/*.obj (.text .text*)
*hw/*.o (.text .text*)
*startup/*.o (.text .text*)
. = ALIGN(4);
} >FLASH

/* 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_EXT

.....

The goal is to have the code splitted into external (qspi-flash) and internal flash. The script is working fine, at least according to the generated elf...

 

But, if not all sections are directed to the same flash, the linker takes around 5mins to link. With all sections in the same flash, linking time is 1sec.

Does anybody have an idea how to debug this?

Thank you,

Simon

  • /usr/local/oecore-x86_64/sysroots/x86_64-maultiersdk-linux/usr/share/gcc-arm-none-eabi/bin/arm-none-eabi-ld -version
    GNU ld (GNU Arm Embedded Toolchain 9-2020-q2-update) 2.34.0.20200428
    Copyright (C) 2020 Free Software Foundation, Inc.
    This program is free software; you may redistribute it under the terms of
    the GNU General Public License version 3 or (at your option) a later version.
    This program has absolutely no warranty.