Skip to content

Commit 5952c22

Browse files
keith-packardjgl-meta
authored andcommitted
cmake/linker_script: Fix cmake linker scripts to define _end
The generated scripts don't include a definition for any symbol indicating the end of statically allocated memory (such as "_end"). Add a shared cmake fragment, ram-end.cmake, which contains the necessary instructions to define _end and z_mapped_end consistently to align with the other sample linker scripts. Signed-off-by: Keith Packard <[email protected]> (cherry picked from commit bbec614)
1 parent f6e73ae commit 5952c22

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

cmake/linker_script/arm/linker.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ if(NOT CONFIG_USERSPACE)
135135
zephyr_linker_section_configure(SECTION .noinit INPUT ".kernel_noinit.*")
136136
endif()
137137

138+
include(${COMMON_ZEPHYR_LINKER_DIR}/ram-end.cmake)
139+
138140
zephyr_linker_symbol(OBJECT REGION_RAM SYMBOL __kernel_ram_start EXPR "(@__bss_start@)")
139141
zephyr_linker_symbol(OBJECT REGION_RAM SYMBOL __kernel_ram_end EXPR "(${RAM_ADDR} + ${RAM_SIZE})")
140142
zephyr_linker_symbol(OBJECT REGION_RAM SYMBOL __kernel_ram_size EXPR "(@__kernel_ram_end@ - @__bss_start@)")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
zephyr_linker_section(NAME .last_ram_section VMA RAM LMA RAM_REGION TYPE BSS)
2+
zephyr_linker_section_configure(
3+
SECTION .last_ram_section
4+
INPUT ""
5+
SYMBOLS _end z_mapped_end
6+
KEEP
7+
)

0 commit comments

Comments
 (0)