Problem building project in nRF9160DK (error: static assertion failed: "The libmodem shmem configuration exceeds the range of memory readable by the Modem core")

Hi.

We are working on a project which uses nrF9160DK and nRF5340DK, which works fine on this last one. The problem is that when I tried building on the 9160 using nRF Connect SDK (1.8.0), the following error appears:

FAILED: modules/nrf/lib/nrf_modem_lib/CMakeFiles/..__nrf__lib__nrf_modem_lib.dir/shmem_sanity.c.obj
C:\ncs\v1.8.0\toolchain\opt\bin\arm-none-eabi-gcc.exe -DBUILD_VERSION=v2.7.0-ncs1 -DEXT_API_MAGIC=0x281ee6de,0xb845acea,23298 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,23298 -DKERNEL -DNRF9160_XXAA -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v1.8.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v1.8.0/zephyr/soc/arm/nordic_nrf/nrf91 -IC:/ncs/v1.8.0/zephyr/lib/util/fnmatch/. -IC:/ncs/v1.8.0/nrf/include -IC:/ncs/v1.8.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v1.8.0/modules/hal/nordic/nrfx -IC:/ncs/v1.8.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v1.8.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v1.8.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v1.8.0/nrfxlib/nrf_modem/include -isystem C:/ncs/v1.8.0/zephyr/lib/libc/minimal/include -isystem c:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/include -isystem c:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/include-fixed -Os -imacros C:/Users/mario/OneDrive/Escritorio/bls-hsm/cli/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros C:/ncs/v1.8.0/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Users/mario/OneDrive/Escritorio/bls-hsm/cli=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v1.8.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v1.8.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT modules/nrf/lib/nrf_modem_lib/CMakeFiles/..__nrf__lib__nrf_modem_lib.dir/shmem_sanity.c.obj -MF modules\nrf\lib\nrf_modem_lib\CMakeFiles\..__nrf__lib__nrf_modem_lib.dir\shmem_sanity.c.obj.d -o modules/nrf/lib/nrf_modem_lib/CMakeFiles/..__nrf__lib__nrf_modem_lib.dir/shmem_sanity.c.obj -c C:/ncs/v1.8.0/nrf/lib/nrf_modem_lib/shmem_sanity.c
In file included from C:\ncs\v1.8.0\zephyr\include\toolchain.h:50,
from C:\ncs\v1.8.0\nrf\lib\nrf_modem_lib\shmem_sanity.c:7:
C:\ncs\v1.8.0\zephyr\include\toolchain\gcc.h:61:36: error: static assertion failed: "The libmodem shmem configuration exceeds the range of memory readable by the Modem core"
61 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
| ^~~~~~~~~~~~~~
C:\ncs\v1.8.0\nrf\lib\nrf_modem_lib\shmem_sanity.c:18:1: note: in expansion of macro 'BUILD_ASSERT'
18 | BUILD_ASSERT(SHMEM_IN_USE < SHMEM_END,
| ^~~~~~~~~~~~

As far as I know, it should work in both boards fine without any change. Is there any way to solve it?

Thanks.

Parents
  • Hello,

    which application are you trying to build? Is it an SDK sample or custom application? Does every sample fail to build in the same manner?

  • Samples work fine. The problem is with our application, which is based on the shell sample and was modified following this guide in order to run certain parts of the code on the secure side. This also can be built without problems in nRF5340 board, but not on the nRF9160.

  • This one seems to be for spm. Can you post the partitions.yml file located in the build folder?

  • Here is the content of the file in the nrf5340 build folder:

    app:
      address: 0x20000
      end_address: 0x100000
      region: flash_primary
      size: 0xe0000
    otp:
      address: 0xff8100
      end_address: 0xff83fc
      region: otp
      size: 0x2fc
    spm:
      address: 0x0
      end_address: 0x20000
      placement:
        before:
        - app
      region: flash_primary
      size: 0x20000
    spm_sram:
      address: 0x20000000
      end_address: 0x20021000
      inside:
      - sram_secure
      placement:
        after:
        - start
      region: sram_primary
      size: 0x21000
    sram_nonsecure:
      address: 0x20021000
      end_address: 0x20080000
      orig_span: &id001
      - sram_primary
      region: sram_primary
      size: 0x5f000
      span: *id001
    sram_primary:
      address: 0x20021000
      end_address: 0x20080000
      region: sram_primary
      size: 0x5f000
    sram_secure:
      address: 0x20000000
      end_address: 0x20021000
      orig_span: &id002
      - spm_sram
      region: sram_primary
      size: 0x21000
      span: *id002
    

  • Can you also send the one for the nrf9160 build?

  • Here it is:

    app:
      address: 0x20000
      end_address: 0x100000
      region: flash_primary
      size: 0xe0000
    nrf_modem_lib_ctrl:
      address: 0x20021000
      end_address: 0x200214e8
      inside:
      - sram_nonsecure
      placement:
        after:
        - spm_sram
        - start
      region: sram_primary
      size: 0x4e8
    nrf_modem_lib_rx:
      address: 0x200234e8
      end_address: 0x200254e8
      inside:
      - sram_nonsecure
      placement:
        after:
        - nrf_modem_lib_tx
      region: sram_primary
      size: 0x2000
    nrf_modem_lib_sram:
      address: 0x20021000
      end_address: 0x200254e8
      orig_span: &id001
      - nrf_modem_lib_ctrl
      - nrf_modem_lib_tx
      - nrf_modem_lib_rx
      region: sram_primary
      size: 0x44e8
      span: *id001
    nrf_modem_lib_tx:
      address: 0x200214e8
      end_address: 0x200234e8
      inside:
      - sram_nonsecure
      placement:
        after:
        - nrf_modem_lib_ctrl
      region: sram_primary
      size: 0x2000
    otp:
      address: 0xff8108
      end_address: 0xff83fc
      region: otp
      size: 0x2f4
    spm:
      address: 0x0
      end_address: 0x20000
      placement:
        before:
        - app
      region: flash_primary
      size: 0x20000
    spm_sram:
      address: 0x20000000
      end_address: 0x20021000
      inside:
      - sram_secure
      placement:
        after:
        - start
      region: sram_primary
      size: 0x21000
    sram_nonsecure:
      address: 0x20021000
      end_address: 0x20040000
      orig_span: &id002
      - sram_primary
      - nrf_modem_lib_ctrl
      - nrf_modem_lib_tx
      - nrf_modem_lib_rx
      region: sram_primary
      size: 0x1f000
      span: *id002
    sram_primary:
      address: 0x200254e8
      end_address: 0x20040000
      region: sram_primary
      size: 0x1ab18
    sram_secure:
      address: 0x20000000
      end_address: 0x20021000
      orig_span: &id003
      - spm_sram
      region: sram_primary
      size: 0x21000
      span: *id003
    

  • You need to place the modem lib shared memory region in the first half of the SRAM. This is specified in the modem lib documentation;

    "The shared memory area can be located anywhere within the first 128 kilobytes of RAM (lowest addresses)..."

    You are placing it in the second half which should not work.

Reply Children
Related