I'm in the process of upgrading from V2.2.0 to V2.6.0 of NCS. Not surpringly, I'm having issues with building firmware that used to "just work". I've got another ticket open in regards to this, but have moved over to another set of my firmware that used to work in NCS V2.2.0, which now won't successfully build in V2.6.0 because its throwing up a bunch of CONFIG issues
In this firmware, I am impementing the low power SYSTEM_OFF mode.
In my proj.conf I have:
# Enable Power Management CONFIG_PM=y # Required to disable default behavior of deep sleep on timeout CONFIG_PM_DEVICE=y
This enables me to call:
pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0})
when I want to put the device into SYSTEM_OFF mode. Problem is, the CONFIG_PM=y isn't getting set, and instead I get this warning:
warning: PM (defined at soc/arm/silabs_exx32\efr32bg22\Kconfig.defconfig.series:18, soc/arm/silabs_exx32\efr32bg27\Kconfig.defconfig.series:18, soc/arm/silabs_exx32\efr32mg24\Kconfig.defconfig.series:19, soc/arm/st_stm32\stm32f4\Kconfig.defconfig.series:20, subsys/pm/Kconfig:13) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: ((SOC_SERIES_EFR32BG22 && SOC_FAMILY_EXX32) || (SOC_SERIES_EFR32BG27 && SOC_FAMILY_EXX32) || (SOC_SERIES_EFR32MG24 && SOC_FAMILY_EXX32) || SOC_SERIES_STM32F4X || (SYS_CLOCK_EXISTS && HAS_PM)) (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_PM and/or look up PM 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.
I've done a bit of digging, and it looks like in Zephyr 3.5.0 (I think NCS V2.6.0 uses Zephyr 3.5.99) they implemented some changes to how power management is enabled and invoked:

So, that looks like rather than needing to have CONFIG_PM=y in my proj.conf, I need to have CONFIG_POWEROFF=y. And then, rather than call pm_state_force(), I have to call sys_poweroff().
Problem is, I'm getting this warning when I attempt to build:
C:/Nordic/LPI/Release/LSR-MAX/src/reset/reset_mode.c:163:9: warning: implicit declaration of function 'sys_poweroff' [-Wimplicit-function-declaration]
163 | sys_poweroff();
| ^~~~~~~~~~~~
Previously, I had included:
#include <zephyr/init.h> #include <zephyr/pm/pm.h> #include <zephyr/pm/device.h>
but if I look in any of those, I can't see the new sys_poweroff() API, so there must be another header I need to include.
I'm also getting a bunch of build warnings around including the <zephyr/init.h> header file that I can't make sense of:
[7/41] Building C object CMakeFiles/app.dir/src/main.c.obj
In file included from C:/Nordic/LPI/Release/LSR-MAX/src/main.c:9:
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:208:63: warning: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(const struct device *)' [-Wincompatible-pointer-types]
208 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
| ^
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
190 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/Nordic/LPI/Release/LSR-MAX/src/main.c:171:1: note: in expansion of macro 'SYS_INIT'
171 | SYS_INIT(detect_wakeup_latch, PRE_KERNEL_2, 0);
| ^~~~~~~~
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:208:63: note: (near initialization for '__init_detect_wakeup_latch.init_fn.sys')
208 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
| ^
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
190 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/Nordic/LPI/Release/LSR-MAX/src/main.c:171:1: note: in expansion of macro 'SYS_INIT'
171 | SYS_INIT(detect_wakeup_latch, PRE_KERNEL_2, 0);
| ^~~~~~~~
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:208:63: warning: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(const struct device *)' [-Wincompatible-pointer-types]
208 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
| ^
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
190 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/Nordic/LPI/Release/LSR-MAX/src/main.c:172:1: note: in expansion of macro 'SYS_INIT'
172 | SYS_INIT(disable_ds_1, PRE_KERNEL_1, 0);
| ^~~~~~~~
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:208:63: note: (near initialization for '__init_disable_ds_1.init_fn.sys')
208 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}}
| ^
C:/Nordic/v2.6.0/zephyr/include/zephyr/init.h:190:9: note: in expansion of macro 'SYS_INIT_NAMED'
190 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/Nordic/LPI/Release/LSR-MAX/src/main.c:172:1: note: in expansion of macro 'SYS_INIT'
172 | SYS_INIT(disable_ds_1, PRE_KERNEL_1, 0);
| ^~~~~~~~
Making lots of "reverse progress" this week :-(
Anyone know what I need to do to fix this?
Regards,
Mike