thingy53 board target re-runs cmake twice when nrf5340dk does not

When building examples targeting the thingy53/nrf5340/cpuapp board target cmake is run twice, on a fresh build. Then once the build is finished, without modifying anything if west build or west flash is ran, the entire build system is rebuilt. Example:

ubuntu@zephyr:~/zephyr-projects/ncs/zephyr/samples/basic/blinky$ west build -b thingy53/nrf5340/cpuapp | tee thingy53-build.log

-- west build: generating a build system
-- Found Python3: /usr/bin/python3 (found suitable version "3.12.3", minimum required is "3.10") found components: Interpreter 
-- Cache files will be written to: /home/ubuntu/.cache/zephyr
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: thingy53, qualifiers: nrf5340/cpuapp
Parsing /home/ubuntu/zephyr-projects/ncs/zephyr/share/sysbuild/Kconfig
Loaded configuration '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild/empty.conf'
Merged configuration '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild/empty.conf'
Configuration saved to '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
Kconfig header saved to '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild/autoconf.h'

.....

Partition 'mcuboot' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_pad' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_primary' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_primary_app' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_primary_1' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_secondary' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_secondary_1' is not included in the dynamic resolving since it is statically defined.
Partition 'pcd_sram' is not included in the dynamic resolving since it is statically defined.
-- Configuring done (40.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build
-- west build: building application
[0/47] Generating signing key
[20/47] No configure step for 'empty_net_core'
[21/47] Performing build step for 'empty_net_core'
[1/145] Preparing syscall dependency handling
[2/145] Generating ../../zephyr/include/generated/ncs_version.h
[3/145] Generating ../../zephyr/include/generated/ncs_commit.h
[4/145] Generating ../../zephyr/include/generated/zephyr_commit.h
[5/145] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.1.99 (/home/ubuntu/zephyr-projects/ncs/zephyr), build: ncs-v3.1.1

.....

[141/145] Generating linker.cmd
[142/145] Generating isr_tables.c, isr_tables_vt.ld, isr_tables_swi.ld
[143/145] Building C object zephyr/CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj
[144/145] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
[145/145] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       19436 B      34176 B     56.87%
             RAM:        3464 B        64 KB      5.29%
           SRAM1:          0 GB        64 KB      0.00%
        IDT_LIST:          0 GB        32 KB      0.00%
Generating files from /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/b0n/zephyr/zephyr.elf for board: thingy53
[25/47] cd /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild && /usr/bin/cmake -E true
[26/47] Performing build step for 'blinky'
[0/1] Re-running CMake...
-- Application: /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky
-- CMake version: 3.28.3
-- Cache files will be written to: /home/ubuntu/.cache/zephyr
-- Zephyr version: 4.1.99 (/home/ubuntu/zephyr-projects/ncs/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: thingy53, qualifiers: nrf5340/cpuapp
-- Found host-tools: zephyr 0.17.0 (/home/ubuntu/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/home/ubuntu/zephyr-sdk-0.17.0)

.....

-- Configuring done (6.0s)
-- Generating done (0.1s)
-- Build files have been written to: /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/blinky
[1/184] Preparing syscall dependency handling

[2/184] Generating ../../zephyr/include/generated/ncs_version.h
[3/184] Generating ../../zephyr/include/generated/ncs_commit.h
[4/184] Generating ../../zephyr/include/generated/zephyr_commit.h
[5/184] Generating include/generated/zephyr/version.h

.....

[181/184] Building C object zephyr/CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj
[182/184] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
[183/184] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       47780 B     916992 B      5.21%
             RAM:       16912 B       440 KB      3.75%
        IDT_LIST:          0 GB        32 KB      0.00%
Generating files from /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/blinky/zephyr/zephyr.elf for board: thingy53
image.py: sign the payload
image.py: sign the payload
[30/47] Generating ../b0n_container.hex
[31/47] Performing build step for 'mcuboot'
[1/326] Preparing syscall dependency handling
[2/326] Generating ../../zephyr/include/generated/ncs_version.h
[3/326] Generating ../../zephyr/include/generated/ncs_commit.h
[4/326] Generating ../../zephyr/include/generated/app_commit.h

.....

[325/326] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
[326/326] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       64668 B        64 KB     98.68%
             RAM:      364864 B       440 KB     80.98%
        IDT_LIST:          0 GB        32 KB      0.00%
Generating files from /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/mcuboot/zephyr/zephyr.elf for board: thingy53
[34/47] cd /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild && /usr/bin/cmake -E true
[35/47] Creating signature of application
[38/47] cd /home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild && /usr/bin/cmake -E true
[39/47] Creating public key from private key used for signing
[40/47] Generating ../merged.hex
[41/47] Creating validation for zephyr.hex, storing to signed_by_b0_empty_net_core.hex
[42/47] Creating data to be provisioned to the Bootloader, storing to net_provision.hex
[44/47] Generating ../merged_CPUNET.hex
[45/47] Generating ../signed_by_mcuboot_and_b0_empty_net_core.hex
image.py: sign the payload
[46/47] Generating ../signed_by_mcuboot_and_b0_empty_net_core.bin
image.py: sign the payload
[47/47] Generating ../dfu_application.zip

ubuntu@zephyr:~/zephyr-projects/ncs/zephyr/samples/basic/blinky$ west build
[0/1] Re-running CMake...
Loading Zephyr module(s) (Zephyr base (cached)): sysbuild_default
-- Cache files will be written to: /home/ubuntu/.cache/zephyr
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: thingy53, qualifiers: nrf5340/cpuapp
Parsing /home/ubuntu/zephyr-projects/ncs/zephyr/share/sysbuild/Kconfig
Loaded configuration '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
No change to configuration in '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
No change to Kconfig header in '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild/autoconf.h'

When building for target nrf5340dk/nrf5340/cpuapp, cmake is not re-ran. and running west build results in nothing being rebuilt.

Looking a bit more into it, it looks like this config is related to the re-running build in zephyr/boards/nordic/thingy53/Kconfig.sysbuild

choice BOOTLOADER
	default BOOTLOADER_MCUBOOT
endchoice

I believe something related to mcuboot/sysbuild is modifying the build on-the-fly and causing cmake to detect and re-run.

Does the Nordic team have any idea on what configuration option present in thingy53 is causing this?

My board def is based on thingy53 and after running the above build command, even without pristine, the next run of west build or west flash causes the entire build to be re-ran.

Parents
  • Hi Anthony,

    For Thingy:53, sysbuild is always used and enabled by default.
    => it builds and therefore runs the Cmake file for each image
    => once for application image and once for MCUboot (also once for the network core image if you use it but it's set to empty_net_core by default)

    Please refer to DevAcademy lesson on sysbuild Sysbuild explained - Nordic Developer Academy
    and this documentation Sysbuild (System build)

    Also, if this below is what you meant by "the entire build system is rebuilt", these are just minimal checks to see if anything changed.

    ubuntu@zephyr:~/zephyr-projects/ncs/zephyr/samples/basic/blinky$ west build
    [0/1] Re-running CMake...
    Loading Zephyr module(s) (Zephyr base (cached)): sysbuild_default
    -- Cache files will be written to: /home/ubuntu/.cache/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: thingy53, qualifiers: nrf5340/cpuapp
    Parsing /home/ubuntu/zephyr-projects/ncs/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
    No change to configuration in '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
    No change to Kconfig header in '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild/autoconf.h'

Reply
  • Hi Anthony,

    For Thingy:53, sysbuild is always used and enabled by default.
    => it builds and therefore runs the Cmake file for each image
    => once for application image and once for MCUboot (also once for the network core image if you use it but it's set to empty_net_core by default)

    Please refer to DevAcademy lesson on sysbuild Sysbuild explained - Nordic Developer Academy
    and this documentation Sysbuild (System build)

    Also, if this below is what you meant by "the entire build system is rebuilt", these are just minimal checks to see if anything changed.

    ubuntu@zephyr:~/zephyr-projects/ncs/zephyr/samples/basic/blinky$ west build
    [0/1] Re-running CMake...
    Loading Zephyr module(s) (Zephyr base (cached)): sysbuild_default
    -- Cache files will be written to: /home/ubuntu/.cache/zephyr
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: thingy53, qualifiers: nrf5340/cpuapp
    Parsing /home/ubuntu/zephyr-projects/ncs/zephyr/share/sysbuild/Kconfig
    Loaded configuration '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
    No change to configuration in '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/zephyr/.config'
    No change to Kconfig header in '/home/ubuntu/zephyr-projects/ncs/zephyr/samples/basic/blinky/build/_sysbuild/autoconf.h'

Children
No Data
Related