Lines Matching +full:llext +full:- +full:edk
1 # SPDX-License-Identifier: Apache-2.0
5 # Note that this is *NOT* the top-level CMakeLists.txt. That's in the
26 # and https://cmake.org/pipermail/cmake/2019-May/thread.html#69496
36 # -fmacro-prefix-map=${ZEPHYR_BASE}=
57 # - device dependencies structs must be generated (CONFIG_DEVICE_DEPS=y)
58 # - ISR tables must be generated (CONFIG_GEN_ISR_TABLES=y)
59 # - Kernel objects hash tables (CONFIG_USERSPACE=y)
60 # - Application memory partitions (CONFIG_USERSPACE=y)
66 # - zephyr_pre0: linker sections may resize / addresses may relocate
67 # - zephyr_pre1: All linker section sizes are fixed, addresses cannot change
68 # - zephyr_final: Final image.
76 # Three stage linking active: pre0 -> pre1 -> final, this will correspond to `pre1`
77 # Two stage linking active: pre0 -> final, this will correspond to `pre0`
94 set_property( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little${ARCH}) # BFD format
101 # "zephyr_interface" is a source-less library that encapsulates all the global
105 # https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries
108 # "zephyr" is a catch-all CMake library for source files that can be
133 "-DEXTRA_${var}=$ENV{${var}}' instead."
144 # Ensure that include/zephyr/toolchain.h includes toolchain/other.h for all off-tree toolchains
151 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,no_strict_aliasing>>)
263 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,required>>)
270 set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp98>)
273 set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp11>) # Default in kconfig
276 set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp14>)
279 set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp17>)
282 set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp2a>)
285 set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp20>)
288 set(STD_CPP_DIALECT_FLAGS $<TARGET_PROPERTY:compiler-cpp,dialect_cpp2b>)
301 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,no_exceptions>>)
306 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,no_rtti>>)
312 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,warning_error_misra_sane>>)
334 # @Intent: Set compiler specific flag to disable printf-related optimizations
338 # @Intent: Set compiler specific flag for tentative definitions, no-common
375 # Common toolchain-agnostic assembly flags
377 $<$<COMPILE_LANGUAGE:ASM>:-D_ASMLANGUAGE>
437 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,warning_base>>)
441 # cmake -DW=... settings
443 # W=1 - warnings that may be relevant and does not occur too often
444 # W=2 - warnings that occur quite often but may still be relevant
445 # W=3 - the more obscure warnings, can most likely be ignored
447 # @Intent: Add cmake -DW toolchain supported warnings, if any
450 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,warning_dw_1>>)
455 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,warning_dw_2>>)
460 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,warning_dw_3>>)
468 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,warning_error_implicit_int>>)
481 # 'cmake -DEXTRA_CFLAGS="-Werror -Wno-deprecated-declarations" ..'
484 zephyr_cc_option(-fno-asynchronous-unwind-tables)
492 zephyr_cc_option(-ftls-model=local-exec)
497 zephyr_cc_option(-fomit-frame-pointer)
499 zephyr_cc_option(-fno-omit-frame-pointer)
512 zephyr_cc_option(-fno-reorder-functions)
516 # `min-pagesize` parameter (defaults to 0x1000). The `min-pagesize` parameter
519 zephyr_cc_option(--param=min-pagesize=0)
522 zephyr_cc_option(-fno-defer-pop)
526 zephyr_cc_option(-Wno-vla)
529 zephyr_cc_option_ifdef(CONFIG_STACK_USAGE -fstack-usage)
541 zephyr_cc_option(-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=CMAKE_SOURCE_DIR)
542 zephyr_cc_option(-fmacro-prefix-map=${ZEPHYR_BASE}=ZEPHYR_BASE)
544 zephyr_cc_option(-fmacro-prefix-map=${WEST_TOPDIR}=WEST_TOPDIR)
564 set(build_version_argument "-DBUILD_VERSION=${BUILD_VERSION}")
570 # Likely a git-submodule. Let's ask git where the real database is located.
574 COMMAND ${GIT_EXECUTABLE} rev-parse --absolute-git-dir
582 message(WARNING "BUILD_VERSION: git rev-parse failed: ${stderr}")
585 message(WARNING "BUILD_VERSION: git rev-parse warned: ${stderr}")
592 "please specify '-DBUILD_VERSION=<version>'")
596 "repository, please specify '-DBUILD_VERSION=<version>'")
606 COMMAND ${CMAKE_COMMAND} -DZEPHYR_BASE=${ZEPHYR_BASE}
607 -DOUT_FILE=${PROJECT_BINARY_DIR}/include/generated/zephyr/version.h
608 -DVERSION_TYPE=KERNEL
609 -DVERSION_FILE=${ZEPHYR_BASE}/VERSION
610 -DKERNEL_VERSION_CUSTOMIZATION="$<TARGET_PROPERTY:version_h,KERNEL_VERSION_CUSTOMIZATION>"
612 -P ${ZEPHYR_BASE}/cmake/gen_version_h.cmake
623 COMMAND ${CMAKE_COMMAND} -DZEPHYR_BASE=${ZEPHYR_BASE}
624 -DOUT_FILE=${PROJECT_BINARY_DIR}/include/generated/zephyr/app_version.h
625 -DVERSION_TYPE=APP
626 -DVERSION_FILE=${APPLICATION_SOURCE_DIR}/VERSION
627 -DAPP_VERSION_CUSTOMIZATION="$<TARGET_PROPERTY:app_version_h,APP_VERSION_CUSTOMIZATION>"
629 -P ${ZEPHYR_BASE}/cmake/gen_version_h.cmake
675 # https://cmake.org/pipermail/cmake/2019-June/069547.html
693 set(edk_syscall_list_h ${CMAKE_CURRENT_BINARY_DIR}/edk/include/generated/zephyr/syscall_list.h)
700 # Other OS: The list will update whenever a file is added/removed/modified and ensure a re-build.
709 set(syscalls_links --create-links ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/syscalls_links)
717 --directory ${ZEPHYR_BASE}/include # Walk this directory
718 --out-file ${syscalls_subdirs_txt} # Write file with discovered folder
719 --trigger-file ${syscalls_subdirs_trigger} # Trigger file that is used for json generation
722 file(STRINGS ${syscalls_subdirs_txt} PARSE_SYSCALLS_PATHS_DEPENDS ENCODING UTF-8)
726 # Hence adding a file requires CMake to re-run to add this file to the file list.
740 COMMAND ${CMAKE_COMMAND} -E echo ""
750 --directory ${ZEPHYR_BASE}/include # Walk this directory
751 --out-file ${syscalls_subdirs_txt} # Write file with discovered folder
752 --trigger-file ${syscalls_subdirs_trigger} # Trigger file that is used for json generation
764 # Thus CMake only needs to re-run when sub-directories are added / removed, which is indicated
796 --include ${d}
807 --scan ${ZEPHYR_BASE}/include # Read files from this dir
808 --scan ${ZEPHYR_BASE}/drivers # For net sockets
809 --scan ${ZEPHYR_BASE}/subsys/net # More net sockets
811 --json-file ${syscalls_json} # Write this file
812 --tag-struct-file ${struct_tags_json} # Write subsystem list to this file
813 --file-list ${syscalls_file_list_output}
814 $<$<BOOL:${CONFIG_EMIT_ALL_SYSCALLS}>:--emit-all-syscalls>
840 # 64-bit systems do not require special handling of 64-bit system call
844 set(SYSCALL_LONG_REGISTERS_ARG --long-registers)
848 set(SYSCALL_SPLIT_TIMEOUT_ARG --split-type k_timeout_t --split-type k_ticks_t)
855 ${CMAKE_COMMAND} -E copy
870 --json-file ${syscalls_json} # Read this file
871 --base-output include/generated/zephyr/syscalls # Write to this dir
872 --syscall-dispatch include/generated/zephyr/syscall_dispatch.c # Write this file
873 --syscall-exports-llext include/generated/zephyr/syscall_exports_llext.c
874 --syscall-weakdefs-llext syscall_weakdefs_llext.c # compiled in CMake library 'syscall_weakdefs'
875 --syscall-list ${syscall_list_h}
876 $<$<BOOL:${CONFIG_USERSPACE}>:--gen-mrsh-files>
886 set(gen_kobject_list_include_args --include-subsystem-list ${struct_tags_json})
888 set(DRV_VALIDATION ${PROJECT_BINARY_DIR}/include/generated/zephyr/driver-validation.h)
894 --validation-output ${DRV_VALIDATION}
896 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
910 ${CMAKE_CURRENT_BINARY_DIR}/include/generated/device-api-sections.ld
914 ${CMAKE_CURRENT_BINARY_DIR}/include/generated/device-api-sections.cmake
922 --alignment ${CONFIG_LINKER_ITERABLE_SUBALIGN}
923 --input ${struct_tags_json}
924 --tag __subsystem
925 --ld-output ${DEVICE_API_LD_SECTIONS}
926 --cmake-output ${DEVICE_API_LINKER_SECTIONS_CMAKE}
938 # Add a pseudo-target that is up-to-date when all generated headers
939 # are up-to-date.
974 -i $<TARGET_OBJECTS:${OFFSETS_LIB}>
975 -o ${OFFSETS_H_PATH}
1034 # LLEXT exports symbols for all syscalls, including unimplemented ones.
1054 STRIP_PREFIX # Don't use a -I prefix
1059 set(dynamic_deps --dynamic-deps)
1075 --output-source device_deps.c
1076 --output-graphviz dev_graph.dot
1078 --num-dynamic-devices ${number_of_dynamic_devices}
1079 --kernel $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
1080 --zephyr-base ${ZEPHYR_BASE}
1081 --start-symbol "$<TARGET_PROPERTY:linker,devices_start_symbol>"
1118 set_ifndef( TOPT -Wl,-T) # Use this if the compiler driver doesn't set a value
1152 # only initialized post-kernel.
1159 set(APP_SMEM_PINNED_PARTITION_LIST_ARG "--pinpartitions=${APP_SMEM_PINNED_PARTITION_LIST_ARG_CSL}")
1166 set(LIBC_PART -l libc.a z_libc_partition -l libm.a z_libc_partition)
1169 set(LIBC_PART -l libc_nano.a z_libc_partition -l libm_nano.a z_libc_partition)
1172 set(LIBC_PART -l libc.a z_libc_partition)
1179 -f ${CMAKE_BINARY_DIR}/compile_commands.json
1180 -o ${APP_SMEM_UNALIGNED_LD}
1181 $<$<BOOL:${APP_SMEM_PINNED_UNALIGNED_LD}>:--pinoutput=${APP_SMEM_PINNED_UNALIGNED_LD}>
1185 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
1218 -e $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
1219 -o ${APP_SMEM_ALIGNED_LD}
1220 $<$<BOOL:${APP_SMEM_PINNED_ALIGNED_LD}>:--pinoutput=${APP_SMEM_PINNED_ALIGNED_LD}>
1224 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
1252 --kernel $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
1253 --gperf-output ${KOBJECT_PREBUILT_HASH_LIST}
1255 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
1269 --output-file ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE}
1270 --multiple-iterations 10
1285 -i ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE}
1286 -o ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC}
1287 -p "struct k_object"
1288 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
1304 "${NO_COVERAGE_FLAGS} -fno-function-sections -fno-data-sections")
1318 set(KOBJECT_LINKER_HEADER_DATA "${PROJECT_BINARY_DIR}/include/generated/zephyr/linker-kobject-prebuilt-data.h")
1325 --object $<TARGET_OBJECTS:kobj_prebuilt_hash_output_lib>
1326 --outdir ${PROJECT_BINARY_DIR}/include/generated/zephyr
1327 --datapct ${CONFIG_KOBJECT_DATA_AREA_RESERVE_EXTRA_PERCENT}
1328 --rodata ${CONFIG_KOBJECT_RODATA_AREA_EXTRA_BYTES}
1329 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
1391 list(APPEND GEN_ISR_TABLE_EXTRA_ARG --sw-isr-table)
1395 list(APPEND GEN_ISR_TABLE_EXTRA_ARG --vector-table)
1404 --output-source isr_tables.c
1405 --linker-output-files isr_tables_vt.ld isr_tables_swi.ld
1406 --kernel $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
1407 --intlist-section .intList
1408 --intlist-section intList
1409 $<$<BOOL:${CONFIG_BIG_ENDIAN}>:--big-endian>
1410 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--debug>
1424 -k $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
1425 -o symtab.c
1442 # elf file. More information in gen_kobject_list.py --help.
1452 --kernel $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
1453 --gperf-output ${KOBJECT_HASH_LIST}
1455 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
1471 --output-file ${KOBJECT_HASH_OUTPUT_SRC_PRE}
1472 --multiple-iterations 10
1492 -i ${KOBJECT_HASH_OUTPUT_SRC_PRE}
1493 -o ${KOBJECT_HASH_OUTPUT_SRC}
1494 -p "struct k_object"
1495 $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
1514 "${NO_COVERAGE_FLAGS} -fno-function-sections -fno-data-sections")
1677 ${CMAKE_COMMAND} -E copy ${logical_target_for_zephyr_elf}.map ${KERNEL_MAP_NAME}
1800 -c
1801 -f ${CONFIG_BUILD_OUTPUT_UF2_FAMILY_ID}
1802 -b ${flash_addr}
1803 -o ${KERNEL_UF2_NAME}
1820 --meta-out ${KERNEL_META_PATH}
1821 --zephyr-base=${ZEPHYR_BASE}
1822 $<$<BOOL:${CONFIG_BUILD_OUTPUT_META_STATE_PROPAGATE}>:--meta-state-propagate>
1840 ${CMAKE_COMMAND} -E remove zephyr_pre${index}.elf
1952 ${CMAKE_COMMAND} -E copy ${KERNEL_ELF_NAME} ${KERNEL_EXE_NAME}
1967 ${MAKE} -f ${ZEPHYR_BASE}/scripts/native_simulator/Makefile all --warn-undefined-variables
1968 -r NSI_CONFIG_FILE=${APPLICATION_BINARY_DIR}/zephyr/NSI/nsi_config
1981 --elf-file=${KERNEL_ELF_NAME}
1982 --header-file=${PROJECT_BINARY_DIR}/include/public/zephyr_image_info.h
1983 $<$<BOOL:${adjustment}>:--adjusted-lma=${adjustment}>
1992 #slidgen must be the first post-build command to be executed
1999 --elf-file ${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME}
2000 --slid-listing ${PROJECT_BINARY_DIR}/slid_listing.txt
2010 --elf-file=${check_init_priorities_input}
2029 COMMAND ${check_init_priorities_command} --initlevels
2056 # Generate USB-C VIF policies in XML format
2083 set(LOG_DICT_DB_NAME_ARG --json)
2086 set(LOG_DICT_DB_NAME_ARG --syst)
2095 --build-header ${PROJECT_BINARY_DIR}/include/generated/zephyr/version.h
2104 COMMAND ${CMAKE_COMMAND} -E echo "Generating logging dictionary database: ${LOG_DICT_DB_NAME}"
2125 # Add post_build_commands to post-process the final .elf file produced by
2131 COMMAND ${CMAKE_COMMAND} -E echo "Generating files from ${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME} for board: ${BOARD}"
2143 # Merge in out-of-tree hex files.
2151 -o ${MERGED_HEX_NAME}
2180 ${CMAKE_COMMAND} -E echo
2221 # To avoid false-positive matches, the flag must either be matched first
2231 # Extension Development Kit (EDK) generation.
2248 # Filter out non LLEXT and LLEXT_EDK flags - and add required ones
2252 set(llext_edk_cflags ${zephyr_defs} -DLL_EXTENSION_BUILD)
2257 build_info(llext-edk file PATH ${llext_edk_file})
2258 build_info(llext-edk cflags VALUE ${llext_edk_cflags})
2259 build_info(llext-edk include-dirs VALUE "$<TARGET_PROPERTY:zephyr_interface,INTERFACE_INCLUDE_DIRECTORIES>")
2265 -E make_directory edk/include/generated/zephyr
2269 --json-file ${syscalls_json} # Read this file
2270 --base-output edk/include/generated/zephyr/syscalls # Write to this dir
2271 --syscall-dispatch edk/include/generated/zephyr/syscall_dispatch.c # Write this file
2272 --syscall-list ${edk_syscall_list_h}
2273 $<$<BOOL:${CONFIG_LLEXT_EDK_USERSPACE_ONLY}>:--userspace-only>
2277 -P ${ZEPHYR_BASE}/cmake/llext-edk.cmake
2281 add_custom_target(llext-edk DEPENDS ${llext_edk_file})
2292 zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,nostdincxx>>)
2305 build_info(zephyr zephyr-base VALUE ${ZEPHYR_BASE})