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

How can the code "create_hex" work in bootloader's cmakelists?

From the cmakelists of bootloader in Meshv320src, I found the code "create_hex" but this code cannot found in CMake's document. How can it work to generate the hex file?

Parents Reply Children
  • I have read this document, but it does not talk about the command used IN cmakelists. For common cmake, create_hex is illegal and cannot work.

    Moreover, when I want to compile, it shows:

    CMAKE ERROR at CMakelists.txt: 85(set_target_link_option)

       Unknown CMake command "set_target_link_option".

    The path of this CMakelists is \nrf5_SDK_for_Mesh_v3.2.0_src\mesh\bootloader\CMakelists.txt

    Could you please give me the correct file? The current file cannot work

  • Hi,

    Both the functions you are mentioning can be found in CMake/toolchain/gccarmemb.cmake. 

    You should try delete the build folder and try building again. Also make sure that you have the correct toolchain installed.

  • Hi:

    Thank you for your response. I think I made a mistake that I only do cmake in the bootloader folder

    I read the Installing the toolchain again and install Doxygen,Graphviz,Mscgen. This time I do cmake in folder : nrf5_SDK_for_Mesh_v3.0.0_src and follow the step in  Installing the toolchain and Building the mesh stack and examples. I put the nrf5_SDK_for _Mesh and nRF5_SDK_15.2.0_9412b96 in the same folder. This time I still use the original nRF5_SDK and nrf5_SDK_for _Mesh files to test.

    However, I input the command: 

    build$ cmake -G Ninja ..

      and then got the result in the following screenshot:

    I did not see the warning that the nRF5 SDK is not found and when I use the command 

    build$ ninja nRF5_SDK

    I got the following response:

    ninja: error: unknown  target 'nRF5_SDK'

    I thought it may be not important because I had put nRF5_SDK_15.2.0_9412b96 in the correct path and I continued to work. Then I used the command shown in Building the mesh stack and examples and specify the required TOOLCHAIN, PLATFORM, SOFTDEVICE and BOARD name to CMake. I also set the CMAKE_BUILD_TYPE as MinSizeRel.

    After that, I input the command:

    build$ ninja

    then it failed. The only thing I got is the empty folders inside /build/ .

    What's wrong with my step? 

  • It seems correct what you have done. Can you try downloading a fresh copy of the nRF5 SDK and try again?

  • Thank you for your answer. I have found the mistake. I forgot to change the bootloader_build from OFF to ON in cmakecache.txt. Now I successfully generate the hex file for bootloader.