All in all this makes cmake linker generator able to work for at least
most of the kernel tests and samples, on cortex m4.
Make the cmake linker generator have a file-structure more similar to
the ld-skeletons.
Add or edit groups, sections and logic to make the generator reflect
what the ld-skeletons do, esp. for kobjects and APP_SMEM, nonint and
some other details are also effected.
Use the new zephyr_linker_include_generated() and
zephyr_linker_include_var() functions to to handle
${DEVICE_API_LINKER_SECTIONS_CMAKE}, the kobject-prebuilt-*.h files and
APP_SMEM partition. Essentially the output from gen_app_partitions.py,
gen_kobject_placeholders.py.
Add ALIGN_WITH_INPUT on sections being put into DATA_REGION. This makes
the init layout work for ld.
This leverages the updates in gen_app_partitions.py to generate its
output as cmake linker generator sections too, and puts them into a
group defined in linker.cmake
Setup generator variables for alignment of APP_SMEM. Note that this does
not yet handle MPU_ALIGN which depends on the size of the section...
Fix broken k_object_assignment iterable section
Signed-off-by: Björn Bergman <bjorn.bergman@iar.com>
42 lines
1.5 KiB
CMake
42 lines
1.5 KiB
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
# The contents of this file is based on include/zephyr/linker/kobject-priv-stacks.ld
|
|
# Please keep in sync
|
|
|
|
if(CONFIG_USERSPACE)
|
|
if(CONFIG_GEN_PRIV_STACKS)
|
|
# Padding is needed to preserve kobject addresses
|
|
# if we have reserved more space than needed.
|
|
zephyr_linker_section(NAME .priv_stacks_noinit GROUP NOINIT_REGION NOINPUT NOINIT
|
|
MIN_SIZE @KOBJECT_PRIV_STACKS_SZ,undef:0@ MAX_SIZE @KOBJECT_PRIV_STACKS_SZ,undef:0@)
|
|
|
|
zephyr_linker_section_configure(
|
|
SECTION .priv_stacks_noinit
|
|
SYMBOLS z_priv_stacks_ram_start
|
|
)
|
|
|
|
# During LINKER_KOBJECT_PREBUILT and LINKER_ZEPHYR_PREBUILT,
|
|
# space needs to be reserved for the rodata that will be
|
|
# produced by gperf during the final stages of linking.
|
|
# The alignment and size are produced by
|
|
# scripts/build/gen_kobject_placeholders.py. These are here
|
|
# so the addresses to kobjects would remain the same
|
|
# during the final stages of linking (LINKER_ZEPHYR_FINAL).
|
|
zephyr_linker_section_configure(
|
|
SECTION .priv_stacks_noinit
|
|
ALIGN @KOBJECT_PRIV_STACKS_ALIGN,undef:0@
|
|
INPUT ".priv_stacks.noinit"
|
|
KEEP
|
|
PASS LINKER_ZEPHYR_PREBUILT LINKER_ZEPHYR_FINAL
|
|
SYMBOLS z_priv_stacks_ram_aligned_start z_priv_stacks_ram_end
|
|
)
|
|
|
|
if(KOBJECT_PRIV_STACKS_ALIGN)
|
|
zephyr_linker_symbol(
|
|
SYMBOL z_priv_stacks_ram_used
|
|
EXPR "(@z_priv_stacks_ram_end@ - @z_priv_stacks_ram_start@)"
|
|
PASS LINKER_ZEPHYR_FINAL
|
|
)
|
|
endif()
|
|
endif()
|
|
endif()
|