This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Failed to compile non secure boards

This is a follow-up to a previous ticket https://devzone.nordicsemi.com/f/nordic-q-a/83842/error-when-building-configuration-for-non-secure-boards , the problem persists and I think is due to a failed multi image build. I attempted to build a new project with a new vs code reinstallation, nrf connect reinstall with 1.8.0 toolchain and when I build a blinky project for nrf9160dk_nrf9160ns I get the following errors using west build --build-dir /Users/mac/NordicNew/blinky1/build /Users/mac/NordicNew/blinky1 --pristine --board nrf9160dk_nrf9160_ns -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE":

[{
"resource": "/opt/nordic/ncs/v1.8.0/zephyr/boards/arm/nrf9160dk_nrf9160/Kconfig.defconfig",
"owner": "kconfig0",
"severity": 8,
"message": "boards/arm/nrf9160dk_nrf9160/Kconfig.defconfig:36: error: couldn't parse 'default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))': macro expanded to blank string",
"startLineNumber": 36,
"startColumn": 1,
"endLineNumber": 36,
"endColumn": 100000
}]

[{
"resource": "/opt/nordic/ncs/v1.8.0/nrf/cmake/multi_image.cmake",
"owner": "nrf-connect",
"severity": 8,
"message": "CMake generation for spm failed, aborting. Command: 1",
"source": "cmake",
"startLineNumber": 306,
"startColumn": 1,
"endLineNumber": 306,
"endColumn": 2147483647
}]

[{
"resource": "/opt/nordic/ncs/v1.8.0/zephyr/cmake/kconfig.cmake",
"owner": "nrf-connect",
"severity": 8,
"message": "command failed with return code: 1",
"source": "cmake",
"startLineNumber": 270,
"startColumn": 1,
"endLineNumber": 270,
"endColumn": 2147483647
}]

  • Hello Snaider,

    does the build fail in VS Code only or do you get the same error on the command line as well?

    Regards,

    Markus

  • Hi, testing during the weekend using 

    west build --build-dir /Users/mac/NordicNew/blinky1/build /Users/mac/NordicNew/blinky1 --pristine --board nrf9160dk_nrf9160_ns -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE":

    didn't work, however changing the DNCS_TOOLCHAIN_VERSION to 1.8.0 allowed me to build

    west build --build-dir /Users/mac/Documents/pruebasNord/blinky/build /Users/mac/Documents/pruebasNord/blinky --pristine --board nrf9160dk_nrf9160_ns -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING=1.8.0

    After using this command I was able to build from VSCode but any pristine build will have the same error "spm failed"

  • Hello Snaider,

    SnaiderBG said:
    west build --build-dir /Users/mac/NordicNew/blinky1/build /Users/mac/NordicNew/blinky1 --pristine --board nrf9160dk_nrf9160_ns -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE":

    I’m honestly a little bit unsure why you are using the above mentioned build commands. It should be enough to run the following (example, which builds the Hello World sample within the NCS from the HOME directory to a build directory called "build_nrf9160dk_nrf9160_ns"):

    ~$ west build -b nrf9160dk_nrf9160_ns ncs/zephyr/samples/hello_world/ -d ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns -p

    Could you try this and share the application build log?

    Thanks & regards,

    Markus

  • Hi again, I use that command since it is the command executed by the VSCode plugin. Building the sample with the above command succeeded 

    -- west build: generating a build system
    Including boilerplate (Zephyr base): /opt/nordic/ncs/v1.8.0/zephyr/cmake/app/boilerplate.cmake
    -- Application: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world
    -- Using NCS Toolchain 1.8.0 for building. (/opt/nordic/ncs/v1.8.0/toolchain/cmake)
    -- Zephyr version: 2.7.0 (/opt/nordic/ncs/v1.8.0/zephyr), build: v2.7.0-ncs1
    -- Found Python3: /opt/nordic/ncs/v1.8.0/toolchain/bin/python3 (found suitable exact version "3.9.6") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf9160dk_nrf9160_ns, Revision: 0.7.0
    -- Cache files will be written to: /Users/mac/Library/Caches/zephyr
    -- Found dtc: /opt/nordic/ncs/v1.8.0/toolchain/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/opt/nordic/ncs/v1.8.0/toolchain)
    -- Found BOARD.dts: /opt/nordic/ncs/v1.8.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns.dts
    nrf9160dk_nrf9160_ns.dts.pre.tmp:367.32-371.5: Warning (simple_bus_reg): /soc/cryptocell-sw: missing or empty reg/ranges property
    -- Generated zephyr.dts: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v1.8.0/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v1.8.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns_defconfig'
    Merged configuration '/opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/prj.conf'
    Configuration saved to '/opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /opt/nordic/ncs/v1.8.0/toolchain/bin/arm-none-eabi-gcc
    Changed board to secure nrf9160dk_nrf9160 (NOT NS)
    
    === child image spm -  begin ===
    Including boilerplate (Zephyr base): /opt/nordic/ncs/v1.8.0/zephyr/cmake/app/boilerplate.cmake
    -- Application: /opt/nordic/ncs/v1.8.0/nrf/samples/spm
    -- Using NCS Toolchain 1.8.0 for building. (/opt/nordic/ncs/v1.8.0/toolchain/cmake)
    -- Zephyr version: 2.7.0 (/opt/nordic/ncs/v1.8.0/zephyr), build: v2.7.0-ncs1
    -- Found Python3: /opt/nordic/ncs/v1.8.0/toolchain/bin/python3 (found suitable exact version "3.9.6") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf9160dk_nrf9160, Revision: 0.7.0
    -- Cache files will be written to: /Users/mac/Library/Caches/zephyr
    -- Found dtc: /opt/nordic/ncs/v1.8.0/toolchain/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/opt/nordic/ncs/v1.8.0/toolchain)
    -- Found BOARD.dts: /opt/nordic/ncs/v1.8.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v1.8.0/nrf/samples/spm/nrf9160dk_nrf9160.overlay
    -- Generated zephyr.dts: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v1.8.0/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v1.8.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_defconfig'
    Merged configuration '/opt/nordic/ncs/v1.8.0/nrf/samples/spm/prj.conf'
    Merged configuration '/opt/nordic/ncs/v1.8.0/nrf/samples/spm/boards/nrf9160dk_nrf9160.conf'
    Merged configuration '/opt/nordic/ncs/v1.8.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration '/opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /opt/nordic/ncs/v1.8.0/toolchain/bin/arm-none-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v1.8.0/zephyr/CMakeLists.txt:1662 (message):
      __ASSERT() statements are globally ENABLED
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns/spm
    === child image spm -  end ===
    
    Dropping partition 'nrf_modem_lib_trace' since its size is 0.
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /opt/nordic/ncs/v1.8.0/zephyr/samples/hello_world/build_nrf9160dk_nrf9160_ns
    -- west build: building application
    [1/176] Preparing syscall dependency handling
    
    [7/176] Performing build step for 'spm_subimage'
    [1/220] Preparing syscall dependency handling
    
    [54/220] Generating include/generated/...r.h, include/generated/otype-to-size.h
    /opt/nordic/ncs/v1.8.0/zephyr/scripts/gen_kobject_list.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
    [55/220] Generating include/generated/driver-validation.h
    /opt/nordic/ncs/v1.8.0/zephyr/scripts/gen_kobject_list.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
    [213/220] Linking C executable zephyr/zephyr_prebuilt.elf
    
    [216/220] Generating dev_handles.c
    /opt/nordic/ncs/v1.8.0/zephyr/scripts/gen_handles.py:46: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
    [220/220] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:         64 KB        64 KB    100.00%
                SRAM:       11832 B        64 KB     18.05%
            IDT_LIST:          0 GB         2 KB      0.00%
    [10/176] Generating include/generated/driver-validation.h
    /opt/nordic/ncs/v1.8.0/zephyr/scripts/gen_kobject_list.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
    [11/176] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h, include/generated/otype-to-size.h
    /opt/nordic/ncs/v1.8.0/zephyr/scripts/gen_kobject_list.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
    [168/176] Linking C executable zephyr/zephyr_prebuilt.elf
    
    [171/176] Generating dev_handles.c
    /opt/nordic/ncs/v1.8.0/zephyr/scripts/gen_handles.py:46: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(elftools.__version__) < LooseVersion('0.24'):
    [175/176] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       27672 B       960 KB      2.81%
                SRAM:        6440 B     178968 B      3.60%
            IDT_LIST:          0 GB         2 KB      0.00%
    [176/176] Generating zephyr/merged.hex

    Any idea why this error appears only when using the VSCode plugin? Can I change the settings of VSCode to run the simple command? or is your recommendation to build from the command line? 

    Thanks

  • Thanks a lot for the input, Snaider!

    SnaiderBG said:
    Any idea why this error appears only when using the VSCode plugin? Can I change the settings of VSCode to run the simple command? or is your recommendation to build from the command line? 

    First of all, the nRF Connect Extension in VS Code is depended on a correct configured nRF Connect SDK toolchain. However, it uses slightly modified build commands to access it from within VS Code.

    It is a good starting point that you can build the application via the command line. But of course, you should be able to do so in VS Code as well. The point with the extension is to make both programming and building as smooth as possible :-)

    My recommendation now would be that you go through the points described in this tutorial and check if your nRF Connect Extension is set-up correctly. Please let me know if that doesn’t solve the issue.

    Regards,

    Markus

Related