Helpful comments in assembly and linker script files

This commit is contained in:
Imbus 2024-08-07 11:26:07 +02:00
parent 7a3c98f2b4
commit be6678c0e6
6 changed files with 81 additions and 35 deletions

View file

@ -9,6 +9,11 @@ SECTIONS
*/
. = 0x80000000;
/*
* This section contains the code. This is, the machine language instructions
* that will be executed by the processor. In here we will find symbols
* that reference the functions in your object file.
*/
.text : {
*(.text .text.*)
. = ALIGN(0x1000);
@ -19,6 +24,10 @@ SECTIONS
PROVIDE(etext = .);
}
/*
* This contains any data that is marked as read only.
* It is not unusual to find this data interleaved with the text section.
*/
.rodata : {
. = ALIGN(16);
*(.srodata .srodata.*) /* do not need to distinguish this from .rodata */
@ -26,6 +35,10 @@ SECTIONS
*(.rodata .rodata.*)
}
/*
* This section contains initialized global and static variables.
* Any global object that has been explicitly initialized to a value different than zero.
*/
.data : {
. = ALIGN(16);
*(.sdata .sdata.*) /* do not need to distinguish this from .data */
@ -33,6 +46,12 @@ SECTIONS
*(.data .data.*)
}
/*
* Contains all uninitialized global and static var iables. These are usually
* zeroed out by the startup code before we reach the main function. However,
* In an embedded system we usually provide our own startup code, which means
* we need to remember to do this ourselves.
*/
.bss : {
. = ALIGN(16);
*(.sbss .sbss.*) /* do not need to distinguish this from .bss */
@ -40,5 +59,6 @@ SECTIONS
*(.bss .bss.*)
}
/* PROVIDE, see vm.c */
PROVIDE(end = .);
}