File tree 3 files changed +53
-0
lines changed
3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,22 @@ extern void z_arm_nmi_init(void);
47
47
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
48
48
LOG_MODULE_REGISTER (soc );
49
49
50
+ int soc_mcuboot_mode_set (uint8_t mode )
51
+ {
52
+ nrf_power_gpregret2_set (NRF_POWER , mode );
53
+
54
+ return 0 ;
55
+ }
56
+
57
+ uint8_t soc_mcuboot_mode_get (void )
58
+ {
59
+ uint8_t mode = nrf_power_gpregret2_get (NRF_POWER );
60
+
61
+ nrf_power_gpregret2_set (NRF_POWER , 0 );
62
+
63
+ return mode ;
64
+ }
65
+
50
66
/* Overrides the weak ARM implementation:
51
67
Set general purpose retention register and reboot */
52
68
void sys_arch_reboot (int type )
Original file line number Diff line number Diff line change 25
25
#include <hal/nrf_gpio.h>
26
26
#include <hal/nrf_oscillators.h>
27
27
#include <hal/nrf_regulators.h>
28
+ #include <hal/nrf_power.h>
28
29
#elif defined(CONFIG_SOC_NRF5340_CPUNET )
29
30
#include <hal/nrf_nvmc.h>
30
31
#endif
31
32
#include <soc_secure.h>
32
33
34
+
33
35
#define PIN_XL1 0
34
36
#define PIN_XL2 1
35
37
@@ -66,6 +68,24 @@ extern void z_arm_nmi_init(void);
66
68
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
67
69
LOG_MODULE_REGISTER (soc );
68
70
71
+ #if defined(CONFIG_SOC_NRF5340_CPUAPP )
72
+ int soc_mcuboot_mode_set (uint8_t mode )
73
+ {
74
+ nrf_power_gpregret2_set (NRF_POWER , mode );
75
+
76
+ return 0 ;
77
+ }
78
+
79
+ uint8_t soc_mcuboot_mode_get (void )
80
+ {
81
+ uint8_t mode = nrf_power_gpregret2_get (NRF_POWER );
82
+
83
+ nrf_power_gpregret2_set (NRF_POWER , 0 );
84
+
85
+ return mode ;
86
+ }
87
+ #endif
88
+
69
89
static int nordicsemi_nrf53_init (const struct device * arg )
70
90
{
71
91
uint32_t key ;
Original file line number Diff line number Diff line change 17
17
#include <arch/arm/aarch32/cortex_m/cmsis.h>
18
18
#include <soc/nrfx_coredep.h>
19
19
#include <logging/log.h>
20
+ #include <hal/nrf_power.h>
20
21
21
22
#ifdef CONFIG_RUNTIME_NMI
22
23
extern void z_arm_nmi_init (void );
@@ -34,6 +35,22 @@ extern void z_arm_nmi_init(void);
34
35
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
35
36
LOG_MODULE_REGISTER (soc );
36
37
38
+ int soc_mcuboot_mode_set (uint8_t mode )
39
+ {
40
+ nrf_power_gpregret_ext_set (NRF_POWER , 1 , mode );
41
+
42
+ return 0 ;
43
+ }
44
+
45
+ uint8_t soc_mcuboot_mode_set (void )
46
+ {
47
+ uint8_t mode = nrf_power_gpregret_ext_get (NRF_POWER , 1 );
48
+
49
+ nrf_power_gpregret_ext_set (NRF_POWER , 1 , 0 );
50
+
51
+ return mode ;
52
+ }
53
+
37
54
static int nordicsemi_nrf91_init (const struct device * arg )
38
55
{
39
56
uint32_t key ;
You can’t perform that action at this time.
0 commit comments