Questions tagged [linker-scripts]

The linker command language used to control the memory layout of computer programs and details of the linking process.

Linker scripts contain a command language processed by the linker to determine how sections in input files are mapped into the output file. Most often used to control the memory layout in computer programs, they can also exercise fine control over details of the linking process.

453 questions
0
votes
2 answers

RAM section is part of the binary firmware

I am trying to use a custom RAM section to be able to pass information across reboot. This section will not be erased at boot and so the variables placed in this section will be kept across reboots (if there is no alimentation loss of course). I use…
DamV
  • 35
  • 3
0
votes
0 answers

Stm32 FreeRtos Internal Flash Linker Script

I have some functions to read-and write to memory to STM32F103 internal memory. This functions work on the gcc and standard linker script. When I want to use the internal flash with stm32 and freertos. FreeRtos does not allow to me access when I…
erenbasturk
  • 412
  • 4
  • 10
0
votes
0 answers

Why does GNU ld include a section that does not appear in the linker script?

I'm trying to create a minimal C example on a boot sector for educational purposes. However, I noticed that my example was not being recognized as a boot sector because he magic 0x55aa bytes were not present as the 511th and 512th bytes. Then, I…
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
0
votes
1 answer

ARMCC linker: creating a non-initialised region

I'm trying, and failing, to get the ARMCC linker to put variables into an area of RAM which is NOT initialised (because I need them to survive across a reset). The region I have created in the scatter-link file specifies UNINIT and, in my…
Rob
  • 865
  • 1
  • 8
  • 21
0
votes
0 answers

The initialized data which is not in data section gets initialized in STM32 and it shouldn't

I'm programming STM32L432KC and I want to put it in standby mode which preserves SRAM2 content. To do that I created a separated section in memory by separating the SRAM1 from SRAM2. In this chip, the SRAM1 and the SRAM2 can be treated as a…
K. Koovalsky
  • 596
  • 4
  • 17
0
votes
2 answers

Linker calculates wrong addresses for rodata section

I have created a minimal example of my problem. In the c file I initialize an array with 16 elements. Then I call a function with the array pointer and its size as parameter. The function itself works, I've verified that with the disassembly file.…
0
votes
1 answer

Pad sections using linker script

One can use the ALIGN and SUBALIGN directives to align sections within a linker script for an ELF. However, is it possible to pad a section to a particular alignment, so the size of the section in the ELF is correct? Thanks in advance.
MateoConLechuga
  • 561
  • 4
  • 23
0
votes
1 answer

STM32 Boot from specific NOR block

I've ported an STM32F4 project from Keil uVision5 to Eclipse (GNU MCU Plugin). In my Keil uVision5 project, I used to use 7th block (0x080E0000) for my boot code (I verify that using STM32 ST-LINK Utility tool that my boot code is really at 7th…
sanchop22
  • 2,729
  • 12
  • 43
  • 66
0
votes
1 answer

Alignment in linker scripts

I am looking at trezor's bootloader linker script: /* TREZORv2 bootloader linker script */ ENTRY(reset_handler) MEMORY { FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 128K CCMRAM (wal) : ORIGIN = 0x10000000, LENGTH = 64K SRAM (wal) : ORIGIN…
Slav
  • 33
  • 1
  • 4
0
votes
0 answers

Location counter not changing

I have a linker script like the one below : .... .MemSection : { _MEM_SEC_BEGIN = . ; *(.bss .vbss.* .section.*) *(.common) _MEM_SEC_END = . ; } > RAM _MEM_SEC_END_OUTSIDE = . ; ASSERT( (_MEM_SEC_END_OUTSIDE == _MEM_SEC_END) ,…
SRoland
  • 1
  • 1
0
votes
1 answer

Linker Script Breaks Program

I have a program that places some structs in a named section using __attribute__ ((".sdh_ble_observers")) and extern mytype * ___start_sdh_ble_observers. I'm using the following linker script SECTIONS { .sdh_ble_observers : { …
Andy
  • 109
  • 1
  • 10
0
votes
1 answer

How to put c-style strings (function arguments) in the specific section?

I want to put some functions in a specific section named ".xip.text", but the read only data cannot put in that section. The following is my test code: #include void foo(void) __attribute__((section (".xip.text"))); void foo(void) { …
Ivan
  • 191
  • 5
0
votes
0 answers

gcc option to input symbol definition file

I have built a static library foo.a with a bunch of functions. Some function definitions are not preset and as expected the linker gives undefined reference when I link it and try to create an elf. I would like to know if there is an option to…
Thomas
  • 489
  • 1
  • 8
  • 13
0
votes
0 answers

how to use address defined in linkerscript in C source file?

In a C application, I want to place a big buffer at an address after the variables, stack and dma address ranges. Of course I can define a section in the wanted location in the linker script and declare a big array in C and give a section attribute…
Chan Kim
  • 5,177
  • 12
  • 57
  • 112
0
votes
1 answer

AVR linker scripts: why start data memory at 0x60?

I don't have much experience with linker scripts, so maybe I'm just misunderstanding something here. The LD linker script for the ATmega32u4 (avr5.x) specifies that data memory (SRAM) starts at 0x800060. I know that 0x800000 is just a special offset…
David Brown
  • 35,411
  • 11
  • 83
  • 132