/* ****************************************************************************** ** ** @file : LinkerScript.ld ** ** @author : Auto-generated by STM32CubeIDE ** ** @brief : Linker script for STM32F103RETx Device from STM32F1 series ** 512KBytes FLASH ** 64KBytes RAM ** ** Set heap size, stack size and stack location according ** to application requirements. ** ** Set memory bank area and size if external memory is used ** ** Target : STMicroelectronics STM32 ** ** Distribution: The file is distributed as is, without any warranty ** of any kind. ** ****************************************************************************** ** @attention ** ** Copyright (c) 2025 STMicroelectronics. ** All rights reserved. ** ** This software is licensed under terms that can be found in the LICENSE file ** in the root directory of this software component. ** If no LICENSE file comes with this software, it is provided AS-IS. ** ****************************************************************************** */
/* Entry Point */ ENTRY(Reset_Handler)
/* Highest address of the user mode stack */ _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200; /* required amount of heap */ _Min_Stack_Size = 0x400; /* required amount of stack */
/* Sections */ SECTIONS { /* The startup code into "FLASH" Rom type memory */ .isr_vector : { . = ALIGN(4); KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); } >FLASH
/* The program code and other data into "FLASH" Rom type memory */ .text : { . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.glue_7) /* glue arm to thumb code */ *(.glue_7t) /* glue thumb to arm code */ *(.eh_frame)
KEEP (*(.init)) KEEP (*(.fini))
. = ALIGN(4); _etext = .; /* define a global symbols at end of code */ } >FLASH
/* Constant data into "FLASH" Rom type memory */ .rodata : { . = ALIGN(4); *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ . = ALIGN(4); } >FLASH
.ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ { . = ALIGN(4); *(.ARM.extab* .gnu.linkonce.armextab.*) . = ALIGN(4); } >FLASH
.ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ { . = ALIGN(4); __exidx_start = .; *(.ARM.exidx*) __exidx_end = .; . = ALIGN(4); } >FLASH
.preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ { . = ALIGN(4); PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); . = ALIGN(4); } >FLASH
.init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ { . = ALIGN(4); PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); . = ALIGN(4); } >FLASH
.fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ { . = ALIGN(4); PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT(.fini_array.*))) KEEP (*(.fini_array*)) PROVIDE_HIDDEN (__fini_array_end = .); . = ALIGN(4); } >FLASH
/* Used by the startup to initialize data */ _sidata = LOADADDR(.data);
/* Initialized data sections into "RAM" Ram type memory */ .data : { . = ALIGN(4); _sdata = .; /* create a global symbol at data start */ *(.data) /* .data sections */ *(.data*) /* .data* sections */ *(.RamFunc) /* .RamFunc sections */ *(.RamFunc*) /* .RamFunc* sections */
. = ALIGN(4); _edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
/* Uninitialized data section into "RAM" Ram type memory */ . = ALIGN(4); .bss : { /* This is used by the startup in order to initialize the .bss section */ _sbss = .; /* define a global symbol at bss start */ __bss_start__ = _sbss; *(.bss) *(.bss*) *(COMMON)
. = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = _ebss; } >RAM
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */ ._user_heap_stack : { . = ALIGN(8); PROVIDE ( end = . ); PROVIDE ( _end = . ); . = . + _Min_Heap_Size; . = . + _Min_Stack_Size; . = ALIGN(8); } >RAM
/* Remove information from the compiler libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) }
.ARM.attributes 0 : { *(.ARM.attributes) } }
$ arm-linux-gnueabihf-readelf -a cpptest.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x8000361 Start of program headers: 52 (bytes into file) Start of section headers: 706172 (bytes into file) Flags: 0x5000200, Version5 EABI, soft-float ABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 3 Size of section headers: 40 (bytes) Number of section headers: 26 Section header string table index: 25
Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .isr_vector PROGBITS 08000000 001000 0001e4 00 A 0 0 1 [ 2] .text PROGBITS 080001e4 0011e4 000c80 00 AX 0 0 4 [ 3] .rodata PROGBITS 08000e64 001e64 000024 00 A 0 0 4 [ 4] .ARM.extab PROGBITS 08000e88 00200c 000000 00 W 0 0 1 [ 5] .ARM PROGBITS 08000e88 00200c 000000 00 W 0 0 1 [ 6] .preinit_array PREINIT_ARRAY 08000e88 00200c 000000 04 WA 0 0 1 [ 7] .init_array INIT_ARRAY 08000e88 001e88 000004 04 A 0 0 4 [ 8] .fini_array FINI_ARRAY 08000e8c 001e8c 000004 04 A 0 0 4 [ 9] .data PROGBITS 20000000 002000 00000c 00 WA 0 0 4 [10] .bss NOBITS 2000000c 00200c 000020 00 WA 0 0 4 [11] ._user_heap_stack NOBITS 2000002c 00202c 000604 00 WA 0 0 1 [12] .ARM.attributes ARM_ATTRIBUTES 00000000 00200c 000029 00 0 0 1 [13] .debug_info PROGBITS 00000000 002035 00217c 00 0 0 1 [14] .debug_abbrev PROGBITS 00000000 0041b1 000ba6 00 0 0 1 [15] .debug_aranges PROGBITS 00000000 004d58 000370 00 0 0 8 [16] .debug_rnglists PROGBITS 00000000 0050c8 000272 00 0 0 1 [17] .debug_macro PROGBITS 00000000 00533a 0176f5 00 0 0 1 [18] .debug_line PROGBITS 00000000 01ca2f 003a17 00 0 0 1 [19] .debug_str PROGBITS 00000000 020446 089bcc 01 MS 0 0 1 [20] .comment PROGBITS 00000000 0aa012 000043 01 MS 0 0 1 [21] .debug_frame PROGBITS 00000000 0aa058 000bbc 00 0 0 4 [22] .debug_line_str PROGBITS 00000000 0aac14 000066 01 MS 0 0 1 [23] .symtab SYMTAB 00000000 0aac7c 000f40 10 24 134 4 [24] .strtab STRTAB 00000000 0abbbc 0009a3 00 0 0 1 [25] .shstrtab STRTAB 00000000 0ac55f 00011c 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), D (mbind), y (purecode), p (processor specific)
There are no section groups in this file.
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x001000 0x08000000 0x08000000 0x00e90 0x00e90 R E 0x1000 LOAD 0x002000 0x20000000 0x08000e90 0x0000c 0x0002c RW 0x1000 LOAD 0x00002c 0x2000002c 0x08000e9c 0x00000 0x00604 RW 0x1000
arm-none-eabi-objdump -h -S cpptest.elf > "cpptest.list" text data bss dec hex filename 3728 12 1572 5312 14c0 cpptest.elf Finished building: default.size.stdout
main.cpp가 되고 나서 마지막 두줄이 생겼다?
$ arm-linux-gnueabihf-readelf -a cpptest.elf ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x8000375 Start of program headers: 52 (bytes into file) Start of section headers: 714648 (bytes into file) Flags: 0x5000200, Version5 EABI, soft-float ABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 3 Size of section headers: 40 (bytes) Number of section headers: 26 Section header string table index: 25
Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .isr_vector PROGBITS 08000000 001000 0001e4 00 A 0 0 1 [ 2] .text PROGBITS 080001e4 0011e4 000c94 00 AX 0 0 4 [ 3] .rodata PROGBITS 08000e78 001e78 000024 00 A 0 0 4 [ 4] .ARM.extab PROGBITS 08000e9c 00200c 000000 00 W 0 0 1 [ 5] .ARM PROGBITS 08000e9c 00200c 000000 00 W 0 0 1 [ 6] .preinit_array PREINIT_ARRAY 08000e9c 00200c 000000 04 WA 0 0 1 [ 7] .init_array INIT_ARRAY 08000e9c 001e9c 000004 04 A 0 0 4 [ 8] .fini_array FINI_ARRAY 08000ea0 001ea0 000004 04 A 0 0 4 [ 9] .data PROGBITS 20000000 002000 00000c 00 WA 0 0 4 [10] .bss NOBITS 2000000c 00200c 000020 00 WA 0 0 4 [11] ._user_heap_stack NOBITS 2000002c 00202c 000604 00 WA 0 0 1 [12] .ARM.attributes ARM_ATTRIBUTES 00000000 00200c 000029 00 0 0 1 [13] .debug_info PROGBITS 00000000 002035 002195 00 0 0 1 [14] .debug_abbrev PROGBITS 00000000 0041ca 000ba7 00 0 0 1 [15] .debug_aranges PROGBITS 00000000 004d78 000370 00 0 0 8 [16] .debug_rnglists PROGBITS 00000000 0050e8 000273 00 0 0 1 [17] .debug_macro PROGBITS 00000000 00535b 019149 00 0 0 1 [18] .debug_line PROGBITS 00000000 01e4a4 003a21 00 0 0 1 [19] .debug_str PROGBITS 00000000 021ec5 08a262 01 MS 0 0 1 [20] .comment PROGBITS 00000000 0ac127 000043 01 MS 0 0 1 [21] .debug_frame PROGBITS 00000000 0ac16c 000bbc 00 0 0 4 [22] .debug_line_str PROGBITS 00000000 0acd28 000066 01 MS 0 0 1 [23] .symtab SYMTAB 00000000 0acd90 000f40 10 24 134 4 [24] .strtab STRTAB 00000000 0adcd0 0009aa 00 0 0 1 [25] .shstrtab STRTAB 00000000 0ae67a 00011c 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), D (mbind), y (purecode), p (processor specific)
There are no section groups in this file.
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x001000 0x08000000 0x08000000 0x00ea4 0x00ea4 R E 0x1000 LOAD 0x002000 0x20000000 0x08000ea4 0x0000c 0x0002c RW 0x1000 LOAD 0x00002c 0x2000002c 0x08000eb0 0x00000 0x00604 RW 0x1000
No version information found in this file. Attribute Section: aeabi File Attributes Tag_CPU_name: "7-M" Tag_CPU_arch: v7 Tag_CPU_arch_profile: Microcontroller Tag_THUMB_ISA_use: Thumb-2 Tag_ABI_PCS_wchar_t: 4 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_align_needed: 8-byte Tag_ABI_enum_size: small Tag_CPU_unaligned_access: v6