zephyr/cmake/usage/usage.cmake
Ederson de Souza d156a03074 cmake: New target which generates a sort of development kit for llext
Loadable extensions need access to Zephyr (and Zephyr application)
includes and some CFLAGS to be properly built. This patch adds a new
target, `llext-edk`, which generates a tar file with those includes and
flags that can be loaded from cmake and make files.

A Zephyr application willing to expose some API to extensions it loads
only need to add the include directories describing such APIs to the
Zephyr ones via zephyr_include_directories() CMake call.

A new Kconfig option, CONFIG_LLEXT_EDK_NAME allows one to control some
aspects of the generated file, which enables some customization - think
of an application called ACME, willing to have a ACME_EXTENSION_KIT or
something.

All EDK Kconfig options are behind CONFIG_LLEXT_EDK, which doesn't
depend on LLEXT directly - so that EDK features can be leveraged by
downstream variations of loadable extensions.

Also, each arch may need different compiler flags for extensions: those
are handled by the `LLEXT_CFLAGS` cmake flag. An example is set for GCC
ARM.

Finally, EDK throughout this patch means Extension Development Kit,
which is a bad name, but at least doesn't conflict with SDK.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00

45 lines
2.0 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
if(NOT DEFINED ZEPHYR_BASE)
message(FATAL_ERROR "ZEPHYR_BASE not set")
endif()
get_filename_component(generator ${CMAKE_MAKE_PROGRAM} NAME)
if(${generator} STREQUAL ninja)
set(verbose "-v")
else()
set(verbose "VERBOSE=1")
endif()
message("Cleaning targets:")
message(" clean - Remove most generated files but keep configuration and backup files")
message(" pristine - Remove all files in the build directory")
message("")
message("Kconfig targets:")
message(" menuconfig - Update .config using a console-based interface")
message(" guiconfig - Update .config using a graphical interface")
message("")
message("Other generic targets:")
message(" all - Build a zephyr application")
message(" run - Build a zephyr application and run it if the board supports emulation")
message(" flash - Run \"west flash\"")
message(" debug - Run \"west debug\"")
message(" debugserver - Run \"west debugserver\" (or start GDB server on port 1234 for QEMU targets)")
message(" attach - Run \"west attach\"")
message(" ram_report - Build and create RAM usage report")
message(" rom_report - Build and create ROM usage report")
message(" initlevels - Display the initialization sequence")
message(" boards - Display supported boards")
message(" shields - Display supported shields")
message(" usage - Display this text")
message(" llext-edk - Build the Linkable Loadable Extension (LLEXT) Extension Development Kit (EDK)")
message(" help - Display all build system targets")
message("")
message("Build flags:")
message("")
message(" ${generator} ${verbose} [targets] verbose build")
message(" cmake -DW=n Enable extra gcc checks, n=1,2,3 where")
message(" 1: warnings which may be relevant and do not occur too often")
message(" 2: warnings which occur quite often but may still be relevant")
message(" 3: more obscure warnings, can most likely be ignored")
message(" Multiple levels can be combined with W=12 or W=123")