Build fails when enabling SQSPI in Device Tree (with MCUBoot)

Hi,
I’m seeing a build failure after enabling SQSPI in the device tree when building with MCUBoot on NCS v3.2.1 for nRF54L15.

The build works fine without SQSPI, but once it’s enabled the link step fails. 

In function 'nrf_sqspi_init',
    inlined from 'dev_init' at /opt/nordic/ncs/v3.2.1/nrf/drivers/mspi/mspi_sqspi.c:513:8:
/opt/nordic/ncs/v3.2.1/nrfxlib/softperipheral/sQSPI/src/nrf_sqspi.c:164:9: warning: 'memcpy' reading 14144 bytes from a region of size 12088 [-Wstringop-overread]
  164 |         memcpy((void *)vpr_init_pc, nvm_fw_addr, meta->fw_code_size << 4);
      |         ^
/opt/nordic/ncs/v3.2.1/nrfxlib/softperipheral/sQSPI/include/nrf54l/sqspi_firmware_v1.2.1.h: In function 'dev_init':
/opt/nordic/ncs/v3.2.1/nrfxlib/softperipheral/sQSPI/include/nrf54l/sqspi_firmware_v1.2.1.h:12:15: note: source object 'sqspi_firmware_bin' of size 12088
   12 | const uint8_t sqspi_firmware_bin[] = {
      |               ^
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /var/folders/1b/v55__bbd543bfrt51p0y5tq00000gp/T//ccXqqwuC.ltrans0.ltrans.o: in function `done_callback':
/Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /var/folders/1b/v55__bbd543bfrt51p0y5tq00000gp/T//ccXqqwuC.ltrans0.ltrans.o: in function `api_dev_config':
/Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1158: undefined reference to `z_impl_k_sem_take'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1158: undefined reference to `z_impl_k_sem_take'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /var/folders/1b/v55__bbd543bfrt51p0y5tq00000gp/T//ccXqqwuC.ltrans0.ltrans.o:/Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /var/folders/1b/v55__bbd543bfrt51p0y5tq00000gp/T//ccXqqwuC.ltrans0.ltrans.o:/Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /var/folders/1b/v55__bbd543bfrt51p0y5tq00000gp/T//ccXqqwuC.ltrans0.ltrans.o: in function `api_get_channel_status':
/Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1158: undefined reference to `z_impl_k_sem_take'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /var/folders/1b/v55__bbd543bfrt51p0y5tq00000gp/T//ccXqqwuC.ltrans0.ltrans.o: in function `api_transceive':
/Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1158: undefined reference to `z_impl_k_sem_take'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1175: undefined reference to `z_impl_k_sem_give'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1158: undefined reference to `z_impl_k_sem_take'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /var/folders/1b/v55__bbd543bfrt51p0y5tq00000gp/T//ccXqqwuC.ltrans0.ltrans.o: in function `dev_init':
/Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1141: undefined reference to `z_impl_k_sem_init'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1141: undefined reference to `z_impl_k_sem_init'
/opt/nordic/ncs/toolchains/561dce9adf/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/ghazifaisal/github/project/build/mcuboot/zephyr/include/generated/zephyr/syscalls/kernel.h:1141: undefined reference to `z_impl_k_sem_init'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[15/20] Generating ../dfu_application.zip
FAILED: _sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build /Users/ghazifaisal/github/project/build/_sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build 
cd /Users/ghazifaisal/github/project/build/mcuboot && /opt/nordic/ncs/toolchains/561dce9adf/Cellar/cmake/3.21.0/bin/cmake --build .
ninja: build stopped: subcommand failed.

Parents Reply Children
  • Sorry for the delayed response — I was out of office the past 3 days.

    I’m using a SEGGER J-Link debugger with the nRF Connect SDK VS Code extension, and I’m viewing logs through the RTT Viewer tool (not the Espressif extension). Since this is a custom board, I don’t have access to UART, which is why I tried enabling RTT logging

  • No worries. But I somehow missed your comment about using a custom board , I have just been assuming that you were testing on a nRF54l15 DK. 

    Before trying to use sQSPI with the bootloader, did you verify that you were able to interface with your SPI flash on your board? You can use the /nrf/samples/zephyr/drivers/spi_flash/ or nrf/samples/zephyr/drivers/jesd216/ sample for this.

  • both samples given are sQSPI sample.
    sQSPI is working on my pcb with the flash. I verified this by writing and reading and I was able to write across the full flash size 

  • Thanks for confirming. Are you using the nrf54l15dk as your build target (i.e. nrf54l15dk/nrf54l15/cpuapp), and does your board include the optional 32KHz crystal? If not, have you made sure to change the default LF clock source in the bootloader as well as in the application?

  • Thanks. This worked with the sample.

    However, in my main code the external flash is completely occupied by LittleFS, and slot0 and slot1 are being placed in internal flash.

    In the sample, slot1 uses external flash, which creates an inconsistency between MCUboot and the main app in my case. This is happening because MCUboot is taking a large portion of the internal flash.

    Is there a way to fix this?

    For reference, I am using these flags to create a LittleFS partition on external flash (still based on the same sample).

    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FILE_SYSTEM=y
    CONFIG_FILE_SYSTEM_LITTLEFS=y
    
    CONFIG_SPI=y
    CONFIG_NORDIC_QSPI_NOR=y
    
    CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
    CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x800000
    
    CONFIG_FS_LITTLEFS_CACHE_SIZE=4096
    CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE=256

Related