MCU boot loader in combination with CPP libraries does not work

Hi,

In order to make firmware updates over Bluetooth work, I need to enable the MCU boot loader. Is use CONFIG_BOOTLOADER_MCUBOOT=y in my prj.conf file to enable it. My code makes us of the standard CPP libraries and I enable them with CONFIG_LIB_CPLUSPLUS=y. The standard libraries work fine however when I enable the MCU boot loader I get the following error message:

fatal error: algorithm: No such file or directory
6 | #include <algorithm>
  |          ^~~~~~~~~~~

and

fatal error: cstdlib: No such file or directory
    2 | #include <cstdlib>
      |          ^~~~~~~~~

Do I miss some extra configurations or is there something else I am missing?

Thanks,
Stan

Parents
  • Hello Stan, 

    Do you mind sharing what version of the nRF Connect SDK you are working on? Are you using a specific Bluetooth sample?

    Thanks.

    -Øyvind

  • Thank you for your reply.

    I'm using the nRF connect SDK V2.0.0. I do not use a specific sample, I use my own code. My bluetooth and general configurations are as follows:

    CONFIG_HEAP_MEM_POOL_SIZE=8192
    CONFIG_MAIN_STACK_SIZE=8192
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_PINCTRL=n
     
    # General
    CONFIG_LIB_CPLUSPLUS=y
    CONFIG_CPLUSPLUS=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_STD_CPP14=y
    CONFIG_POLL=y
    
    # Bluetooth
    CONFIG_BT=y
    CONFIG_BT_SMP=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_OBSERVER=y
    CONFIG_BT_DEVICE_NAME="Device Lab"
    CONFIG_BLUETOOTH_DEVNAME="Minigolf"
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=2
    CONFIG_BT_LBS_SECURITY_ENABLED=n
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_NUS_CLIENT=y
    CONFIG_BT_GATT_DM=y
      
    # Coded PHY
    CONFIG_BT_CTLR_ADV_EXT=y
    CONFIG_BT_CTLR_PHY_CODED=y
    CONFIG_BT_EXT_ADV=y
    CONFIG_BT_USER_PHY_UPDATE=y
     
     
    # Shell
    CONFIG_SHELL=y
    CONFIG_SHELL_CMDS=n                     # Save memory by disabling built-in commands
    CONFIG_SHELL_BACKEND_RTT=y              # RTT Shell
    CONFIG_SHELL_BT_NUS=y                   # NUS Shell
    CONFIG_SHELL_BT_NUS_LOG_LEVEL_DBG=n     # Pollutes RTT log
    

    Edit:

    I also tried the same code with the nRF Connect SDK V1.9.1 but that did work either.

    Stan

  • Stan, where are the two files located in your SDK? I find algorithm in 
    modules\lib\matter\third_party\pigweed\repo\pw_minimal_cpp_stdlib\public\algorithm

    Our Matter samples are based on CPP, have a look at the configurations of e.g. light_bulb sample (nrf\samples\matter\light_bulb\CMakeLists.txt)

    Are you able to build this sample?

  • I can build the matter light bulb example. And indeed the algorithm library is located in: modules\lib\matter\third_party\pigweed\repo\pw_minimal_cpp_stdlib\public\algorithm.

    However, in my code I do not make use of matter and therefore the matter library and third party libraries are not included. I did found the proper place of the algorithms library: ~ncs/toolchains/v2.0.0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/include/c++/10.3.0/algorithm. What is the best way to include this directory into my project?

    I still think it is weird that the std libraries do not work anymore when adding the MCU boot loader. Not sure if that is suppose to happen or a bug.

  • I'm afraid I'm not aware of how to include that. Please contact the Zephyr community on Discord . It has its own CPP discussion thread. 

Reply Children
No Data
Related