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:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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).
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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