Enabling CONFIG_BOOTLOADER_MCUBOOT=y and/or CONFIG_BT=y breaks unrelated modules

We are attempting to add various modules to our project. For simplicity we've reduced our system to a toy setup closely mimicking the structure of our project and are trying to run the tensorflow lite micro module. 

The state of the code here: flite_main_proj compiles without error and runs the tflite hello world code on the nRF5340 dev kit board as expected. 

Problems arise when we try to enable either the bootloader or bluetooth configs, currently commented out in the file proj.conf


CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_BT=y

Either config produces the same errors on build. The following is from enabling MCUBOOT:

151/299] Building C object CMakeFiles/app.dir/main.c.obj
[152/299] Building CXX object modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/main_functions.cpp.obj
FAILED: modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/main_functions.cpp.obj 
ccache /home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ -DKERNEL -DMBEDTLS_CONFIG_FILE=\"mcuboot-mbedtls-cfg.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=1 -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/user/Code/tf-ws/zephyr/include -I/home/user/Code/tf-ws/tflite_main_proj/app/build/mcuboot/zephyr/include/generated -I/home/user/Code/tf-ws/zephyr/soc/arm/nordic_nrf/nrf53 -I/home/user/Code/tf-ws/zephyr/soc/arm/nordic_nrf/common/. -I/home/user/Code/tf-ws/nrf/include -I/home/user/Code/tf-ws/nrf/tests/include -I/home/user/Code/tf-ws/tflite_sub_proj/inc -I/home/user/Code/tf-ws/modules/hal/cmsis/CMSIS/Core/Include -I/home/user/Code/tf-ws/modules/hal/nordic/nrfx -I/home/user/Code/tf-ws/modules/hal/nordic/nrfx/drivers/include -I/home/user/Code/tf-ws/modules/hal/nordic/nrfx/mdk -I/home/user/Code/tf-ws/zephyr/modules/hal_nordic/nrfx/. -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/zephyr/include -I/home/user/Code/tf-ws/modules/crypto/mbedtls/include -I/home/user/Code/tf-ws/modules/crypto/mbedtls/library -I/home/user/Code/tf-ws/zephyr/modules/mbedtls/configs -I/home/user/Code/tf-ws/zephyr/modules/mbedtls/include -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/bootutil/zephyr/.. -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/bootutil/zephyr/../include -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem /home/user/Code/tf-ws/zephyr/lib/libc/minimal/include -isystem /home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem /home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem /home/user/Code/tf-ws/nrfxlib/crypto/nrf_cc312_platform/include -fno-strict-aliasing -Os -fcheck-new -fno-exceptions -fno-rtti -imacros /home/user/Code/tf-ws/tflite_main_proj/app/build/mcuboot/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs --sysroot=/home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/user/Code/tf-ws/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/user/Code/tf-ws/bootloader/mcuboot/boot/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/user/Code/tf-ws/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/user/Code/tf-ws=WEST_TOPDIR -ffunction-sections -fdata-sections -nostdinc -MD -MT modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/main_functions.cpp.obj -MF modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/main_functions.cpp.obj.d -o modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/main_functions.cpp.obj -c /home/user/Code/tf-ws/tflite_sub_proj/lib/main_functions.cpp
/home/user/Code/tf-ws/tflite_sub_proj/lib/main_functions.cpp:19:10: fatal error: tensorflow/lite/micro/all_ops_resolver.h: No such file or directory
   19 | #include <tensorflow/lite/micro/all_ops_resolver.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[153/299] Linking C static library modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a
[154/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/bignum_mod.c.obj
[155/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/camellia.c.obj
[156/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/ccm.c.obj
[157/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/chacha20.c.obj
[158/299] Linking C static library modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a
[159/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/chachapoly.c.obj
[160/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/cipher.c.obj
[161/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/cipher_wrap.c.obj
[162/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/cmac.c.obj
[163/299] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/home/user/Code/tf-ws/modules/crypto/mbedtls/library/code_share.c.obj
[164/299] Linking C static library modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a
[165/299] Building CXX object modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/output_handler.cpp.obj
FAILED: modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/output_handler.cpp.obj 
ccache /home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ -DKERNEL -DMBEDTLS_CONFIG_FILE=\"mcuboot-mbedtls-cfg.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=1 -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/user/Code/tf-ws/zephyr/include -I/home/user/Code/tf-ws/tflite_main_proj/app/build/mcuboot/zephyr/include/generated -I/home/user/Code/tf-ws/zephyr/soc/arm/nordic_nrf/nrf53 -I/home/user/Code/tf-ws/zephyr/soc/arm/nordic_nrf/common/. -I/home/user/Code/tf-ws/nrf/include -I/home/user/Code/tf-ws/nrf/tests/include -I/home/user/Code/tf-ws/tflite_sub_proj/inc -I/home/user/Code/tf-ws/modules/hal/cmsis/CMSIS/Core/Include -I/home/user/Code/tf-ws/modules/hal/nordic/nrfx -I/home/user/Code/tf-ws/modules/hal/nordic/nrfx/drivers/include -I/home/user/Code/tf-ws/modules/hal/nordic/nrfx/mdk -I/home/user/Code/tf-ws/zephyr/modules/hal_nordic/nrfx/. -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/zephyr/include -I/home/user/Code/tf-ws/modules/crypto/mbedtls/include -I/home/user/Code/tf-ws/modules/crypto/mbedtls/library -I/home/user/Code/tf-ws/zephyr/modules/mbedtls/configs -I/home/user/Code/tf-ws/zephyr/modules/mbedtls/include -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/bootutil/zephyr/.. -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/bootutil/zephyr/../include -I/home/user/Code/tf-ws/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem /home/user/Code/tf-ws/zephyr/lib/libc/minimal/include -isystem /home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem /home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem /home/user/Code/tf-ws/nrfxlib/crypto/nrf_cc312_platform/include -fno-strict-aliasing -Os -fcheck-new -fno-exceptions -fno-rtti -imacros /home/user/Code/tf-ws/tflite_main_proj/app/build/mcuboot/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs --sysroot=/home/user/zephyr-sdk-0.16.1/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/user/Code/tf-ws/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/user/Code/tf-ws/bootloader/mcuboot/boot/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/user/Code/tf-ws/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/user/Code/tf-ws=WEST_TOPDIR -ffunction-sections -fdata-sections -nostdinc -MD -MT modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/output_handler.cpp.obj -MF modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/output_handler.cpp.obj.d -o modules/tflite_sub_proj/lib/CMakeFiles/..__tflite_sub_proj__lib.dir/output_handler.cpp.obj -c /home/user/Code/tf-ws/tflite_sub_proj/lib/output_handler.cpp
In file included from /home/user/Code/tf-ws/tflite_sub_proj/lib/output_handler.cpp:17:
/home/user/Code/tf-ws/tflite_sub_proj/inc/output_handler.hpp:20:10: fatal error: tensorflow/lite/c/common.h: No such file or directory
   20 | #include <tensorflow/lite/c/common.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Based on this discussion Setting CONFIG_BOOTLOADER_MCUBOOT=y in prj.config on custom board prevents code working  an attempt was made to include the tf module in the child_image. We added the folder tflite_main_proj/app/child_image which includes a .conf duplicating our proj.conf. Unfortunately this has had no impact on our build and we are still seeing the same errors as before. 

This may be a similar issues to (Missing Forum Thread)

Any advice is appreciated!

Parents
  • We've resolved our issue by adding an additional config in the sub-project kconfig

    config TFLITE_SUBPROJECT
        bool "Tensorflow Lite subproject."
        help
          Tensorflow Lite subproject.


    And using it to gait the sub-project CmakeLists.txt
    add_subdirectory_ifdef(CONFIG_TFLITE_SUBPROJECT lib)
    
    # Include headers
    zephyr_include_directories_ifdef(CONFIG_TFLITE_SUBPROJECT inc)
     

    Config is enabled along with the other tflite configs in the main project .conf files
    ##Tensor Flow Lit Micro
    CONFIG_CPP=y
    CONFIG_STD_CPP17=y
    CONFIG_TENSORFLOW_LITE_MICRO=y
    CONFIG_TFLITE_SUBPROJECT=y


    For anyone with similar problems, the snapshot at github.com/.../tflite_main_proj at fac5eb11 should be a working toy project with both multi image support enabled and tflite hello world running on the nrf5340dk.

Reply
  • We've resolved our issue by adding an additional config in the sub-project kconfig

    config TFLITE_SUBPROJECT
        bool "Tensorflow Lite subproject."
        help
          Tensorflow Lite subproject.


    And using it to gait the sub-project CmakeLists.txt
    add_subdirectory_ifdef(CONFIG_TFLITE_SUBPROJECT lib)
    
    # Include headers
    zephyr_include_directories_ifdef(CONFIG_TFLITE_SUBPROJECT inc)
     

    Config is enabled along with the other tflite configs in the main project .conf files
    ##Tensor Flow Lit Micro
    CONFIG_CPP=y
    CONFIG_STD_CPP17=y
    CONFIG_TENSORFLOW_LITE_MICRO=y
    CONFIG_TFLITE_SUBPROJECT=y


    For anyone with similar problems, the snapshot at github.com/.../tflite_main_proj at fac5eb11 should be a working toy project with both multi image support enabled and tflite hello world running on the nrf5340dk.

Children
No Data
Related