Undefined reference to pm_state_force on Windows, works fine on Linux

Hi devzone,

I am having a weird problem. I was guiding a new employee to set up their Windows computer to develop our application. Once everything was set up, we built a stable version of our application, but the build failed due to an undefined reference to pm_state_force. I have no issues building the same app on a Linux VM with, to the best of my knowledge, the same parameters (toolchain, etc ). I am reproducing the same issue when I try to build on my windows computer i.e. not in the VM.

Do you have any ideas where this might come from, and how to solve the issue ?

Thanks in advance for your help.

Best regards,

Nicolas Goualard

Parents
  • Hi Nicolas,

    There should not be a difference from building on Windows and Linux. Could it be that you are not using the same SDK version, toolchain version, or something else?

    If you still see this issue, can you elaborate on the issue sharing the error message, relevant code, and clarify which SDK and toolchain you are using on your Linux VM and Windows machine?

    Br,

    Einar

  • Hi Einar,

    Thanks for your reply. I updated both version to ncs version 2.5.0 in the process, so as far as i know the versions are the same, however there is a difference between the two setups. On Windows, when I am in the ncs extension in VS code I have the following info:

    On Linux, I am using toolchain v2.5.0, and after "Open west Manifest" it says 2.4.99. I don't know if that can cause the issue, and I didn't know how to update the manifest, so I could not verify that, but that might be it ?

    I tried building this very simple app on both sides on the nrf52840dk_nrf52840 board:

    #include <zephyr/kernel.h>
    #include <soc.h>
    #include <zephyr/pm/pm.h>
    #include <zephyr/pm/device.h>
    #include <zephyr/pm/policy.h>
    
    int main(void)
    {
            pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
            return 0;
    }

    prj.conf:

    # Copyright (c) 2021 Nordic Semiconductor ASA
    # SPDX-License-Identifier: Apache-2.0
    #
    # This file contains selected Kconfig options for the application.
    
    CONFIG_SENSOR=y
    
    # Config for Immutable Secure Bootloader
    CONFIG_SECURE_BOOT=n
    CONFIG_B0_MIN_PARTITION_SIZE=n
    
    # Config for Upgradable Bootloader
    CONFIG_BOOTLOADER_MCUBOOT=n
    CONFIG_BUILD_S1_VARIANT=n
    
    # enable logging
    CONFIG_LOG=y
    CONFIG_LOG_INFO_COLOR_GREEN=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    
    # enable Hardware info
    CONFIG_HWINFO=y
    CONFIG_HWINFO_NRF=y
    
    # enable ADC
    CONFIG_ADC=y
    
    # enable SPI
    CONFIG_SPI=y
    CONFIG_SPI_NOR=y
    
    # enabling State Machine Framework and events
    CONFIG_SMF=y
    CONFIG_EVENTS=y
    CONFIG_SMF_ANCESTOR_SUPPORT=y
    
    # enabling Bluetooth
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Zephyr"
    CONFIG_BT_DEVICE_APPEARANCE=5184
    # 5184 means Generic Outdoor Sports Activity. Complete list of appearance values can be found on the Bluetooth website under "assigned values" : https://www.bluetooth.com/specifications/assigned-numbers/
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    
    # enabling bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    
    CONFIG_ASSERT=y
    
    # Enable the UART driver (for the BG77 UART?)
    CONFIG_UART_ASYNC_API=n
    CONFIG_SERIAL=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_NRFX_UARTE0=y
    
    # Enbale Ring Buffer
    CONFIG_RING_BUFFER=y
    
    # Config for enabling newlib C
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    
    # Enabling FPU
    CONFIG_FPU=y
    
    
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_BT_RX_STACK_SIZE=4096
    CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y
    CONFIG_BT_HCI_TX_STACK_SIZE=4096
    #CONFIG_THREAD_ANALYZER=y
    #CONFIG_THREAD_ANALYZER_AUTO=y
    #CONFIG_THREAD_ANALYZER_USE_LOG=y
    #CONFIG_THREAD_NAME=y

    with the same results, it passes on Linux, but fails on Windows. Here is the build output :


    Building app
    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir c:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/build_1 c:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app --pristine --board nrf52840dk_nrf52840 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="c:/users/lpc-008/my-workspace/eqs-motion-s-zephyr.git" -DCONF_FILE:STRING="c:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/prj.conf""

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app
    -- CMake version: 3.20.5
    -- Found Python3: C:/Users/LPC-008/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/Users/LPC-008/my-workspace/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/Users/LPC-008/my-workspace/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.16.1 (C:/Users/LPC-008/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/Users/LPC-008/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found Dtc: C:/Users/LPC-008/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/Users/LPC-008/my-workspace/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/build_1/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/build_1/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/build_1/zephyr/dts.cmake

    warning: SPI_NOR (defined at drivers/flash/Kconfig.nor:4) was assigned the value 'y' but got the
    value 'n'. Check these unsatisfied dependencies: DT_HAS_JEDEC_SPI_NOR_ENABLED (=n). See
    docs.zephyrproject.org/.../kconfig.html and/or look up SPI_NOR in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

    Parsing C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/Kconfig
    Loaded configuration 'C:/Users/LPC-008/my-workspace/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration 'c:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/prj.conf'
    Configuration saved to 'C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/build_1/zephyr/.config'
    Kconfig header saved to 'C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/build_1/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/users/lpc-008/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/Users/LPC-008/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Warning at C:/Users/LPC-008/my-workspace/zephyr/CMakeLists.txt:1958 (message):
    __ASSERT() statements are globally ENABLED


    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/LPC-008/my-workspace/eqs-motion-s-zephyr.git/app/build_1
    -- west build: building application
    [1/235] Generating ../../zephyr/include/generated/ncs_version.h
    [2/235] Generating include/generated/version.h
    -- Zephyr version: 3.4.99 (C:/Users/LPC-008/my-workspace/zephyr), build: v3.4.99-ncs1-33-gff85910bf8ed
    [3/235] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
    [4/235] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
    [5/235] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h, include/generated/otype-to-size.h
    [6/235] Generating include/generated/driver-validation.h
    [7/235] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
    [8/235] Generating include/generated/offsets.h
    [9/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc32c_sw.c.obj
    [10/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc32_sw.c.obj
    [11/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc7_sw.c.obj
    [12/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc8_sw.c.obj
    [13/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/dec.c.obj
    [14/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc16_sw.c.obj
    [15/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj
    [16/235] Building C object CMakeFiles/app.dir/src/main.c.obj
    ../src/main.c: In function 'main':
    c:\Users\LPC-008\my-workspace\eqs-motion-s-zephyr.git\app\src\main.c:9:9: warning: implicit declaration of function 'pm_state_force' [-Wimplicit-function-declaration]
    9 | pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
    | ^~~~~~~~~~~~~~
    [17/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj
    [18/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/timeutil.c.obj
    [19/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/sem.c.obj
    [20/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/multi_heap.c.obj
    [21/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/thread_entry.c.obj
    [22/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj
    [23/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj
    [24/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/rb.c.obj
    [25/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/heap.c.obj
    [26/235] Building ASM object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/common/soc_nrf_common.S.obj
    [27/235] Linking C static library app\libapp.a
    [28/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf.c.obj
    [29/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/notify.c.obj
    [30/235] Building C object zephyr/CMakeFiles/zephyr.dir/misc/generated/configs.c.obj
    [31/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/onoff.c.obj
    [32/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/heap-validate.c.obj
    [33/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/bitarray.c.obj
    [34/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/ring_buffer.c.obj
    [35/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/assert.c.obj
    [36/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/reboot.c.obj
    [37/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/storage/flash_map/flash_map.c.obj
    [38/235] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_complete.c.obj
    [39/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/backends/log_backend_rtt.c.obj
    [40/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/storage/flash_map/flash_map_default.c.obj
    [41/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_output.c.obj
    [42/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_cache.c.obj
    [43/235] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_enabled_instances.c.obj
    [44/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/backends/log_backend_uart.c.obj
    [45/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_mgmt.c.obj
    [46/235] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_base_addresses.c.obj
    [47/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_core.c.obj
    [48/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_msg.c.obj
    [49/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/device.c.obj
    [50/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/main_weak.c.obj
    [51/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/errno.c.obj
    [52/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/banner.c.obj
    [53/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/fs/nvs/nvs.c.obj
    [54/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/busy_wait.c.obj
    [55/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/init.c.obj
    [56/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
    [57/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/version.c.obj
    [58/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/thread.c.obj
    [59/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mem_slab.c.obj
    [60/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/kheap.c.obj
    [61/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/idle.c.obj
    [62/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mutex.c.obj
    [63/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/queue.c.obj
    [64/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/stack.c.obj
    [65/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mailbox.c.obj
    [66/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/msg_q.c.obj
    [67/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/system_work_q.c.obj
    [68/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/condvar.c.obj
    [69/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sem.c.obj
    [70/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timer.c.obj
    [71/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/work.c.obj
    [72/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/tracing/tracing_none.c.obj
    [73/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/xip.c.obj
    [74/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/net/lib/utils/addr_utils.c.obj
    [75/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timeout.c.obj
    [76/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/poll.c.obj
    [77/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mempool.c.obj
    [78/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/storage/flash_map/flash_map_layout.c.obj
    [79/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/dynamic_disabled.c.obj
    [80/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/events.c.obj
    [81/235] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sched.c.obj
    [82/235] Building C object zephyr/CMakeFiles/zephyr.dir/C_/Users/LPC-008/my-workspace/modules/crypto/tinycrypt/lib/source/utils.c.obj
    [83/235] Building C object zephyr/CMakeFiles/zephyr.dir/C_/Users/LPC-008/my-workspace/modules/crypto/tinycrypt/lib/source/aes_decrypt.c.obj
    [84/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings.c.obj
    [85/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_store.c.obj
    [86/235] Building C object zephyr/CMakeFiles/zephyr.dir/C_/Users/LPC-008/my-workspace/modules/crypto/tinycrypt/lib/source/aes_encrypt.c.obj
    [87/235] Building C object zephyr/CMakeFiles/zephyr.dir/C_/Users/LPC-008/my-workspace/modules/crypto/tinycrypt/lib/source/cmac_mode.c.obj
    [88/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_line.c.obj
    [89/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_nvs.c.obj
    [90/235] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_init.c.obj
    [91/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/vector_table.S.obj
    [92/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/reset.S.obj
    [93/235] Building C object zephyr/CMakeFiles/zephyr.dir/C_/Users/LPC-008/my-workspace/nrfxlib/crypto/nrf_cc310_platform/src/nrf_cc3xx_platform_mutex_zephyr.c.obj
    [94/235] Building C object zephyr/CMakeFiles/zephyr.dir/C_/Users/LPC-008/my-workspace/nrfxlib/crypto/nrf_cc310_platform/src/nrf_cc3xx_platform_abort_zephyr.c.obj
    [95/235] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fpu.c.obj
    [96/235] Linking C static library zephyr\kernel\libkernel.a
    [97/235] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/irq_init.c.obj
    [98/235] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/scb.c.obj
    [99/235] Generating linker_zephyr_pre0.cmd
    [100/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/isr_wrapper.S.obj
    [101/235] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/thread_abort.c.obj
    [102/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/exc_exit.S.obj
    [103/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/swap_helper.S.obj
    [104/235] Building C object zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj
    [105/235] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_core_mpu.c.obj
    [106/235] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/swap.c.obj
    [107/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fault_s.S.obj
    [108/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/nmi_on_reset.S.obj
    [109/235] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/thread.c.obj
    [110/235] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/cpu_idle.S.obj
    [111/235] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/nmi.c.obj
    [112/235] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fault.c.obj
    [113/235] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/prep_c.c.obj
    [114/235] Building C object zephyr/arch/common/CMakeFiles/isr_tables.dir/isr_tables.c.obj
    [115/235] Building C object zephyr/arch/common/CMakeFiles/arch__common.dir/sw_isr_common.c.obj
    [116/235] Linking C static library zephyr\libzephyr.a
    [117/235] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/fatal.c.obj
    [118/235] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/irq_manage.c.obj
    [119/235] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_mpu.c.obj
    [120/235] Building C object zephyr/soc/soc/arm/common/cortex_m/CMakeFiles/soc__arm__common__cortex_m.dir/arm_mpu_regions.c.obj
    [121/235] Building C object zephyr/lib/libc/common/CMakeFiles/lib__libc__common.dir/source/stdlib/abort.c.obj
    [122/235] Linking C static library zephyr\arch\common\libisr_tables.a
    [123/235] Building C object zephyr/lib/libc/newlib/CMakeFiles/lib__libc__newlib.dir/libc-hooks.c.obj
    [124/235] Linking C static library zephyr\arch\arch\arm\core\aarch32\cortex_m\libarch__arm__core__aarch32__cortex_m.a
    [125/235] Building C object zephyr/lib/smf/CMakeFiles/lib__smf.dir/smf.c.obj
    [126/235] Building C object zephyr/subsys/random/CMakeFiles/subsys__random.dir/rand32_xoshiro128.c.obj
    [127/235] Building C object zephyr/soc/soc/arm/nordic_nrf/nrf52/CMakeFiles/soc__arm__nordic_nrf__nrf52.dir/soc.c.obj
    [128/235] Linking C static library zephyr\arch\arch\arm\core\aarch32\libarch__arm__core__aarch32.a
    [129/235] Linking C static library zephyr\lib\libc\common\liblib__libc__common.a
    [130/235] Linking C static library zephyr\arch\arch\arm\core\aarch32\mpu\libarch__arm__core__aarch32__mpu.a
    [131/235] Linking C static library zephyr\soc\soc\arm\common\cortex_m\libsoc__arm__common__cortex_m.a
    [132/235] Linking C static library zephyr\arch\common\libarch__common.a
    [133/235] Building C object zephyr/subsys/bluetooth/common/CMakeFiles/subsys__bluetooth__common.dir/addr.c.obj
    [134/235] Linking C static library zephyr\lib\smf\liblib__smf.a
    [135/235] Linking C static library zephyr\lib\libc\newlib\liblib__libc__newlib.a
    [136/235] Building C object zephyr/subsys/random/CMakeFiles/subsys__random.dir/rand32_entropy_device.c.obj
    [137/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/uuid.c.obj
    [138/235] Linking C static library zephyr\soc\soc\arm\nordic_nrf\nrf52\libsoc__arm__nordic_nrf__nrf52.a
    [139/235] Building C object zephyr/subsys/bluetooth/common/CMakeFiles/subsys__bluetooth__common.dir/dummy.c.obj
    [140/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/addr.c.obj
    [141/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/long_wq.c.obj
    [142/235] Building C object zephyr/subsys/bluetooth/common/CMakeFiles/subsys__bluetooth__common.dir/bt_str.c.obj
    [143/235] Linking C static library zephyr\subsys\random\libsubsys__random.a
    [144/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/data.c.obj
    [145/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/settings.c.obj
    [146/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/buf.c.obj
    [147/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/hci_common.c.obj
    [148/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/l2cap.c.obj
    [149/235] Linking C static library zephyr\subsys\bluetooth\common\libsubsys__bluetooth__common.a
    [150/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/id.c.obj
    [151/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/smp_null.c.obj
    [152/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/adv.c.obj
    [153/235] Building C object zephyr/subsys/net/CMakeFiles/subsys__net.dir/buf_simple.c.obj
    [154/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/hci_core.c.obj
    [155/235] Building C object zephyr/drivers/adc/CMakeFiles/drivers__adc.dir/adc_common.c.obj
    [156/235] Building C object zephyr/drivers/console/CMakeFiles/drivers__console.dir/uart_console.c.obj
    [157/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/conn.c.obj
    [158/235] Building C object zephyr/drivers/adc/CMakeFiles/drivers__adc.dir/adc_nrfx_saadc.c.obj
    [159/235] Building C object zephyr/subsys/net/CMakeFiles/subsys__net.dir/buf.c.obj
    [160/235] Building C object zephyr/drivers/clock_control/CMakeFiles/drivers__clock_control.dir/clock_control_nrf.c.obj
    [161/235] Building C object zephyr/drivers/entropy/CMakeFiles/drivers__entropy.dir/entropy_nrf5.c.obj
    [162/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/att.c.obj
    [163/235] Building C object zephyr/drivers/entropy/CMakeFiles/drivers__entropy.dir/entropy_bt_hci.c.obj
    [164/235] Building C object modules/nrf/drivers/mpsl/clock_control/CMakeFiles/..__nrf__drivers__mpsl__clock_control.dir/nrfx_clock_mpsl.c.obj
    [165/235] Linking C static library zephyr\drivers\adc\libdrivers__adc.a
    [166/235] Linking C static library zephyr\drivers\clock_control\libdrivers__clock_control.a
    [167/235] Linking C static library zephyr\drivers\console\libdrivers__console.a
    [168/235] Linking C static library zephyr\subsys\net\libsubsys__net.a
    [169/235] Building C object zephyr/drivers/entropy/CMakeFiles/drivers__entropy.dir/C_/Users/LPC-008/my-workspace/nrf/drivers/entropy/entropy_cc3xx.c.obj
    [170/235] Building C object zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/flash_page_layout.c.obj
    [171/235] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/gatt.c.obj
    [172/235] Building C object zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/soc_flash_nrf.c.obj
    [173/235] Linking C static library modules\nrf\drivers\mpsl\clock_control\lib..__nrf__drivers__mpsl__clock_control.a
    [174/235] Building C object zephyr/drivers/hwinfo/CMakeFiles/drivers__hwinfo.dir/hwinfo_weak_impl.c.obj
    [175/235] Building C object zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/jesd216.c.obj
    [176/235] Linking C static library zephyr\drivers\entropy\libdrivers__entropy.a
    [177/235] Building C object zephyr/drivers/pinctrl/CMakeFiles/drivers__pinctrl.dir/common.c.obj
    [178/235] Building C object zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/nrf_qspi_nor.c.obj
    [179/235] Building C object zephyr/drivers/hwinfo/CMakeFiles/drivers__hwinfo.dir/hwinfo_nrf.c.obj
    [180/235] Building C object zephyr/drivers/pinctrl/CMakeFiles/drivers__pinctrl.dir/pinctrl_nrf.c.obj
    [181/235] Linking C static library zephyr\subsys\bluetooth\host\libsubsys__bluetooth__host.a
    [182/235] Building C object zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_nrfx.c.obj
    [183/235] Building C object zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj
    [184/235] Linking C static library zephyr\drivers\hwinfo\libdrivers__hwinfo.a
    [185/235] Linking C static library zephyr\drivers\pinctrl\libdrivers__pinctrl.a
    [186/235] Building C object zephyr/drivers/timer/CMakeFiles/drivers__timer.dir/sys_clock_init.c.obj
    [187/235] Linking C static library zephyr\drivers\flash\libdrivers__flash.a
    [188/235] Linking C static library zephyr\drivers\gpio\libdrivers__gpio.a
    [189/235] Building C object zephyr/drivers/timer/CMakeFiles/drivers__timer.dir/nrf_rtc_timer.c.obj
    [190/235] Linking C static library zephyr\drivers\serial\libdrivers__serial.a
    [191/235] Building C object zephyr/drivers/spi/CMakeFiles/drivers__spi.dir/spi_nrfx_spi.c.obj
    [192/235] Building C object zephyr/drivers/spi/CMakeFiles/drivers__spi.dir/spi_nrfx_spim.c.obj
    [193/235] Building C object modules/nrf/lib/multithreading_lock/CMakeFiles/..__nrf__lib__multithreading_lock.dir/multithreading_lock.c.obj
    [194/235] Building C object modules/nrf/lib/fatal_error/CMakeFiles/..__nrf__lib__fatal_error.dir/fatal_error.c.obj
    [195/235] Building C object zephyr/drivers/spi/CMakeFiles/drivers__spi.dir/spi_nrfx_common.c.obj
    [196/235] Building C object modules/nrf/subsys/bluetooth/controller/CMakeFiles/..__nrf__subsys__bluetooth__controller.dir/ecdh.c.obj
    [197/235] Building C object modules/nrf/subsys/mpsl/fem/CMakeFiles/..__nrf__subsys__mpsl__fem.dir/api_init/mpsl_fem_api_init.c.obj
    [198/235] Linking C static library zephyr\drivers\timer\libdrivers__timer.a
    [199/235] Building C object modules/nrf/subsys/bluetooth/controller/CMakeFiles/..__nrf__subsys__bluetooth__controller.dir/hci_driver.c.obj
    [200/235] Building C object modules/nrf/subsys/bluetooth/controller/CMakeFiles/..__nrf__subsys__bluetooth__controller.dir/crypto.c.obj
    [201/235] Linking C static library modules\nrf\lib\fatal_error\lib..__nrf__lib__fatal_error.a
    [202/235] Building C object modules/nrf/subsys/bluetooth/controller/CMakeFiles/..__nrf__subsys__bluetooth__controller.dir/hci_internal.c.obj
    [203/235] Linking C static library modules\nrf\lib\multithreading_lock\lib..__nrf__lib__multithreading_lock.a
    [204/235] Building C object modules/nrf/subsys/mpsl/init/CMakeFiles/..__nrf__subsys__mpsl__init.dir/mpsl_init.c.obj
    [205/235] Linking C static library zephyr\drivers\spi\libdrivers__spi.a
    [206/235] Linking C static library modules\nrf\subsys\mpsl\fem\lib..__nrf__subsys__mpsl__fem.a
    [207/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/mdk/system_nrf52840.c.obj
    [208/235] Building C object modules/nrf/drivers/mpsl/temp_nrf5/CMakeFiles/..__nrf__drivers__mpsl__temp_nrf5.dir/temp_nrf5_mpsl.c.obj
    [209/235] Building C object modules/nrf/drivers/hw_cc3xx/CMakeFiles/..__nrf__drivers__hw_cc3xx.dir/hw_cc3xx.c.obj
    [210/235] Building C object modules/nrf/drivers/mpsl/flash_sync/CMakeFiles/..__nrf__drivers__mpsl__flash_sync.dir/flash_sync_mpsl.c.obj
    [211/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/helpers/nrfx_gppi_ppi.c.obj
    [212/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/helpers/nrfx_flag32_allocator.c.obj
    [213/235] Linking C static library modules\nrf\subsys\mpsl\init\lib..__nrf__subsys__mpsl__init.a
    [214/235] Linking C static library modules\nrf\subsys\bluetooth\controller\lib..__nrf__subsys__bluetooth__controller.a
    [215/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/nrfx_glue.c.obj
    [216/235] Linking C static library modules\nrf\drivers\hw_cc3xx\lib..__nrf__drivers__hw_cc3xx.a
    [217/235] Linking C static library modules\nrf\drivers\mpsl\flash_sync\lib..__nrf__drivers__mpsl__flash_sync.a
    [218/235] Linking C static library modules\nrf\drivers\mpsl\temp_nrf5\lib..__nrf__drivers__mpsl__temp_nrf5.a
    [219/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/drivers/src/nrfx_nvmc.c.obj
    [220/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/drivers/src/nrfx_ppi.c.obj
    [221/235] Building C object modules/segger/CMakeFiles/modules__segger.dir/SEGGER_RTT_zephyr.c.obj
    [222/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/drivers/src/nrfx_qspi.c.obj
    [223/235] Building C object modules/segger/CMakeFiles/modules__segger.dir/C_/Users/LPC-008/my-workspace/modules/debug/segger/SEGGER/SEGGER_RTT.c.obj
    [224/235] Linking C static library modules\segger\libmodules__segger.a
    [225/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/drivers/src/nrfx_spi.c.obj
    [226/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/drivers/src/nrfx_spim.c.obj
    [227/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/drivers/src/nrfx_uarte.c.obj
    [228/235] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/Users/LPC-008/my-workspace/modules/hal/nordic/nrfx/drivers/src/nrfx_gpiote.c.obj
    [229/235] Linking C static library modules\hal_nordic\nrfx\libmodules__hal_nordic__nrfx.a
    [230/235] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\Users\LPC-008\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\Users\LPC-008\my-workspace\eqs-motion-s-zephyr.git\app\build_1\zephyr && C:\Users\LPC-008\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
    c:/users/lpc-008/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj): in function `main':
    C:\Users\LPC-008\my-workspace\eqs-motion-s-zephyr.git\app\src\main.c:9: undefined reference to `pm_state_force'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Users\LPC-008\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Users\LPC-008\my-workspace\eqs-motion-s-zephyr.git\app\build_1'


  • Im getting the same issue with fresh install of v2.5.

    I check and toolchain and SDK are set to v2.5

     warning: implicit declaration of function 'pm_state_force' [-Wimplicit-function-declaration]

    and as a bonus Im getting

    warning: return type of 'main' is not 'int' [-Wmain]

    also 

    C:\ncs\v2.5.0\zephyr\include\zephyr\init.h:193:44: warning: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(const struct device *)' [-Wincompatible-pointer-types]
    193 | .init_fn = {.sys = (init_fn_)}, \
    | ^
    C:\ncs\v2.5.0\zephyr\include\zephyr\init.h:174:9: note: in expansion of macro 'SYS_INIT_NAMED'
    174 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
    | ^~~~~~~~~~~~~~

    C:\ncs\v2.5.0\zephyr\include\zephyr\init.h:193:44: note: (near initialization for '__init_battery_setup.init_fn.sys')
    193 | .init_fn = {.sys = (init_fn_)}, \
    | ^
    C:\ncs\v2.5.0\zephyr\include\zephyr\init.h:174:9: note: in expansion of macro 'SYS_INIT_NAMED'
    174 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
    | ^~~~~~~~~~~~~~

  • I see. Have you made any changes in the SDK itself, or is it unmodified SDK 2.5.0? And are you able to build and run sample applications? If not, can you try to download the SDK and toolchain separately from VS Code (as explained here) and see if it works also with your app then?

    If your application does not work, but samples do, then perhaps there is an issue with the application or project itself and not the SDK or toolchain install. Perhaps you are missing #include <zephyr/pm/pm.h>? Or perhaps missing CONFIG_PM=y in your prj.conf?

  • no, just installed it.

    I had 2.3 up to now and chose to do a fresh install. uninstalled 2.3, installed 2.5

    Everything worked in 2.3, nothing changed. 

  • In my case I changed from pm_state_force to sys_poweroff with SDK version 2.5.0 as I used it to make the device go in low power mode.

Reply Children
No Data
Related