File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/li
12
12
zephyr_sources_ifdef (CONFIG_PM
13
13
power.c
14
14
)
15
+ zephyr_sources_ifdef (CONFIG_POWEROFF poweroff.c )
Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ config SOC_SERIES_STM32F4X
12
12
select CPU_HAS_ARM_MPU
13
13
select HAS_SWO
14
14
select HAS_PM
15
+ select HAS_POWEROFF
15
16
select SOC_EARLY_INIT_HOOK
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2023 Nordic Semiconductor ASA
3
+ * Copyright (c) 2024 STMicroelectronics
4
+ * Copyright (c) 2025 Tomas Jurena
5
+ *
6
+ * SPDX-License-Identifier: Apache-2.0
7
+ */
8
+
9
+ #include <zephyr/kernel.h>
10
+ #include <zephyr/sys/poweroff.h>
11
+ #include <zephyr/toolchain.h>
12
+ #include <zephyr/drivers/misc/stm32_wkup_pins/stm32_wkup_pins.h>
13
+
14
+ #include <stm32_ll_cortex.h>
15
+ #include <stm32_ll_pwr.h>
16
+
17
+ void z_sys_poweroff (void )
18
+ {
19
+ #ifdef CONFIG_STM32_WKUP_PINS
20
+ LL_PWR_ClearFlag_WU ();
21
+ #endif /* CONFIG_STM32_WKUP_PINS */
22
+
23
+ LL_PWR_SetPowerMode (LL_PWR_MODE_STANDBY );
24
+ LL_LPM_EnableDeepSleep ();
25
+
26
+ k_cpu_idle ();
27
+
28
+ CODE_UNREACHABLE ;
29
+ }
You can’t perform that action at this time.
0 commit comments