Questions tagged [linker-scripts]
The linker command language used to control the memory layout of computer programs and details of the linking process.
419
questions
0
votes
0
answers
68
views
STM32F407ze throws hard fault on executing code from RAM
I am trying to execute a simple code from RAM, but for some reason the program halts/throws hard fault. I am using CCMRAM for my data, heap and stack while SRAM1 for executing code. Here is my linker ...
1
vote
1
answer
42
views
Problem with linking Class into specific memory region using Linker Script
I have a problem with linking class to specific memory region via Linker Script
I've figure out how to link variables and functions that are out of the class but I have no idea how to link the class ...
0
votes
0
answers
9
views
Change the entry point of an executable using a implemented linker script
I am trying to write a linker and if I link the code with my_linker the entry point of my program will be .global my_start instead of global .start
I received 2 executable files, I wrote a ...
0
votes
1
answer
22
views
Difference between -Tlinker.ld vs linker.ld in an makefile
I have this linker.ld where I want to remapped ram.
MEMORY
{
ram (rx) : ORIGIN = 0x80000000, LENGTH = 8M
}
What is the difference between adding the linker like this:
sparc-gaisler-elf-gcc -...
0
votes
1
answer
30
views
what does linker script notation "ROM_NOCOPY“ means?
I can't found the specific definition or any explanation about the linker notation "ROM_NOCOPY" shows in the following ld files snippets,
MEMORY
{
CM7_CORE_DTCM : ORIGIN = 0x20000000 , ...
0
votes
0
answers
17
views
ELF : What is ALIGN displayed under PHDRS while viewing ELF file? [duplicate]
What is ALIGN displayed when looking at program header(PHDRS) information? Can it be set by us and how?enter image description here
0
votes
0
answers
17
views
Linker script notation for handling unspecified sections
I have an object file that has a bunch of compiler-generated sections I don't care about. When I link together a flat binary using a linker script, I can sometimes see these sections placed at the ...
0
votes
1
answer
53
views
LD linker script, get current position of LOAD address
In linker scripts, I can get the LMA of a section like this
.got : ALIGN(4)
{
__global_offset_table_flash_start__ = LOADADDR(.got) ;
...
} >SRAM_DTC AT>PROGRAM_FLASH
When I use
.got : ...
0
votes
1
answer
43
views
MCU crashes when "declaring" vector table in SRAM
I have a new standard c++ project on an imx rt 1024 (an nxp chip), in which I try to move my vector table to SRAM. It fails, depending on a change I apply in the linker script.
The project is a new ...
0
votes
0
answers
23
views
Linker fragment script for extra component outside of ESP-IDF
PLATFORM: Espressif 32 (3.5.0) > Espressif ESP32 Dev Module
FRAMWORKS: framework-espidf @ 3.40302.0 (4.3.2)
DEBUG: esp-prog
IDE: Plateformio
Hello everyone!
I create a component outside of the ...
1
vote
1
answer
32
views
How to store some uninitialized address space for data storage in DTCM in assembly code (ARM-v7, STMCubeIDE)?
I have some initialized data that I store in the .data section. Then I use uninitialized address space using the .bss section. I have the DTCM enabled and I can store and read data from there via ...
0
votes
1
answer
41
views
ld: exclude library from main .text section and move it to another section
I am trying to move a library to a designated portion in flash memory.
I do this as follows:
.text.freertos : ALIGN(0x1000)
{
FILL(0xdead)
*libfreertos_lib.a:*(.text*)
} >PROGRAM_FLASH
...
0
votes
0
answers
42
views
linker script, what do region attributes do exactly?
In linker scripts I typically see that flash is marked with rx
MEMORY
{
/* Define each memory region */
PROGRAM_FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 0x400000 /* 4M bytes (alias Flash) */
...
0
votes
0
answers
63
views
Creating a fixed size execution region with a Scatter file
I need to create a fixed size data memory region using the ARM v6 compiler. The size needs to be the minimum multiple of 32 bytes to fit the data in as I need to map it to an MPU region.
The following ...
2
votes
0
answers
47
views
If you do not use the SIZEOF_HEADER built-in function in the LD link script, the size of the executable file changes, why?
github:https://github.com/Amyassient/link_test/tree/main
eg:Use LD 2.28 whenever possible
source code
#include <stdio.h>
int main(){
printf("hello world");
return 0;
}
not use ...
0
votes
0
answers
35
views
Why does the first LOAD segment offset 0x001000 instead of 0x00000 in ELF file?
I got this question when I did the OS course lab. The linker script is used to link the object files to generate executable named kernel. ld -m elf_i386 -nostdlib -T tools/kernel.ld -o bin/kernel obj/...
1
vote
3
answers
165
views
How to initialize an array of structs to a value other than zero like 0xFF?
I have an array of structs that I need to initialize at compile-time (no memset) to 0xFF. This array will be written as part of the program over erased flash. By setting it to 0xFF, it will remain ...
0
votes
0
answers
9
views
When using ">A AT >B" in ld, what handles the runtime transcription for .data?
In an embedded programming context, building with gcc-arm-none-eabiand ld, I want to resolve a custom code section at a given address in RAM and store it at another one in Flash. As far as I ...
0
votes
1
answer
19
views
Different memory for one variable from .bss section
I have a huge DDR memory (2GB) with huge access time and tiny internal RAM (1MB) with tiny access time. At this moment I have whole .bss section in DDR. The .bss section contains one often used ...
0
votes
0
answers
24
views
OSDev: OS fails when I deinit physical memory regions
I am currently running into problems. So, I am making my own OS, and currently have no problems except for one.
I don't know if it's with my linker script or what, but for some reason, when I attempt ...
0
votes
0
answers
9
views
Place constant array into middle of code memory - i.MX RT + MCUXpresso
For testing purposes, I need to split code to two parts to ensure long jumps to flush code cache frequently. Splitting certain object files to sections is not acceptable, as it is deterministic, while ...
2
votes
1
answer
155
views
How to set an entry address in GNU Linker
I am working on converting a ARMv7 project.
The tools are Code Compose Studio, and GNU 7.3.1 compiler. These cannot change.
The program entry point is 0x8000 0000 and cannot change.
The entry point is ...
0
votes
0
answers
73
views
Why is objcopy.exe altering the load addresses of some sections when a section is removed?
I am developing an application for an ARM Cortex-M3 device using the GCC toolchain. I have split the program memory into an application section and a configuration section by editing the linker script ...
0
votes
2
answers
65
views
can't edit integer with .noinit attribute on STM32L476 with custom linker file
I'm doing my first attempt working with linker files. In the end i want to have a variable that keeps it's value after reset. I'm working with an STM32L476.
To achieve this i modified the Linker files:...
0
votes
1
answer
59
views
Customize function placing in linker script
Motivation
I'm learning how to use and write my own linker scripts.
The problem
Currently, I have 2 simple functions in a .c file and I'd like to put each of those functions in separate sections, but ...
0
votes
2
answers
254
views
IAR Linker Configuration File. Knowing the end address of memory section at runtime
I am working with an ARM chip on IAR. Its linker file describes a RAM section like this:
The stack and RW global variables are stored at the end of the RAM region of physical memory. Having it at ...
0
votes
1
answer
25
views
U-Boot - multiple same output formats in linker scripts for ARM
I'm currently investigating the U-Boot source tree, because I want add support for a specific ARM architecture for the purpose of education.
Also investigated the linker scripts for ARM, but there is ...
0
votes
1
answer
51
views
GNU ASM .section directive not working/linker issue
I'm trying to move my _start function to 0x0, as it is the bootloader.
Flash ROM exists from 0x0 to the first 128MB (=1Gb), other memory is DDR3 RAM but we will map RAM to 0x80000000 to 0xFFFFFFFF.
...
0
votes
0
answers
59
views
ld linker ignores library in specific section in linker script
We are creating a software image with a specific memory layout broken down into multiple sections.
To achieve this, I wrote a linker script, that sorts out most of it. For some reason though, the libm....
0
votes
0
answers
115
views
How to get linker script, used during Clang compilation process?
It is possible to get linker script, used during GCC (Binutils ld linker) compilation process:
$ gcc -o main funcs.c main.c -Wl,--verbose
...
SECTIONS
{
PROVIDE (__executable_start = SEGMENT_START(&...
0
votes
0
answers
41
views
NRST and NOINIT issue - SRAM data retention
I'm working on the Upsilon Project (https://github.com/UpsilonNumworks/Upsilon) and I have some trouble to implement sram data retention after reset (using nrst pin).
I want to preserve the data on ...
0
votes
0
answers
18
views
Gold: reorder sections using a linker script?
I'm trying to write a linker script that will put the .tdata and .tbss sections beside each other. I'm trying to do this by passing a ld file with the following contents:
SECTIONS
{
.tdata : { *(....
0
votes
0
answers
38
views
Unexpected value for the linker script variables
I am trying to write my own linker script.
The current version is here:
MEMORY
{
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000
RAM (rwx) : ORIGIN = 0x00004000, LENGTH = 0x00004000
...
0
votes
0
answers
30
views
How do we get a list of all predefined input memory sections from the toolchain?
I am trying to write my own linker script for a baremetal ARM target. While writing it one of the most important part of the script is the SECTIONS part where we consolidate the input memory sections ...
1
vote
0
answers
78
views
Documentation for initialization-related linker sections in GCC
I'm using the Gnu Arm Embedded Toolchain and I'm writing a custom linker file for a project. I'm writing custom startup/initialization code too. The project uses lots of C++ code, in addition to C and ...
2
votes
0
answers
303
views
What does HIDDEN and PROVIDE_HIDDEN in linker scripts exactly do?
I have gone through the linker documentation for HIDDEN and PROVIDE_HIDDEN multiple times, but I am not really able to understand what they exactly do.
For example, if I write a linker script with an ...
0
votes
0
answers
53
views
Tell the linker to avoid a region
Esteemed Colleagues!
If I want the linker to not place anything into an area of memory, I can simply omit the region from the "MEMORY" section in the linker script file. I could also put a ...
4
votes
1
answer
109
views
How can I access a symbol from the linker script in my Ada code?
I am building my Ada/SPARK project using GNAT and I am using a linker script. Here is an excerpt:
SECTIONS
{
.code :
{
. = ALIGN(0x4);
*(.text.section1)
...
0
votes
0
answers
17
views
How is non-zero LOAD_OFFSET used in linker script? (that is, when output address is not equal to load address)
This is a part of linux kernel linker script. (vmlinux.lds)
__init_begin = .;
__inittext_begin = .;
. = ALIGN(8); .init.text : AT(ADDR(.init.text) - 0) { _sinittext = .; *(.init.text .init.text.*) *(...
0
votes
1
answer
128
views
Can't calculate end address of the section at linker script
I need to make firmware image with 8K size. Firmware image should have a version word at the end. Area between data section and version section must be filled with 0xFF.
This linker script works fine ...
0
votes
0
answers
13
views
Counter location in linker script
When you use the location counter to define a symbol inside the sections block but outside a specific section, what address is it referring to?
My confusion is basically because you can have multiple ...
0
votes
0
answers
155
views
Linker - Copying data from FLASH memory to RAM
I have some question regarding to linker script.
What data needs to be copied from FLASH to RAM in MCU by the startup code (is it only .data segment?)? Why do we need that?
As I can see, every linker ...
0
votes
1
answer
153
views
How can I specify a section as NOBITS in linker scripts?
My linker script is like this:
SECTIONS {
.uninit : {
PROVIDE(_uninit_start = .);
PROVIDE(_stack_start = .);
. += CONFIG_STACK_SIZE * CONSTS_HARTS_NUMBER;
PROVIDE(...
0
votes
0
answers
112
views
Linker script modifications - EFR32 Emulated EEPROM - NVM driver
I am trying to implement NVM3 driver into project based on EFR32BG22 Silabs microcontroller. As I noticed in the documentation, I need to add new section into SECTIONS command in linker script so I ...
1
vote
1
answer
182
views
Linker script: mixing memory regions and location assignments
I have been looking at some linker scripts for embedded ARM processors. In one of them, there's something like this (minimal example):
MEMORY {
REGION : ORIGIN = 0x1000, LENGTH = 0x1000
}
SECTIONS {
...
0
votes
0
answers
334
views
How to solve file format not recognized; treating as linker script? (Python does not compile but C works in Vs code )?
I have some problems with my vs code ,
I can compile and run with C,C++ but not Python and why?,
I use Powershell
I think the environment path is ok cauz i tried putting some errors(missing :) and ...
0
votes
0
answers
73
views
Why does GNU ld default linker script NOT have 'MEMORY'?
I checked the output of ld --verbose on both x86_64 as well as on armv7l (beaglebone black rev C). The default linker script does not contain 'MEMORY' command. Why is that?
0
votes
0
answers
190
views
Custom section in linker script getting ignored
I have following linker script memory regions in my linker script and T-mem region is where I need to keep my custom section.
MEMORY
{
T-mem (arw!xi) : ORIGIN = 0x19500000, LENGTH = 0x4000
...
0
votes
0
answers
64
views
Problem with selfmade bare-metal startup procedure for STM32F072-Nucleo Board
I'm currently trying to get a better understanding of what is happening after power-on until I reach the main() function of an embedded project. Furthermore I'll try to understand how startup code and ...
0
votes
0
answers
25
views
Section placed one block earlier aligned even with location counter made it aligned to where I want.. ( linker script.. )
I modified a linker script to place a section called .__mydebug in 0x807e0000 ~ 0x807effff. Below is the portion. (
#define CONFIG_MYDEBUG_SIZE 0x10000
#define CONFIG_SPL_BSS_START_ADDR 0x807f0000
===...