CMake macros and commands
CMake commands
Here is a list of cmake commands which can be called as targets (cmake --build build --target command
format).
menuconfig
: This command will open the KConfig gui, allowing to modify application and firmware options.freezeconfig
: This command will generate a persistent version of the options selected withmenuconfig
, in file sdk.config.flash_layout
: This command prints the flash layout, as will be generated by Gapy.flash_dump_sections
: Dumps an OTA-able package in build/ directory, with all flash sections inside.flash_dump_app_sections
: Dumps an OTA-able package in build/ directory, with only application sections inside.build
: Just build without running the code.image
: Just build and create flash images without running the code.flash
: build, create the flash images, and flash them to target.run
: build, create the flash images, and flash them to target, then run.exec
: build, create the flash images, then run, without flashing.
CMake macros and functions for application development
Here is a list of macros and functions useful for application development.
Functions have named arguments (Python style), i.e. those need to be called with the form: cmake_function(ARG0_NAME arg0_value ARG1_NAME arg1_value)
.
Macros have anonymous arguments (C style), i.e. those need to be called with the form: cmake_function(arg0_value arg1_value)
.
Type of arguments is specified for each documented item.
readfs_add_files
Brief: This function is used to add files to a readfs filesystem, under the hood this pilot gapy’s
--flash-property
switchesNamed arguments:
FILES
: List of files to be added (Mandatory)FLASH
: List of files to be added (Optional, default toflash
)PARTITION
: Name of the readfs partition (Optional, default toreadfs_FLASH
where flash is the chosen flash with FLASH argument)VOLUME
: Name of the volume in which readfs partition is (Optional, default toapp
which is gapy default volume for application partitions)
littlefs_set_root_directory
Brief: This function is used to add files to a littlefs filesystem, under the hood this pilot gapy’s
--flash-property
switchesNamed arguments:
ROOT_DIRECTORY
: Directory containing files to be added (Mandatory)SIZE
: Size in bytes (Optional, default to layout provided)FLASH
: List of files to be added (Optional, default toflash
)PARTITION
: Name of the littlefs partition (Optional, default tolittlefs_FLASH
where flash is the chosen flash with FLASH argument)VOLUME
: Name of the volume in which littlefs partition is (Optional, default toapp
which is gapy default volume for application partitions)
autotiler_define_gen_names
Brief: This macro sets cmake variable names for code generation, like model.c name, gap code name etc.
Anonymous argument:
TARGET_NAME
: Name of the target to be configured (Mandatory)
autotiler_setup
Brief: This macro sets cmake rules for autotiler model compilation and run accordingly to the kconfig variables settings. Note that it also sets default paths and variable names accordingly to the arguments it gets.
Anonymous argument:
TARGET_NAME
: Name of the target to be configured (Mandatory)AT_MODEL_PATH
: Path to a custom autotiler model (not the one set inautotiler_define_gen_names
), useful in multi model code generation (Optional)AT_TENSORS_DIR
: Path to a custom autotiler tensors directory (not the one set inautotiler_define_gen_names
), useful in multi model code generation (Optional)
nntool_setup
Brief: This macro sets cmake rules for nntool when used in commands scripting mode (not via python APIs). It sets basic rules to take an nntool_script file and generate a nntool model state (.json) and autotiler model.c.
Anonymous argument:
TARGET_NAME
: Name of the target to be configured (Mandatory)CONFIG_NNTOOL_MODEL_PATH
: Path to tflite/onnx model (Optional)CONFIG_NNTOOL_SCRIPT_PATH
: Path to nntool commands script file (Optional)COMMON_MODEL_BUILDDIR
: Path to common model build directory (Optional)
setupos
Brief: This macro links the current target to all required SDK targets
Anonymous argument:
TARGET_NAME
: Name of the target to be configured (Mandatory)
sfu_add_graph
Brief: This function configures the command that shall produce SFU configuration from the graph description file.
Named arguments:
TARGET
: (One value) Name of the target in which to add generated SFU configuration filesWITHOUT_L2_DESCRIPTOR
: (Option) If given, disables generation of C L2 descriptorSOURCE
: (One value) File path of the graph description fileOUTPUT_PATH
: (One value) Directory in which to put generated filesINCLUDE_PATH
: (Multi value) List of directories where SFU tool will look for files given inimport
directive of the main src fileOPTIONS
: (Multi value) List of options provided as-is to the SFU tool
setup_sfu_libs
Brief: This macro configures the build of SFU runtime library and includes it inot the target.
Anonymous argument:
TARGET_NAME
: Name of the target in which to add SFU runtime library