Issue with Enabling MCUboot on Custom Board with nRF5340

Hello,

I am working on a custom Agora board that includes a BT40 module with an nRF5340 MCU. I am trying to enable the MCUboot bootloader by setting CONFIG_BOOTLOADER_MCUBOOT=y in my prj.conf file. However, I encounter an error during the initial configuration stage.

Here are the details of my setup:

  • Custom Agora board with BT40 module
  • nRF5340 MCU
  • Using Nordic SDK version 2.7.0
  • The bootloader demo works on the nRF52840 development board using the Nordic course

Error Message:

...depends again on SOC_FAMILY_NRF (defined at C:/ncs/v2.7.0/modules/soc-hwmv1/soc/arm\nordic_nrf\Kconfig:9)
CMake Error at C:/ncs/v2.7.0/zephyr/cmake/modules/kconfig.cmake:392 (message):
command failed with return code: 1
Call Stack (most recent call first):
C:/ncs/v2.7.0/nrf/cmake/modules/kconfig.cmake:29 (include)
C:/ncs/v2.7.0/zephyr/cmake/modules/zephyr_default.cmake:132 (include)
C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
CMakeLists.txt:12 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/YASHAWS/Agora/xyleminc-wwno-gnode-009afda753b5/build_4/mcuboot/CMakeFiles/CMakeOutput.log".
See also "C:/Users/YASHAWS/Agora/xyleminc-wwno-gnode-009afda753b5/build_4/mcuboot/CMakeFiles/CMakeError.log".
CMake Error at C:/ncs/v2.7.0/nrf/cmake/multi_image.cmake:502 (message):
CMake generation for mcuboot failed, aborting. Command: 1
Call Stack (most recent call first):
C:/ncs/v2.7.0/nrf/cmake/multi_image.cmake:178 (add_child_image_from_source)
C:/ncs/v2.7.0/nrf/modules/mcuboot/CMakeLists.txt:328 (add_child_image)


-- Configuring incomplete, errors occurred!
See also "C:/Users/YASHAWS/Agora/xyleminc-wwno-gnode-009afda753b5/build_4/CMakeFiles/CMakeOutput.log".
See also "C:/Users/YASHAWS/Agora/xyleminc-wwno-gnode-009afda753b5/build_4/CMakeFiles/CMakeError.log".
FAILED: build.ninja
C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe --regenerate-during-build -SC:\Users\YASHAWS\Agora\xyleminc-wwno-gnode-009afda753b5 -BC:\Users\YASHAWS\Agora\xyleminc-wwno-gnode-009afda753b5\build_4
ninja: error: rebuilding 'build.ninja': subcommand failed
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.EXE' --build 'c:\Users\YASHAWS\Agora\xyleminc-wwno-gnode-009afda753b5\build_4'

* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

Could anyone provide guidance on how to resolve this issue or suggest additional configurations that might be required for the nRF5340 MCU on a custom board?

Thank you!

Parents
  • Hi,

    I amo not able to see exactly what the error is, but it the path is long which can cause problems on windows. I sit possible to rename and move things so that you make "C:/Users/YASHAWS/Agora/xyleminc-wwno-gnode-009afda753b5" much shorter? Do you still see the same error after that?

  • Hi,

    Thank for the suggestion. I'll try to shorten the path.

    But the Error is -FAILED: build.ninja
    C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe --regenerate-during-build -SC:\Users\YASHAWS\Agora\xyleminc-wwno-gnode-009afda753b5 -BC:\Users\YASHAWS\Agora\xyleminc-wwno-gnode-009afda753b5\build_4
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.EXE' --build 'c:\Users\YASHAWS\Agora\xyleminc-wwno-gnode-009afda753b5\build_4'

    This is the main issue is facing and after enabling the CONFIG_BOOTLOADER_MCUBOOT=y on prj.conf file.

  • Hi,

    I checked by making shorten the path still the error is same.

    I have shared file down below. error message.

    NOTE: after enabling the 

    CONFIG_BOOTLOADER_MCUBOOT=y in prj.conf file that time facing this error otherwise it builds with no erros.

    Could please provide any suggestions to address this issue,

    Thank you.

Reply Children
  • Hi,

    Thank you. Here we see the error: "No fprotect backend selected.". The booltoader needs a mecahnism to lock the flash from being written to by the application, and different SoC's have different mechanisms for it, and if none of the mechanisms are enabled, you will get this printed here. This normally comes from the DeviceTree and is handled at the SoC level, so it should just work. I have seen one other instance though, which is discussed here, where the custom board was erronously based on the wrong starting point, mixing secure and non-secure, so that the nrf-spu was not present in the device tree (there will be other issues as well). Is that the case here as well?

  • Thank you for your input. It seems that the issue might be related to the DeviceTree configuration, particularly with the nrf-spu settings. Could you please provide if the nrf-spu is correctly defined and configured in the DeviceTree? How do we know that.

    Thank you

  • Hi,

    I do not see your device tree or board files, but the recomendation here is to copy the DK files and modify what you need. Remember to copy the _ns files if you are making an _ns board, and the secure (non _ns) files if that is appropriate.

  • Hi,

    Even after modifying the dts file from the nrf5340dk into customized agora_bt40 dts, continue to encounter the same error.

    After enabling the mcuboot on prj.conf it through error, otherwise builds without error.

  • Hi,

    The error point to missing SPU configuration in the board as disussed before, so it seems MCU boot is built for non-secure or that the secure board configuration is incorrect, and does not contain the SPU (which it must). The nRF5340 is quite complex, so to avoid this the simplest is to copy all of the nRF5340 board files, and modify as needed for your custom HW. Note that you need both secure and non-secure board files as MCUboot will always be built as secure even if the application is non-secure.

    If you have not made any progress, can you share your board files as well as full build log (so that I see how you build the project as well as any errors)?

Related