File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 12
12
#include <zephyr/devicetree.h>
13
13
#include <zephyr/storage/flash_map.h>
14
14
15
+ #include "bootutil/fault_injection_hardening.h"
16
+
17
+ #if DT_NODE_EXISTS (DT_NODELABEL (mcuboot_s2ram )) && \
18
+ DT_NODE_HAS_COMPAT (DT_NODELABEL (mcuboot_s2ram ), zephyr_memory_region )
19
+ /* Linker section name is given by `zephyr,memory-region` property of
20
+ * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`.
21
+ */
22
+ __attribute__((section (DT_PROP (DT_NODELABEL (mcuboot_s2ram ), zephyr_memory_region ))))
23
+ struct mcuboot_resume_s _mcuboot_resume ;
24
+ #else
25
+ #error "mcuboot resume support section not defined in dts"
26
+ #endif
27
+
15
28
int soc_s2ram_suspend (pm_s2ram_system_off_fn_t system_off )
16
29
{
17
30
(void )(system_off );
@@ -37,6 +50,15 @@ bool pm_s2ram_mark_check_and_clear(void)
37
50
return false;
38
51
}
39
52
53
+ /* S2RAM resume expected, do doublecheck */
54
+ if (_mcuboot_resume .magic == MCUBOOT_S2RAM_RESUME_MAGIC ) {
55
+ // clear magic to avoid accidental reuse
56
+ _mcuboot_resume .magic = 0 ;
57
+ } else {
58
+ // magic not valid, normal boot
59
+ goto resume_failed ;
60
+ }
61
+
40
62
// s2ram boot
41
63
struct arm_vector_table * vt ;
42
64
vt = (struct arm_vector_table * )(FIXED_PARTITION_OFFSET (slot0_partition ) + 0x800 );
@@ -56,9 +78,8 @@ bool pm_s2ram_mark_check_and_clear(void)
56
78
: "r0" , "r1" , "memory"
57
79
);
58
80
59
- while (1 )
60
- {
61
- }
81
+ resume_failed :
82
+ FIH_PANIC ;
62
83
63
84
return true;
64
85
}
You can’t perform that action at this time.
0 commit comments