Configuration error with setting SOC_NRF52840=y in west standalone, works in vscode

I can build my project fine with the vscode extension, but when I copy the `west build ...` command from vscode and run it from CLI, i get an error about how the SOC option isn't directly configurable:

```
~/my-workspace> west build --build-dir /home/k/proj/nrf_tab/rev5_build_tmp2 /home/k/proj/nrf_tab --pristine --board rev5 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=/home/k/proj/nrf_tab -DCACHED_CONF_FILE=/home/k/proj/nrf_tab/prj.conf -DDTC_OVERLAY_FILE=/home/k/proj/nrf_tab/app.overlay
> -- west build: making build dir /home/k/proj/nrf_tab/rev5_build_tmp2 pristine
> ...
> ...
> error: SOC_NRF52840 (defined at soc/nordic/nrf52/Kconfig.soc:35, soc/nordic/nrf52/Kconfig:27) is
> assigned in a configuration file, but is not directly user-configurable (has no prompt). It gets its
> value indirectly from other symbols.
```
full output: https://pastebin.com/38f9Tn2M

This stems from the inclusion of
```
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QFAA=y
```
in the `prj.conf` or `_defconfig`, which are required for nordic features like RTT, ie. `CONFIG_USE_SEGGER_RTT=y` seems to depend on setting the SOC series like I did. Am I doing this wrong? Why does this work in vscode but not here?
Full output from a successful build using vscode: https://pastebin.com/DY1TYcQR

More info about my configuration:
`rev5` is the name for that board layout. Since i have to develop for multiple revisions of this board with different pin layout assignments I use `rev5`, `rev6`, etc. for the different revisions of the PCB which use different pin layouts and have different features, though so far each `rev` uses the same `nrf52840` SOC so there's a lot of repeated configuration between each of the boards. I'm open to  criticism on the way this is set up.
```
   boards
  └  arm
    │  rev5
    │ │ * Kconfig.board
    │ │ * Kconfig.defconfig
    │ │  board.cmake
    │ │  board.yml
    │ │ * rev5.dts
    │ │  rev5.yaml
    │ └ * rev5_defconfig
    │  rev6
    │  rev7
    └  rev8
```
For contents of each config file in `rev5/` (in case its relevant), see https://pastebin.com/HbKJjBac

Would appreciate any advice thanks.

  • Hello,

    It's strange that you get this Kconfig error when building from the command line but not in VS Code. Normally, there should not be any difference, as VS Code is just invoking West for building. Also, this error should only be raised if 'CONFIG_SOC_NRF52840' is directly assigned in one of the configuration files. Both CONFIG_SOC_SERIES_NRF52X and CONFIG_SOC_NRF52840_QFAA are user configurable and will select CONFIG_SOC_NRF52840.

    Just to double-check, could you search through the project for 'CONFIG_SOC_NRF52840' to see if there are any matches? Alternatively, are you able to share your project here or in a private ticket so I can try to reproduce this error on my end?

    Best regards,

    Vidar

  • Hi  , thanks for the reply. Turns out that the problem disappeared when i invoke west from the ncs/v2.5.3 workspace (as opposed to from the zephyr workspace i was using as per the getting started guide), so it may be related to SDK version or something.

  • Hi, 

    Thanks for the update. Yes, it sounds like the project may have been built against a different SDK version when built from the command line. You can run 'west topdir' or 'west list' to check which workspace you are in.

Related