nRF Connect SDK child image per-board configuration discards associated prj.conf in 2.6.1

When building a project using a custom board, as well as both the b0 and mcuboot bootloaders enabled, board-specific child image configuration causes the build system to ignore the project-specific configuration.

I'm using the following directory structure:

<wk> - Workspace directory
<wk>/<prj> - Project directory
<wk>/<prj>/prj.conf - Core project configuration
<wk>/<prj>/build - Builds
<wk>/<prj>/boards - Boards
<wk>/<prj>/boards/arm/<example>/ - a copy of the nrf5340dk configuration, renamed to something other than nrf5340dk to test if the build system handles custom boards differently than in-tree boards
<wk>/<prj>/child_image/b0/boards/<example>_cpuapp.conf

core project configuration includes the following:

CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_SECURE_BOOT=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

The file <wk>/<prj>/child_image/b0/boards/<example>_cpuapp.conf must contain the contents of <wk>/nrf/samples/bootloader/prj.conf and <wk>/nrf/samples/bootloader/boards/nrf5340dk_nrf5340_cpuapp.conf or it will fail to build.

This relates to https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/nrf/config_and_build/multi_image.html#permanent_configuration_changes_to_child_images

and  Compile ERROR "undefined reference to `sys_clock_cycle_get_32'" with custom board

  • Hello,

    When the board specific configuration is added, you also need to include the prj.conf (copy of the nrf/samples/bootloader/prj.conf) for the child-image:

    child_image/
    ├── b0
    │   ├── boards
    │   │   └── <example>_cpuapp.conf
    │   └── prj.conf
    ├── mcuboot.conf
    └── mcuboot.overlay

    Best regards,

    Vidar

  • While that sounds like it should fix it, I don't see the new file being picked up on a clean build:

    === child image b0 -  begin ===

    ...

    Parsing <wk>/zephyr/Kconfig
    Loaded configuration '<wk>/<prj>/boards/arm/<example>/<example>_cpuapp_defconfig'
    Merged configuration '<wk>/<prj>/child_image/b0/boards/<example>_cpuapp.conf'
    Merged configuration '<wk>/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration '<wk>/<prj>/build_mb/b0/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '<wk>/<prj>/build_mb/b0/zephyr/.config'

    ...

    === child image b0 -  end ===

    I should see a line in there that reads
    Merged configuration '<wk>/<prj>/child_image/b0/prj.conf'

  • It should not be necessary, but could you please also try deleting the build folder when you do a clean build? I was not able to reproduce the issue here. As you say, the build log should show that the prj.conf got merged.

    Here is the project I tested with:

    peripheral_lbs_w_dfu.zip

  • Cleaning the build folder, rebooting vscode, and combining the two do not address this. 

    I've been trying to rule out other causes.  I'm currently using 2.6.1 build tools and my west workspace is dependent on 2.6.1.  I'm attempting to build via vscode.

    Are any of these different in your workspace?

    I would be surprised, but the dts files you sent list compatibility with the nrf5340dk.  Is it possible this line suppresses something?

  • I'm also using VS Code, and I was building the project with SDK version 2.6.1. And to be sure, I also tried changing the compatible property in *.dts to "nordic,custom-nrf5340-cpuapp"; but it didn't seem to make any difference.

    From the build log for b0:

    Merged configuration '<project>/child_image/b0/prj.conf'
    Merged configuration '<project>/child_image/b0/boards/custom_nrf5340_cpuapp.conf'

    Did you try building the sample I uploaded as well? 

Related