Skip to content

Commit 406aacb

Browse files
wearyzenadamkondraciuk
authored andcommitted
[nrf fromtree] arch: arm: fix: pm_s2ram with CONFIG_DEBUG_THREAD_INFO
What is the change? - Fixes #83660 allowing device to now enter suspend mode even if CONFIG_DEBUG_THREAD_INFO is enabled. Why is this needed? - z_sys_post_kernel was cleared as part of #d778d5c to "allow debuggers to display the correct thread state after the first 3 instructions have run". This is not required while resuming from suspend and it prevents the device from entering suspend so, move it out of resume path. Signed-off-by: Sudan Landge <[email protected]> (cherry picked from commit 743fe63)
1 parent 999e700 commit 406aacb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

arch/arm/core/cortex_m/reset.S

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,z_arm_reset)
6868
*/
6969
SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
7070

71-
#if defined(CONFIG_DEBUG_THREAD_INFO)
72-
/* Clear z_sys_post_kernel flag for RTOS aware debuggers */
73-
movs.n r0, #0
74-
ldr r1, =z_sys_post_kernel
75-
strb r0, [r1]
76-
#endif /* CONFIG_DEBUG_THREAD_INFO */
77-
7871
#if defined(CONFIG_INIT_ARCH_HW_AT_BOOT)
7972
/* Reset CONTROL register */
8073
movs.n r0, #0
@@ -93,6 +86,18 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
9386
bl arch_pm_s2ram_resume
9487
#endif /* CONFIG_PM_S2RAM */
9588

89+
/* Note: Make sure that variables like z_sys_post_kernel
90+
* are set after the call to arch_pm_s2ram_resume
91+
* to avoid any issues with suspend/resume path.
92+
* Refer issue #83660 for more details.
93+
*/
94+
#if defined(CONFIG_DEBUG_THREAD_INFO)
95+
/* Clear z_sys_post_kernel flag for RTOS aware debuggers */
96+
movs.n r0, #0
97+
ldr r1, =z_sys_post_kernel
98+
strb r0, [r1]
99+
#endif /* CONFIG_DEBUG_THREAD_INFO */
100+
96101
#if defined(CONFIG_SOC_RESET_HOOK)
97102
bl soc_reset_hook
98103
#endif

0 commit comments

Comments
 (0)