This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

thingy52-provisioning-demo not compiling with cmake

Hi,

I am currently having issues compiling the thingy52-mesh-provisioning demo from github with cmake. The Readme talks about using SES to compile it, which works fine, but i am trying to make a script to compile it all at once with other demos. The demo comes with a CMakeLists.txt so I assumed it could be copiled with CMake but it could not compile. I have had to make modifications to each layer of CmakeLists files and still it is having linking errors and is not compiling files from ThingySDKv2.1 which are needed. Am I overlooking something? Would anyone know a fix or the correct way to compile the demo with cmake?

Thank You,

Takunda

  • Would anyone know a fix

    You haven't said what errors you're getting - so impossible to say how to fix them!

    using SES to compile it, which works fine

    SES shows you all of the commands it uses to do its build - so compare that against what your CMake build is doing ...

  • I am getting different errors at different stages. for example with the unchanged code after running cmake and then make I get the following:

    Scanning dependencies of target uECC_nrf52832_xxAA
    [  0%] Building C object external/micro-ecc/CMakeFiles/uECC_nrf52832_xxAA.dir/uECC.c.obj
    [ 14%] Linking C static library libuECC_nrf52832_xxAA.a
    [ 14%] Built target uECC_nrf52832_xxAA
    Scanning dependencies of target rtt_nrf52832_xxAA
    [ 14%] Building C object external/rtt/CMakeFiles/rtt_nrf52832_xxAA.dir/src/SEGGER_RTT.c.obj
    [ 14%] Building C object external/rtt/CMakeFiles/rtt_nrf52832_xxAA.dir/src/SEGGER_RTT_printf.c.obj
    [ 14%] Linking C static library librtt_nrf52832_xxAA.a
    [ 14%] Built target rtt_nrf52832_xxAA
    Scanning dependencies of target mesh-provisioning-demo
    [ 14%] Building C object examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/src/main.c.obj
    /home/takunda/Mesh SDK v2.2.0/examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/src/main.c:42:10: fatal error: generic_on_off_server.h: No such file or directory
     #include "generic_on_off_server.h"
              ^~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/build.make:62: recipe for target 'examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/src/main.c.obj' failed
    make[3]: *** [examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/src/main.c.obj] Error 1
    CMakeFiles/Makefile2:1359: recipe for target 'examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/all' failed
    make[2]: *** [examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/all] Error 2
    CMakeFiles/Makefile2:1371: recipe for target 'examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/rule' failed
    make[1]: *** [examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh-provisioning-demo.dir/rule] Error 2
    Makefile:300: recipe for target 'mesh-provisioning-demo' failed
    make: *** [mesh-provisioning-demo] Error 2
    

    SES has no dependancies on the cmake as it already came with its project and session files in the demo. It shows the way it compiles the files yes, but does not help me understand why my cmake  is not doing the same. For example, upon fixing header file issues or adding the missing files, I run into linking errors as below:

    [100%] Linking C executable mesh_provisioning_demo.elf
    CMakeFiles/mesh_provisioning_demo.dir/src/main.c.obj: In function `board_init':
    /home/takunda/Mesh SDK v2.2.0/examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/src/main.c:556: undefined reference to `support_func_configure_io_startup'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_ext_light.c.obj: In function `m_ioext_led_drv_ctrl':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_ext_light.c:541: undefined reference to `sx150x_led_drv_calc_fade_supp'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_ext_light.c.obj: In function `m_ioext_cmd_process':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_ext_light.c:696: undefined reference to `sx150x_led_drv_calc_convert'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_ext_light.c.obj: In function `drv_ext_light_init':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_ext_light.c:994: undefined reference to `sx150x_led_drv_calc_init'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_sx1509.c.obj: In function `reg_set':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:166: undefined reference to `nrf_drv_twi_tx'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_sx1509.c.obj: In function `reg_get':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:180: undefined reference to `nrf_drv_twi_tx'
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:181: undefined reference to `nrf_drv_twi_rx'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_sx1509.c.obj: In function `multi_byte_register_set':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:240: undefined reference to `nrf_drv_twi_tx'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_sx1509.c.obj: In function `drv_sx1509_open':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:267: undefined reference to `twi_manager_request'
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:269: undefined reference to `nrf_drv_twi_enable'
    CMakeFiles/mesh_provisioning_demo.dir/__/__/__/external/ThingySDKv2.1/source/drivers/drv_sx1509.c.obj: In function `drv_sx1509_close':
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:1232: undefined reference to `nrf_drv_twi_disable'
    /home/takunda/Mesh SDK v2.2.0/external/ThingySDKv2.1/source/drivers/drv_sx1509.c:1233: undefined reference to `nrf_drv_twi_uninit'
    collect2: error: ld returned 1 exit status
    examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh_provisioning_demo.dir/build.make:1607: recipe for target 'examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/mesh_provisioning_demo.elf' failed
    make[3]: *** [examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/mesh_provisioning_demo.elf] Error 1
    CMakeFiles/Makefile2:1361: recipe for target 'examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh_provisioning_demo.dir/all' failed
    make[2]: *** [examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh_provisioning_demo.dir/all] Error 2
    CMakeFiles/Makefile2:1373: recipe for target 'examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh_provisioning_demo.dir/rule' failed
    make[1]: *** [examples/light_switch/thingy_provisioning_demo_generic_OnOff_BLINK/CMakeFiles/mesh_provisioning_demo.dir/rule] Error 2
    Makefile:300: recipe for target 'mesh_provisioning_demo' failed
    make: *** [mesh_provisioning_demo] Error 2
    

    The CMakelists does not seem to locate any of the files found in the ThingySDKv2.1

  • Update:

    Without making changes to any of the source .c or .h files, I modified the CMakeLists.txt file for the thingy52-provisioning-demo to include the correct generic_on_off model (CMakeLists.txt currently tries to use Simple_on_off_model), as well as the missing source codes and include files. But when I flash just the application to the thingy52 DK, it does not boot. The same occurs when I flash the Softdevice and Application. The same result with the Softdevice, Application and Bootloader. (Softdevice and bootloader nrf52 v6.0.0 from the bin folder).

    Did I skip any steps? What could be the reason my DK does not boot as it does when I flash it through SES?

    PS* I have tried both the armcc and the gccarmemb Bootloaders But I do not think they are necessary as the SES project does not flash a bootloader to the DK.

  • Hi, 

    The CMakeLists.txt was there by mistake. It's from the light switch example that we cloned from. We will remove the file.

    But I don't see any reason it wouldn't work with Cmake as long as you follow what we have in the SES project closely. 

  • That makes a lot of sense. I was wondering why I needed so many modifications to the CMakeLists.txt. Thanks for the reply.

Related