Serial LTE modem does not compile in NCS main with CONFIG_SLM_START_SLEEP=y

NCS main

Serial LTE modem does not compile with CONFIG_SLM_START_SLEEP=y in prj.conf

There is missing #include <hal/nrf_reset.h> in main.c but even after including it, compilation fails on undefined RESET_RESETREAS_RESETPIN_Msk

Would you be so kind and fix it please ?

Thank you.

Regards,
Michal

  • Hello Michal, 

    Can you please provide some more details on this issue i.e. the build log? 

    Thanks. 

    Kind regards,
    Øyvind

  • Hello Øyvind,

    sure, but it is probably same as for your build.

    Or are you able to build it without problems please ?

    ```

    serial_lte_modem> west build -b nrf9160dk_nrf9160ns
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/michal/ncs/nrf/applications/serial_lte_modem
    -- Found Python3: C:/Users/michal/scoop/apps/python/current/python.exe (found suitable exact version "3.10.2") found components: Interpreter
    -- Cache files will be written to: C:/Users/michal/ncs/zephyr/.cache
    -- Zephyr version: 3.0.99 (C:/Users/michal/ncs/zephyr)
    -- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
    CMake Warning at C:/Users/michal/ncs/zephyr/cmake/modules/boards.cmake:77 (message):
    Deprecated BOARD=nrf9160dk_nrf9160ns name specified, board automatically
    changed to: nrf9160dk_nrf9160_ns.
    Call Stack (most recent call first):
    C:/Users/michal/ncs/zephyr/cmake/modules/zephyr_default.cmake:121 (include)
    C:/Users/michal/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:51 (include)
    C:/Users/michal/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:76 (include_boilerplate)
    CMakeLists.txt:9 (find_package)


    -- Board: nrf9160dk_nrf9160_ns, Revision: 0.7.0
    -- Found toolchain: gnuarmemb (C:/Users/michal/gcc-arm-none-eabi-9-2019-q4-major-win32)
    -- Found BOARD.dts: C:/Users/michal/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns.dts
    -- Found devicetree overlay: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.overlay
    -- Generated zephyr.dts: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/zephyr/dts.cmake

    warning: Experimental symbol HTTP_CLIENT is enabled.


    warning: Experimental symbol NET_SOCKETS_OFFLOAD is enabled.

    Parsing C:/Users/michal/ncs/nrf/applications/serial_lte_modem/Kconfig
    Loaded configuration 'C:/Users/michal/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns_defconfig'
    Merged configuration 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/prj.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.conf'
    Configuration saved to 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/zephyr/.config'
    Kconfig header saved to 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/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: C:/Users/michal/gcc-arm-none-eabi-9-2019-q4-major-win32/bin/arm-none-eabi-gcc.exe
    Changed board to secure nrf9160dk_nrf9160 (NOT NS)

    === child image spm - begin ===
    loading initial cache file C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/michal/ncs/nrf/samples/spm
    -- Found Python3: C:/Users/michal/scoop/apps/python/current/python.exe (found suitable exact version "3.10.2") found components: Interpreter
    -- Cache files will be written to: C:/Users/michal/ncs/zephyr/.cache
    -- Zephyr version: 3.0.99 (C:/Users/michal/ncs/zephyr)
    -- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
    -- Board: nrf9160dk_nrf9160, Revision: 0.7.0
    -- Found toolchain: gnuarmemb (C:/Users/michal/gcc-arm-none-eabi-9-2019-q4-major-win32)
    -- Found BOARD.dts: C:/Users/michal/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160.dts
    -- Found devicetree overlay: C:/Users/michal/ncs/nrf/samples/spm/nrf9160dk_nrf9160.overlay
    -- Generated zephyr.dts: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm/zephyr/dts.cmake
    Parsing C:/Users/michal/ncs/zephyr/Kconfig
    Loaded configuration 'C:/Users/michal/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_defconfig'
    Merged configuration 'C:/Users/michal/ncs/nrf/samples/spm/prj.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/samples/spm/boards/nrf9160dk_nrf9160.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/child_image/spm.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm/zephyr/.config'
    Kconfig header saved to 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/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: C:/Users/michal/gcc-arm-none-eabi-9-2019-q4-major-win32/bin/arm-none-eabi-gcc.exe
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/spm
    === child image spm - end ===

    Changed board to secure nrf9160dk_nrf9160 (NOT NS)

    === child image mcuboot - begin ===
    loading initial cache file C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/michal/ncs/bootloader/mcuboot/boot/zephyr
    -- Found Python3: C:/Users/michal/scoop/apps/python/current/python.exe (found suitable exact version "3.10.2") found components: Interpreter
    -- Cache files will be written to: C:/Users/michal/ncs/zephyr/.cache
    -- Zephyr version: 3.0.99 (C:/Users/michal/ncs/zephyr)
    -- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
    -- Board: nrf9160dk_nrf9160, Revision: 0.7.0
    -- Found toolchain: gnuarmemb (C:/Users/michal/gcc-arm-none-eabi-9-2019-q4-major-win32)
    -- Found BOARD.dts: C:/Users/michal/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160.dts
    -- Found devicetree overlay: C:/Users/michal/ncs/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/zephyr/dts.cmake
    Parsing C:/Users/michal/ncs/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'C:/Users/michal/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_defconfig'
    Merged configuration 'C:/Users/michal/ncs/bootloader/mcuboot/boot/zephyr/prj.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/child_image/mcuboot.conf'
    Merged configuration 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/zephyr/.config'
    Kconfig header saved to 'C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot/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: C:/Users/michal/gcc-arm-none-eabi-9-2019-q4-major-win32/bin/arm-none-eabi-gcc.exe
    MCUBoot bootloader key file: C:/Users/michal/ncs/bootloader/mcuboot/root-ec-p256.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/mcuboot
    === child image mcuboot - end ===

    CMake Warning at C:/Users/michal/ncs/nrf/modules/mcuboot/CMakeLists.txt:278 (message):


    ---------------------------------------------------------
    --- WARNING: Using default MCUBoot key, it should not ---
    --- be used for production. ---
    ---------------------------------------------------------


    Dropping partition 'nrf_modem_lib_trace' since its size is 0.
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build
    -- west build: building application
    [5/325] Generating include/generated/version.h
    -- Zephyr version: 3.0.99 (C:/Users/michal/ncs/zephyr), build: v2.7.99-ncs1-4497-g1b5216019d2f
    [10/325] Performing build step for 'mcuboot_subimage'
    [1/191] Generating include/generated/version.h
    -- Zephyr version: 3.0.99 (C:/Users/michal/ncs/zephyr), build: v2.7.99-ncs1-4497-g1b5216019d2f
    [181/191] Linking C executable zephyr\zephyr_pre0.elf

    [185/191] Linking C executable zephyr\zephyr_pre1.elf

    [191/191] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 33668 B 48 KB 68.50%
    SRAM: 17592 B 211736 B 8.31%
    IDT_LIST: 0 GB 2 KB 0.00%
    [16/325] Performing build step for 'spm_subimage'
    [11/265] Generating include/generated/version.h
    -- Zephyr version: 3.0.99 (C:/Users/michal/ncs/zephyr), build: v2.7.99-ncs1-4497-g1b5216019d2f
    [255/265] Linking C executable zephyr\zephyr_pre0.elf

    [259/265] Linking C executable zephyr\zephyr_pre1.elf

    [265/265] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 32256 B 64 KB 49.22%
    SRAM: 11944 B 32 KB 36.45%
    IDT_LIST: 0 GB 2 KB 0.00%
    [99/325] Building C object CMakeFiles/app.dir/src/main.c.obj
    FAILED: CMakeFiles/app.dir/src/main.c.obj
    C:\Users\michal\gcc-arm-none-eabi-9-2019-q4-major-win32\bin\arm-none-eabi-gcc.exe -DAPP_VERSION=v1.9.99-dev1-281-g898c21b490e7 -DEXT_API_MAGIC=0x281ee6de,0xb845acea,23298 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,23298 -DKERNEL -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/Users/michal/ncs/zephyr/include/zephyr -IC:/Users/michal/ncs/zephyr/include -IC:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/zephyr/include/generated -IC:/Users/michal/ncs/zephyr/soc/arm/nordic_nrf/nrf91 -IC:/Users/michal/ncs/zephyr/lib/libc/newlib/include -IC:/Users/michal/ncs/zephyr/soc/arm/nordic_nrf/common/. -IC:/Users/michal/ncs/zephyr/subsys/net/lib/sockets/. -IC:/Users/michal/ncs/zephyr/subsys/net/ip -IC:/Users/michal/ncs/zephyr/subsys/settings/include -IC:/Users/michal/ncs/nrf/include -IC:/Users/michal/ncs/nrf/lib/at_cmd_parser/include -IC:/Users/michal/ncs/nrf/subsys/net/lib/nrf_cloud/./include -IC:/Users/michal/ncs/nrf/subsys/net/lib/cloud/./include -IC:/Users/michal/ncs/modules/lib/cjson -IC:/Users/michal/ncs/nrf/modules/cjson/include -IC:/Users/michal/ncs/modules/hal/cmsis/CMSIS/Core/Include -IC:/Users/michal/ncs/modules/hal/nordic/nrfx -IC:/Users/michal/ncs/modules/hal/nordic/nrfx/drivers/include -IC:/Users/michal/ncs/modules/hal/nordic/nrfx/mdk -IC:/Users/michal/ncs/zephyr/modules/hal_nordic/nrfx/. -IC:/Users/michal/ncs/modules/debug/segger/SEGGER -IC:/Users/michal/ncs/modules/debug/segger/Config -IC:/Users/michal/ncs/zephyr/modules/segger/. -IC:/Users/michal/ncs/nrfxlib/nrf_modem/include -IC:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/gnss/. -IC:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/ftp_c/. -IC:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/mqtt_c/. -IC:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/http_c/. -IC:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/gpio/. -IC:/Users/michal/ncs/nrf/applications/serial_lte_modem/src -Os -imacros C:/Users/michal/ncs/nrf/applications/serial_lte_modem/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -imacros C:/Users/michal/ncs/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Users/michal/ncs/nrf/applications/serial_lte_modem=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/michal/ncs/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/michal/ncs=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles\app.dir\src\main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c C:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/main.c
    C:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/main.c: In function 'main':
    C:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/main.c:354:12: error: 'NRF_POWER_RESETREAS_LPCOMP_MASK' undeclared (first use in this function); did you mean 'NRF_POWER_RESETREAS_LOCKUP_MASK'?
    354 | (rr & NRF_POWER_RESETREAS_LPCOMP_MASK) || /* LPCOMP */
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | NRF_POWER_RESETREAS_LOCKUP_MASK
    C:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/main.c:354:12: note: each undeclared identifier is reported only once for each function it appears in
    C:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/main.c:355:12: error: 'NRF_POWER_RESETREAS_NFC_MASK' undeclared (first use in this function); did you mean 'NRF_POWER_RESETREAS_OFF_MASK'?
    355 | (rr & NRF_POWER_RESETREAS_NFC_MASK) || /* NFC */
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | NRF_POWER_RESETREAS_OFF_MASK
    C:/Users/michal/ncs/nrf/applications/serial_lte_modem/src/main.c:356:12: error: 'NRF_POWER_RESETREAS_VBUS_MASK' undeclared (first use in this function); did you mean 'NRF_POWER_RESETREAS_DIF_MASK'?
    356 | (rr & NRF_POWER_RESETREAS_VBUS_MASK)) { /* USB VBUS */
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | NRF_POWER_RESETREAS_DIF_MASK
    [120/325] Building C object CMakeFiles/app.dir/src/slm_at_socket.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Users\michal\scoop\shims\cmake.EXE' --build 'C:\Users\michal\ncs\nrf\applications\serial_lte_modem\build'


    ```

    Regards,
    Michal

  • Hello, thanks for providing and reporting.

    I tested with the main branch of nRF Connect SDK and got a completely different message. 

    Testing with v1.9.1 and v1.9.99-dev1 yields the same error as you got. Have forwarded to our developers to look into it. 

    Kind regards,
    Øyvind

  • Hello Michal, 

    The issue is fixed and merged with main. I've tested and successfully built with CONFIG_SLM_START_SLEEP=y. 

    Can you please confirm on your side?

    Kind regards,
    Øyvind

  • Hi Øyvind,

    I am confirming build is fine now.

    Thank you for the fix.

    There some nRF9160 power consumption issue, have a look https://devzone.nordicsemi.com/f/nordic-q-a/88108/serial-lte-modem-app-in-ncs-main-has-unexpected-power-consumption-after-xsleep-2

    Regards,
    Michal

Related