Including a bootloader with an application

I want to include a dfu bootloader with an application.  I read here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev/bootloaders_and_dfu/bootloader_adding.htmlthat I should include "CONFIG_SECURE_BOOT=y" in the prj.conf file. However when I do I get this most enigmatic error message: "FATAL ERROR: command exited with status 1: 'c:\ncs\toolchains\v2.3.0\opt\bin\cmake.EXE' --build 'c:\Nordic\MyApps\blinky\build'" at build time.

If I remove the "CONFIG_SECURE_BOOT=y" from the prj.conf file, the application builds normally,

Regards,

Jerry

  • More confusing information;

    I built the Lesson 3 sample project from your BLE course; I built and executed fine.  I then added the two bootloader statements as above; the build failed. I removed the two bootloader statements and, surprisingly, it built and executed fine. This result differs from that above.

    Regards,

    Jerry 

  • Hi,

    Jerry Easley said:
    Builds for both boards fail, Further, if I then remove the two bootloader statements, both boards STILL fail on build.

    To resolve this, you could consider removing build folder completely and performing pristine build.


    I think the easiest way to start might be to try building Zephyr hello_world sample with 2 previously mentioned configuration options added to the prj.conf file.

    Best regards,
    Dejan

  • Hi Dejan,

    Here is what I did:

    In the past my code was at "c:\Nordic\MyApps"

    I created a new directory, "C:\Nordic\MUC_BootLoader_Pristine"

    I Opened this folder in VSCODE.

    I used the welcome screen to set the SDK and ToolChain version to 2.4.0

    I created a new project, "Hello World" using the sdk template.

    I created a build configuration for the nRF52840-dongle.

    I did a pristine build; It completed successfully.

    To the prj.conf file I added the two statements following:

    CONFIG_SECURE_BOOT=y
    CONFIG_BOOTLOADER_MCUBOOT=y

    I did a pristine build; it failed. The error messages follow:

    -- Build files have been written to: C:/Nordic/MUC_BootLoader_Pristine/hello_world/build_dongle/mcuboot
    === child image mcuboot - end ===

    CMake Warning at C:/ncs/v2.4.0/nrf/modules/mcuboot/CMakeLists.txt:310 (message):

    ---------------------------------------------------------
    --- WARNING: Using default MCUBoot key, it should not ---
    --- be used for production. ---
    ---------------------------------------------------------

    CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
    No SOURCES given to Zephyr library: lib__libc__common

    Excluding target from build.


    Traceback (most recent call last):
    File "C:/ncs/v2.4.0/nrf/scripts/partition_manager.py", line 1993, in <module>
    main()
    File "C:/ncs/v2.4.0/nrf/scripts/partition_manager.py", line 1028, in main
    solution.update(solve_region(pm_config, region, region_config,
    File "C:/ncs/v2.4.0/nrf/scripts/partition_manager.py", line 971, in solve_region
    get_region_config(partitions, region_config, static_partitions, system_reqs=pm_config)
    File "C:/ncs/v2.4.0/nrf/scripts/partition_manager.py", line 758, in get_region_config
    solve_complex_region(pm_config, start, size, placement_strategy, region_name, device, static_conf, dp, system_reqs)
    File "C:/ncs/v2.4.0/nrf/scripts/partition_manager.py", line 865, in solve_complex_region
    solution, sub_partitions = resolve(pm_config, dp, system_reqs)
    File "C:/ncs/v2.4.0/nrf/scripts/partition_manager.py", line 308, in resolve
    solve_direction(reqs, sub_partitions, unsolved, solution, 'after')
    File "C:/ncs/v2.4.0/nrf/scripts/partition_manager.py", line 198, in solve_direction

    If this is not what you were suggesting I do, just let me know.

    Regards,
    Jerry

  • Hi,

    If you use nrf52840-dk instead of nrf52840dongle, you should not get errors while building.

    As for the dongle, you can read more from the documentation - nrf52840 dongleprogramming and debugging the dongle and nrf52840 dongle user guide, Additionally, you could also have a look at nrf52840 dongle programming tutorial.

    Best regards,
    Dejan

  • Hi Dejan,

    You are correct, a build for a nRF52840-dk does indeed build without incident.  However, I'm a little flummoxed; what has that got to do with my problem?

    I appreciate the links you provided to the documentation, one particular piece of which describes what I am trying to do; the URL is: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/boards/arm/nrf52840dongle_nrf52840/doc/index.html.   A salient part of which I paste below:

    "This board supports building other Zephyr applications for flashing with MCUboot in this way also. Just make sure CONFIG_BOOTLOADER_MCUBOOT is set when building your application. For example, to compile blinky for loading by MCUboot, use this:

    west build -b nrf52840dongle_nrf52840 -d build/blinky zephyr/samples/basic/blinky -- -DCONFIG_BOOTLOADER_MCUBOOT=y
    

    You can then sign and flash it using the steps above."

    From the above I see that no CONFIG_SECURE_BOOTLOADER statement is required in the prjj.conf file, so I removed it and tried to rebuild the application; it failed just like all the others.

    Everything I am attempting to do is consistent with your documentation; There is a problem with this build process.  Now that we have isolated the problem and you can reproduce it, maybe it's time to escalate it to the team(s) that support the toolchain/SDK.

Related