File tree Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -1086,11 +1086,13 @@ if(CONFIG_USERSPACE)
10861086 -d ${OBJ_FILE_DIR}
10871087 -o ${APP_SMEM_UNALIGNED_LD}
10881088 ${NEWLIB_PART} ${MBEDTLS_PART}
1089+ $<TARGET_PROPERTY:zephyr_property_target,COMPILE_OPTIONS>
10891090 $<$<BOOL :${CMAKE_VERBOSE_MAKEFILE} >:--verbose>
10901091 DEPENDS
10911092 kernel
10921093 ${ZEPHYR_LIBS_PROPERTY}
10931094 WORKING_DIRECTORY ${PROJECT_BINARY_DIR} /
1095+ COMMAND_EXPAND_LISTS
10941096 COMMENT "Generating app_smem_unaligned linker section"
10951097 )
10961098
@@ -1135,12 +1137,14 @@ if(CONFIG_USERSPACE)
11351137 -e $<TARGET_FILE:app_smem_unaligned_prebuilt>
11361138 -o ${APP_SMEM_ALIGNED_LD}
11371139 ${NEWLIB_PART} ${MBEDTLS_PART}
1140+ $<TARGET_PROPERTY:zephyr_property_target,COMPILE_OPTIONS>
11381141 $<$<BOOL :${CMAKE_VERBOSE_MAKEFILE} >:--verbose>
11391142 DEPENDS
11401143 ${KERNEL_LIBRARY}
11411144 ${ZEPHYR_LIBS_PROPERTY}
11421145 app_smem_unaligned_prebuilt
11431146 WORKING_DIRECTORY ${PROJECT_BINARY_DIR} /
1147+ COMMAND_EXPAND_LISTS
11441148 COMMENT "Generating app_smem_aligned linker section"
11451149 )
11461150endif ()
Original file line number Diff line number Diff line change @@ -630,6 +630,13 @@ if(CONFIG_QEMU_TARGET)
630630 endif ()
631631endif ()
632632
633+ # General purpose Zephyr target.
634+ # This target can be used for custom zephyr settings that needs to be used elsewhere in the build system
635+ #
636+ # Currently used properties:
637+ # - COMPILES_OPTIONS: Used by application memory partition feature
638+ add_custom_target (zephyr_property_target)
639+
633640# "app" is a CMake library containing all the application code and is
634641# modified by the entry point ${APPLICATION_SOURCE_DIR}/CMakeLists.txt
635642# that was specified when cmake was called.
Original file line number Diff line number Diff line change @@ -523,6 +523,19 @@ function(zephyr_library_import library_name library_path)
523523 zephyr_append_cmake_library(${library_name} )
524524endfunction ()
525525
526+ # Place the current zephyr library in the application memory partition.
527+ #
528+ # The partition argument is the name of the partition where the library shall
529+ # be placed.
530+ #
531+ # Note: Ensure the given partition has been define using
532+ # K_APPMEM_PARTITION_DEFINE in source code.
533+ function (zephyr_library_app_memory partition)
534+ set_property (TARGET zephyr_property_target
535+ APPEND PROPERTY COMPILE_OPTIONS
536+ "-l" $<TARGET_FILE_NAME:${ZEPHYR_CURRENT_LIBRARY} > "${partition} " )
537+ endfunction ()
538+
526539# 1.2.1 zephyr_interface_library_*
527540#
528541# A Zephyr interface library is a thin wrapper over a CMake INTERFACE
Original file line number Diff line number Diff line change @@ -284,8 +284,13 @@ top-level ``CMakeLists.txt`` adds the following:
284284
285285 gen_app_partitions.py ... --library libc.a z_libc_partition ..
286286
287- There is no support for expressing this in the project-level configuration
288- or build files; the toplevel ``CMakeLists.txt `` must be edited.
287+ For pre-compiled libraries there is no support for expressing this in the
288+ project-level configuration or build files; the toplevel ``CMakeLists.txt `` must
289+ be edited.
290+
291+ For Zephyr libraries created using ``zephyr_library `` or ``zephyr_library_named ``
292+ the ``zephyr_library_app_memory `` function can be used to specify the memory
293+ partition where all globals in the library should be placed.
289294
290295Pre-defined Memory Partitions
291296-----------------------------
You can’t perform that action at this time.
0 commit comments