C++ Build Options¶
Custom CMake settings may be specified in the file:
<mltk repo root>/user_options.cmake
NOTE: You must create this file if it doesn’t exist
This file is included at the very beginning of the CMake build script.
Any CMake variable may be include in the file.
Some of the more common settings include:
MLTK_CMAKE_LOG_LEVEL¶
# Enable verbose MLTK CMake log messages
mltk_set(MLTK_CMAKE_LOG_LEVEL debug)
MLTK_PLATFORM_NAME¶
Build for a supported embedded platform.
Refer to Supported Hardware for more details.
NOTE: If this variable is not defined, then the host operating system (e.g. windows
or linux
) is automatically selected.
# Specify the embedded platform
mltk_set(MLTK_PLATFORM_NAME brd2601)
TFLITE_MICRO_ACCELERATOR¶
Specify the Tensorflow-Lite Micro accelerated kernels to include in the build.
# Use the Gecko SDK MVP TFLM kernels
mltk_set(TFLITE_MICRO_ACCELERATOR mvp)
MLTK_TARGET¶
Build for a specific target.
By default, all applications are automatically included during the CMake configuration phase.
This option allows only include a specific package in the configuration.
NOTE: The specified target must be found via find_package()
or mltk_find_package()
.
# Only include the TFLM Python wrapper in the build
mltk_set(MLTK_TARGET mltk_tflite_micro_wrapper)
MLTK_ENABLE_DEBUG_INFO_IN_RELEASE_BUILDS¶
This will add debug symbols to release builds. This is useful for building fully optimized binaries but still allow for single-step debugging
mltk_set(MLTK_ENABLE_DEBUG_INFO_IN_RELEASE_BUILDS ON)
MLTK_ENABLE_OUTPUT_DISASSEMBLY¶
This will disassemble the output binary and generate a log file in the build directory. This is useful for debugging the assembly instructions with the corresponding source code.
NOTE: It is recommended to also enable MLTK_ENABLE_DEBUG_INFO_IN_RELEASE_BUILDS
for release builds.
mltk_set(MLTK_ENABLE_OUTPUT_DISASSEMBLY ON)
MODEL_PROFILER_MODEL¶
# Specify the path to the .tflite model file to profile
# in the mltk_model_profiler application
mltk_set(MODEL_PROFILER_MODEL ~/my_models/my_model.tflite)
HINT:
You can also specify the path to the .mltk.zip
model archive or just specify the MLTK model name, e.g.:
# Specify the path to the model archive
mltk_set(MODEL_PROFILER_MODEL ~/my_models/my_model.mltk.zip)
# Specify the MLTK model name
# NOTE: The model specification must be on the model search path, see:
# https://siliconlabs.github.io/mltk/docs/guides/model_search_path.html
mltk_set(MODEL_PROFILER_MODEL image_example1)
AUDIO_CLASSIFIER_MODEL¶
# Specify the path to the .tflite model file to profile
# in the mltk_audio_classifier application
mltk_set(AUDIO_CLASSIFIER_MODEL ~/my_models/my_model.tflite)
HINT:
You can also specify the path to the .mltk.zip
model archive or just specify the MLTK model name, e.g.:
# Specify the path to the model archive
mltk_set(AUDIO_CLASSIFIER_MODEL ~/my_models/my_model.mltk.zip)
# Specify the MLTK model name
# NOTE: The model specification must be on the model search path, see:
# https://siliconlabs.github.io/mltk/docs/guides/model_search_path.html
mltk_set(AUDIO_CLASSIFIER_MODEL image_example1)