Saving build configuration in a sysbuild project

Hello,

Sorry for the many tickets the past few days, but I am ramping up to start a nRF Connect SDK project on a nRF91 modem and have encountered some initial growing pains (And other bugs). Hopefully this will be my last one for a while since this is my remaining hurdle for starting a new project. I am new to Zephyr and the NRF Connect SDK.

  • OS: Windows 11
  • SDK/Toolchain: 2.9.0

From my understanding, it is not possible to save a build configuration in the nRF Connect VS Code extension per this guide: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/build_config.html#how-to-save-a-build-configuration-as-a-preset

From the guide "Sysbuild configurations cannot be saved as presets".

There are a bunch of configuration options in the build configuration wizard. If there is no way to save this when sharing a project via version control, it is prone to user error of selecting the wrong configuration items, resulting in the application building differently for different developers, which obviously is not good.

I am looking for a workaround for this.

Question:  Since the nRF Connect extension cannot save the build configuration for sysbuild projects, what CLI commands can I use to generate the build configuration automatically with my predefined board that the nRF Connect VS Code extension will then "see" when I edit the build configuration?

As a test, I captured the output when creating a build configuration using the nRF Connect extension. The only selection I made was to set the board to 'nrf9161dk/nrf9161/ns':

Building application
C:\Windows\system32\cmd.e x e /d /s /c "west build --build-dir c:/ncs_workspace/test_app/application/build c:/ncs_workspace/test_app/application --pristine --board nrf9161dk/nrf9161/ns --cmake-only -- -DNCS_TOOLCHAIN_VERSION=NONE"

-- west build: generating a build system ...

Please note that I had to space out the text cmd."e x e" in the above command because otherwise the Devzone would return the error "Could not create ticket" when trying to post it.

From the above, I created the following batch script and added the command above:

@echo off
set BOARD_NAME=nrf9161dk/nrf9161/ns
set BUILD_DIR=application/build
set APP_DIR=application

REM Clean existing build directory
if exist %BUILD_DIR% (
    echo Cleaning existing build directory...
    rmdir /s /q %BUILD_DIR%
)

REM Generate build configuration
echo Creating build configuration for board: %BOARD_NAME%
west build --build-dir %BUILD_DIR% %APP_DIR% --pristine --board %BOARD_NAME% --cmake-only -- -DNCS_TOOLCHAIN_VERSION=NONE

REM Check if build succeeded
if %ERRORLEVEL%==0 (
    echo Build configuration succeeded!
) else (
    echo Build configuration failed.
    exit /b 1
)

I run this in the nRF Connect terminal within VS Code. The build configuration succeeds with the following output:

PS C:\ncs_workspace\test_app>
PS C:\ncs_workspace\test_app> .\build_config.bat
Creating build configuration for board: nrf9161dk/nrf9161/ns
-- west build: generating a build system
Loading Zephyr module(s) (Zephyr base): sysbuild_default
-- Found Python3: C:/ncs/toolchains/b620d30767/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: C:/ncs_workspace/test_app/external/zephyr/.cache
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: nrf9161dk, Revision: 0.9.0, qualifiers: nrf9161/ns
Parsing C:/ncs_workspace/test_app/external/zephyr/share/sysbuild/Kconfig
Loaded configuration 'C:/ncs_workspace/test_app/application/build/_sysbuild/empty.conf'
Merged configuration 'C:/ncs_workspace/test_app/application/build/_sysbuild/empty.conf'
Merged configuration 'C:/ncs_workspace/test_app/application/build/_sysbuild/empty.conf'
Configuration saved to 'C:/ncs_workspace/test_app/application/build/zephyr/.config'
Kconfig header saved to 'C:/ncs_workspace/test_app/application/build/_sysbuild/autoconf.h'
-- 
   *********************************
   * Running CMake for application *
   *********************************

Loading Zephyr default modules (Zephyr base).
-- Application: C:/ncs_workspace/test_app/application
-- CMake version: 3.21.0
-- Found Python3: C:/ncs/toolchains/b620d30767/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: C:/ncs_workspace/test_app/external/zephyr/.cache
-- Zephyr version: 3.7.99 (C:/ncs_workspace/test_app/external/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: nrf9161dk, Revision: 0.9.0, qualifiers: nrf9161/ns
-- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/b620d30767/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/b620d30767/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/b620d30767/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs_workspace/test_app/external/zephyr/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns.dts       
-- Generated zephyr.dts: C:/ncs_workspace/test_app/application/build/application/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/ncs_workspace/test_app/application/build/application/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: C:/ncs_workspace/test_app/application/build/application/zephyr/dts.cmake

warning: Deprecated symbol NET_SOCKETS_POSIX_NAMES is enabled.

Parsing C:/ncs_workspace/test_app/external/zephyr/Kconfig
Loaded configuration 'C:/ncs_workspace/test_app/external/zephyr/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig'
Merged configuration 'C:/ncs_workspace/test_app/application/prj.conf'
Merged configuration 'C:/ncs_workspace/test_app/application/build/application/zephyr/.config.sysbuild'
Configuration saved to 'C:/ncs_workspace/test_app/application/build/application/zephyr/.config'
Kconfig header saved to 'C:/ncs_workspace/test_app/application/build/application/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
=========== Generating psa_crypto_config ===============
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Backup: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
Backup: CONFIG_MBEDTLS_THREADING: False
Backup: CONFIG_MBEDTLS_THREADING_ALT: False
=========== Checkpoint: backup ===============
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Restore: CONFIG_MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT: False
Restore: CONFIG_MBEDTLS_THREADING: False
Restore: CONFIG_MBEDTLS_THREADING_ALT: False
=========== End psa_crypto_config ===============
=========== Generating psa_crypto_library_config ===============
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Backup: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Backup: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
Backup: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
Backup: CONFIG_MBEDTLS_THREADING: False
Backup: CONFIG_MBEDTLS_THREADING_ALT: False
=========== Checkpoint: backup ===============
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_C: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER: False
Restore: CONFIG_MBEDTLS_PSA_CRYPTO_SPM: False
Restore: CONFIG_MBEDTLS_USE_PSA_CRYPTO: True
Restore: CONFIG_MBEDTLS_PLATFORM_PRINTF_ALT: False
Restore: CONFIG_MBEDTLS_THREADING: False
Restore: CONFIG_MBEDTLS_THREADING_ALT: False
=========== End psa_crypto_library_config ===============
-- Setting build type to 'MinSizeRel' as none was specified.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ncs_workspace/test_app/application/build/application
Dropping partition 'nrf_modem_lib_trace' since its size is 0.
Dropping partition 'nonsecure_storage' since it is empty.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ncs_workspace/test_app/application/build
Build configuration succeeded!
PS C:\ncs_workspace\test_app>

I can see the build configuration in VS Code, yay!:

However, when I attempt to edit the build configuration with VS Code, I see the following (The board is incorrect):

Any idea why the configurator doesn't display the correct board and shows the yellow text warning? Any suggestions on how I can achieve my goal?

Thanks,

Derek

Parents Reply
  • Hi Derek,

    droberson said:
    Is there somewhere I can submit a feature request and/or escalate this?

    I have asked internally about this issue. Unfortunately, there is nothing you can do at the moment but wait. Additionally, I cannot provide any timeline for when the issue might get resolved, but please note that I have made relevant team aware of the issue.

    Best regards,
    Dejan

Children
Related