How to place program code in several memory regions?

1

There are several memory regions

MEMORY
{
  rom1 (rx)   : ORIGIN = 0x00000000,    LENGTH = 256k
  rom2 (rwx)  : ORIGIN = 0x10000000,    LENGTH = 16M
  ram1 (rw!x) : ORIGIN = 0x20000000,    LENGTH = 64k
  ram2 (rwx)  : ORIGIN = 0x21000000,    LENGTH = 16M
}

How to place .text sections of all input files in the memory area of rom1, and if there is not enough space, then the remaining characters to place in rom2? Only one memory region can be specified in the description of the output section.

  .text :
  {
    *(.text)
  } > rom1
c
linker
ld
linker-scripts

1 Answer

0

As far as I know, there is no way to distribute a section over several non-contiguous memory regions.

As suggested here, the section should be divided into several sections and then assigned to the memory regions.

In general this is a very handy documentation about the different possibilities.

answered on Stack Overflow May 29, 2020 by Sinic

User contributions licensed under CC BY-SA 3.0