zephyr/cmake/linker_script/common/kobject-text.cmake
Björn Bergman 128698fd36 cmake: userspace: A stab at USERSPACE + CMAKE_LINKER_GENERATOR
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>
2025-03-27 17:17:03 +01:00

48 lines
1.1 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
# The contents of this file is based on include/zephyr/linker/kobject-text.ld
# Please keep in sync
if(CONFIG_USERSPACE)
zephyr_linker_section(NAME _kobject_text_area
GROUP TEXT_REGION NOINPUT)
zephyr_linker_section_configure(
SECTION
_kobject_text_area
INPUT
".kobject_data.literal*"
".kobject_data.text*"
MIN_SIZE ${CONFIG_KOBJECT_TEXT_AREA}
MAX_SIZE ${CONFIG_KOBJECT_TEXT_AREA}
SYMBOLS
_kobject_text_area_start
_kobject_text_area_end
)
zephyr_linker_symbol(
SYMBOL
_kobject_text_area_used
EXPR
"(@_kobject_text_area_end@ - @_kobject_text_area_start@)"
)
if(CONFIG_DYNAMIC_OBJECTS)
zephyr_linker_section_configure(
SECTION
_kobject_text_area
SYMBOLS
z_object_gperf_find
z_object_gperf_wordlist_foreach
PASS NOT LINKER_ZEPHYR_FINAL
)
else()
zephyr_linker_section_configure(
SECTION
_kobject_text_area
SYMBOLS
k_object_find
k_object_wordlist_foreach
PASS NOT LINKER_ZEPHYR_FINAL
)
endif()
endif()