-
-
Save salkinium/10daa6eec7788aea1cae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* LINKER SCRIPT | |
* | |
* The Linker Script defines how the code and data emitted by the GNU C compiler | |
* and assembler are to be loaded into memory (code goes into ROM, variables | |
* go into RAM). | |
* | |
* Any symbols defined in the Linker Script are automatically global and | |
* available to the rest of the program. | |
* | |
* Example for STM32F401: | |
* | |
* MEMORY MAP (RAM) | |
* | |
* | | 0x2001 0000 <---- __ram_end, __heap_end | |
* |---------------------------------| 0x2000 FFFF | |
* | Unused RAM | | |
* | (overwritten by heap!) | | |
* |---------------------------------| | |
* | ^ | | |
* | | | | |
* | Heap Area | | |
* | (grows upwards) | <------- __heap_start | |
* +-------> |---------------------------------| <------- __noinit_end | |
* | | | | |
* .noinit | Global data not cleared | | |
* | | after reset | <------- __noinit_start | |
* +-------> |---------------------------------| <------- __bss_end | |
* | | | | |
* .bss | uninitialized variables | | |
* | | | <------- __bss_start | |
* +-------> |---------------------------------| <------- __data_end | |
* | | | | |
* | | | | |
* .data | initialized variables | | |
* | | (contains .fastdata) | | |
* | | | <------- __data_start, __fastdata_start, __fastdata_end | |
* +-------> |---------------------------------| <------- __vector_table_ram_end | |
* | | | | |
* .vectors | Interrupt Vectors (in RAM) | | |
* | | (if re-mapped) | <------- __vector_table_ram_start | |
* +-------> |---------------------------------| <------- __process_stack_top, __stack_end | |
* | Process Stack (psp) | | |
* | (grows downwards) | | |
* | | | | |
* | v | | |
* |---------------------------------| <------- __main_stack_top | |
* | Main Stack (msp) | | |
* | (grows downwards) | | |
* | | | | |
* | v | <------- __stack_start | |
* |---------------------------------| | |
* | Alignment buffer for .vectors | | |
* | (overwritten by stack!) | | |
* |---------------------------------| 0x2000 0000 <--- __ram_start | |
* | |
* | |
* MEMORY MAP (Flash) | |
* | |
* | | 0x0802 0000 | |
* +-------> |---------------------------------| 0x0801 FFFF <--- __flash_end, __persistent_end | |
* | | | | |
* | | | | |
* .persistent | Persistent Storage | | |
* | | | | |
* | | | | |
* +-------> |---------------------------------| <------- __persistent_start | |
* | Unused flash | start at the beginning | |
* | (alignment buffer) | of the next flash page | |
* +-------> |---------------------------------| | |
* | | | | |
* | | | | |
* | | | | |
* .data | copy of .data area | | |
* | | | | |
* | | | | |
* | | | <------- __data_load, __fastdata_load | |
* +-------> |---------------------------------| | |
* | | Static Constructors (C++) | | |
* | | ------------------------------- | | |
* | | | | |
* .text | | | |
* | | C/C++ code | | |
* | | (contains .fastcode) | | |
* | | | <------- __fastcode_load, __fastcode_start, __fastcode_end | |
* +-------> |---------------------------------| | |
* | | | | |
* .reset | Interrupt Vectors (in ROM) | <------- __vector_table_ram_load | |
* | | (copy of .vectors) | <------- __vector_table_rom_start | |
* +-------> |---------------------------------| 0x0800 0000 <--- __flash_start | |
* | |
* The first two words (32-bit) in the Flash defines the initial stack pointer | |
* location and the reset handler location. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment