cmake: Reuse llext flags for EDK
Some flags are common between in tree extensions and out of tree supported by the EDK. Instead of duplicating those flags, the EDK reuses the llext ones. However, as the EDK has its own needs, two new lists, `LLEXT_EDK_APPEND_FLAGS` and `LLEXT_EDK_REMOVE_FLAGS` are defined to allow EDK to append or remove flags as needed. Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
This commit is contained in:
parent
dc8d7ada19
commit
cd535b75aa
3 changed files with 22 additions and 8 deletions
|
@ -2064,6 +2064,17 @@ endif()
|
|||
|
||||
# Extension Development Kit (EDK) generation.
|
||||
set(llext_edk_file ${PROJECT_BINARY_DIR}/${CONFIG_LLEXT_EDK_NAME}.tar.xz)
|
||||
|
||||
# TODO maybe generate flags for C CXX ASM
|
||||
zephyr_get_compile_options_for_lang(C zephyr_flags)
|
||||
|
||||
# Filter out non LLEXT and LLEXT_EDK flags - and add required ones
|
||||
llext_filter_zephyr_flags(LLEXT_REMOVE_FLAGS ${zephyr_flags} llext_edk_cflags)
|
||||
llext_filter_zephyr_flags(LLEXT_EDK_REMOVE_FLAGS ${llext_edk_cflags} llext_edk_cflags)
|
||||
|
||||
list(APPEND llext_edk_cflags ${LLEXT_APPEND_FLAGS})
|
||||
list(APPEND llext_edk_cflags ${LLEXT_EDK_APPEND_FLAGS})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${llext_edk_file}
|
||||
# Regenerate syscalls in case CONFIG_LLEXT_EDK_USERSPACE_ONLY
|
||||
|
@ -2085,7 +2096,7 @@ add_custom_command(
|
|||
-DINTERFACE_INCLUDE_DIRECTORIES="$<JOIN:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_INCLUDE_DIRECTORIES>,:>"
|
||||
-Dllext_edk_file=${llext_edk_file}
|
||||
-DAUTOCONF_H=${AUTOCONF_H}
|
||||
-DLLEXT_CFLAGS="${LLEXT_CFLAGS}"
|
||||
-Dllext_cflags="${llext_edk_cflags}"
|
||||
-Dllext_edk_name=${CONFIG_LLEXT_EDK_NAME}
|
||||
-DWEST_TOPDIR=${WEST_TOPDIR}
|
||||
-DZEPHYR_BASE=${ZEPHYR_BASE}
|
||||
|
|
|
@ -59,8 +59,11 @@ set(LLEXT_APPEND_FLAGS
|
|||
-mthumb
|
||||
)
|
||||
|
||||
set(LLEXT_CFLAGS
|
||||
-mlong-calls
|
||||
-mthumb
|
||||
list(APPEND LLEXT_EDK_REMOVE_FLAGS
|
||||
--sysroot=.*
|
||||
-fmacro-prefix-map=.*
|
||||
)
|
||||
|
||||
list(APPEND LLEXT_EDK_APPEND_FLAGS
|
||||
-nodefaultlibs
|
||||
-c)
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# zephyr_interface target.
|
||||
# - AUTOCONF_H: Name of the autoconf.h file, used to generate the imacros flag.
|
||||
# - llext_edk_file: Output file name for the tarball.
|
||||
# - LLEXT_CFLAGS: Additional flags to be added to the generated flags.
|
||||
# - llext_cflags: Additional flags to be added to the generated flags.
|
||||
# - ZEPHYR_BASE: Path to the zephyr base directory.
|
||||
# - WEST_TOPDIR: Path to the west top directory.
|
||||
# - APPLICATION_SOURCE_DIR: Path to the application source directory.
|
||||
|
@ -44,9 +44,9 @@ set(autoconf_h_edk ${llext_edk_inc}/${AUTOCONF_H})
|
|||
cmake_path(RELATIVE_PATH AUTOCONF_H BASE_DIRECTORY ${PROJECT_BINARY_DIR} OUTPUT_VARIABLE autoconf_h_rel)
|
||||
|
||||
list(APPEND base_flags_make
|
||||
"${LLEXT_CFLAGS} -imacros\$(${install_dir_var})/include/zephyr/${autoconf_h_rel}")
|
||||
"${llext_cflags} -imacros\$(${install_dir_var})/include/zephyr/${autoconf_h_rel}")
|
||||
list(APPEND base_flags_cmake
|
||||
"${LLEXT_CFLAGS} -imacros\${CMAKE_CURRENT_LIST_DIR}/include/zephyr/${autoconf_h_rel}")
|
||||
"${llext_cflags} -imacros\${CMAKE_CURRENT_LIST_DIR}/include/zephyr/${autoconf_h_rel}")
|
||||
|
||||
file(MAKE_DIRECTORY ${llext_edk_inc})
|
||||
foreach(dir ${include_dirs})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue