You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2022/02/01 00:08:50 UTC
[mynewt-core] branch master updated (ac593bb -> 7bea0ed)
This is an automated email from the ASF dual-hosted git repository.
wes3 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.
from ac593bb Update mailmap
new 24398ce hal: Modify hal_system_restart
new 7bea0ed hal: Modify hal_system_restart
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
hw/mcu/dialog/da1469x/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf51xxx/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf52xxx/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf5340/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf5340_net/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf91xx/src/hal_system_start.c | 15 ++++++++++-----
6 files changed, 60 insertions(+), 30 deletions(-)
[mynewt-core] 01/02: hal: Modify hal_system_restart
Posted by we...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
wes3 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 24398ce000466f9de64563d5817ac75e8d89bec1
Author: Will San Filippo <wi...@juul.com>
AuthorDate: Wed Jan 26 13:45:30 2022 -0800
hal: Modify hal_system_restart
Two changes to the code: clear ICPR register (to
clear any pending interrupts) and also leave global
interrupts enabled when calling hal_system_start.
The idea behind this change is that the cortex-M
has global interrupts enabled on reset and that
this should be the state when the system is
restarted.
---
hw/mcu/dialog/da1469x/src/hal_system_start.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/mcu/dialog/da1469x/src/hal_system_start.c b/hw/mcu/dialog/da1469x/src/hal_system_start.c
index 2445f9c..1937a7d 100644
--- a/hw/mcu/dialog/da1469x/src/hal_system_start.c
+++ b/hw/mcu/dialog/da1469x/src/hal_system_start.c
@@ -62,19 +62,24 @@ hal_system_start(void *img_start)
void
hal_system_restart(void *img_start)
{
- uint32_t primask __attribute__((unused));
int i;
/*
- * Disable interrupts, and leave them disabled.
- * They get re-enabled when system starts coming back again.
+ * NOTE: on reset, PRIMASK should have global interrupts enabled so
+ * the code disables interrupts, clears the interrupt enable bits,
+ * clears any pending interrupts, then enables global interrupts
+ * so processor looks like state it would be in if it reset.
*/
- __HAL_DISABLE_INTERRUPTS(primask);
-
+ __disable_irq();
for (i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++) {
NVIC->ICER[i] = 0xffffffff;
}
+ for (i = 0; i < sizeof(NVIC->ICPR) / sizeof(NVIC->ICPR[0]); i++) {
+ NVIC->ICPR[i] = 0xffffffff;
+ }
+ __enable_irq();
+
hal_system_start(img_start);
}
[mynewt-core] 02/02: hal: Modify hal_system_restart
Posted by we...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
wes3 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 7bea0ed29a1514f8ddaf1d8460b6d2a7cb0eac59
Author: Will San Filippo <wi...@juul.com>
AuthorDate: Mon Jan 31 10:32:06 2022 -0800
hal: Modify hal_system_restart
Two changes to the code: clear ICPR register (to
clear any pending interrupts) and also leave global
interrupts enabled when calling hal_system_start.
The idea behind this change is that the cortex-M
has global interrupts enabled on reset and that
this should be the state when the system is
restarted.
---
hw/mcu/nordic/nrf51xxx/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf52xxx/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf5340/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf5340_net/src/hal_system_start.c | 15 ++++++++++-----
hw/mcu/nordic/nrf91xx/src/hal_system_start.c | 15 ++++++++++-----
5 files changed, 50 insertions(+), 25 deletions(-)
diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_system_start.c b/hw/mcu/nordic/nrf51xxx/src/hal_system_start.c
index d4581fe..93e0a7e 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_system_start.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_system_start.c
@@ -52,17 +52,22 @@ void
hal_system_restart(void *img_start)
{
int i;
- int sr;
/*
- * Disable interrupts, and leave the disabled.
- * They get re-enabled when system starts coming back again.
+ * NOTE: on reset, PRIMASK should have global interrupts enabled so
+ * the code disables interrupts, clears the interrupt enable bits,
+ * clears any pending interrupts, then enables global interrupts
+ * so processor looks like state it would be in if it reset.
*/
- __HAL_DISABLE_INTERRUPTS(sr);
+ __disable_irq();
for (i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++) {
NVIC->ICER[i] = 0xffffffff;
}
- (void)sr;
+
+ for (i = 0; i < sizeof(NVIC->ICPR) / sizeof(NVIC->ICPR[0]); i++) {
+ NVIC->ICPR[i] = 0xffffffff;
+ }
+ __enable_irq();
hal_system_start(img_start);
}
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_system_start.c b/hw/mcu/nordic/nrf52xxx/src/hal_system_start.c
index 123353f..25e35b1 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_system_start.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_system_start.c
@@ -52,17 +52,22 @@ void
hal_system_restart(void *img_start)
{
int i;
- int sr;
/*
- * Disable interrupts, and leave the disabled.
- * They get re-enabled when system starts coming back again.
+ * NOTE: on reset, PRIMASK should have global interrupts enabled so
+ * the code disables interrupts, clears the interrupt enable bits,
+ * clears any pending interrupts, then enables global interrupts
+ * so processor looks like state it would be in if it reset.
*/
- __HAL_DISABLE_INTERRUPTS(sr);
+ __disable_irq();
for (i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++) {
NVIC->ICER[i] = 0xffffffff;
}
- (void)sr;
+
+ for (i = 0; i < sizeof(NVIC->ICPR) / sizeof(NVIC->ICPR[0]); i++) {
+ NVIC->ICPR[i] = 0xffffffff;
+ }
+ __enable_irq();
hal_system_start(img_start);
}
diff --git a/hw/mcu/nordic/nrf5340/src/hal_system_start.c b/hw/mcu/nordic/nrf5340/src/hal_system_start.c
index 89f3f51..ecb3cf1 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_system_start.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_system_start.c
@@ -193,17 +193,22 @@ void
hal_system_restart(void *img_start)
{
int i;
- int sr;
/*
- * Disable interrupts, and leave the disabled.
- * They get re-enabled when system starts coming back again.
+ * NOTE: on reset, PRIMASK should have global interrupts enabled so
+ * the code disables interrupts, clears the interrupt enable bits,
+ * clears any pending interrupts, then enables global interrupts
+ * so processor looks like state it would be in if it reset.
*/
- __HAL_DISABLE_INTERRUPTS(sr);
+ __disable_irq();
for (i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++) {
NVIC->ICER[i] = 0xffffffff;
}
- (void)sr;
+
+ for (i = 0; i < sizeof(NVIC->ICPR) / sizeof(NVIC->ICPR[0]); i++) {
+ NVIC->ICPR[i] = 0xffffffff;
+ }
+ __enable_irq();
hal_system_start(img_start);
}
diff --git a/hw/mcu/nordic/nrf5340_net/src/hal_system_start.c b/hw/mcu/nordic/nrf5340_net/src/hal_system_start.c
index a1dc5e0..f34f0f6 100644
--- a/hw/mcu/nordic/nrf5340_net/src/hal_system_start.c
+++ b/hw/mcu/nordic/nrf5340_net/src/hal_system_start.c
@@ -52,17 +52,22 @@ void
hal_system_restart(void *img_start)
{
int i;
- int sr;
/*
- * Disable interrupts, and leave the disabled.
- * They get re-enabled when system starts coming back again.
+ * NOTE: on reset, PRIMASK should have global interrupts enabled so
+ * the code disables interrupts, clears the interrupt enable bits,
+ * clears any pending interrupts, then enables global interrupts
+ * so processor looks like state it would be in if it reset.
*/
- __HAL_DISABLE_INTERRUPTS(sr);
+ __disable_irq();
for (i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++) {
NVIC->ICER[i] = 0xffffffff;
}
- (void)sr;
+
+ for (i = 0; i < sizeof(NVIC->ICPR) / sizeof(NVIC->ICPR[0]); i++) {
+ NVIC->ICPR[i] = 0xffffffff;
+ }
+ __enable_irq();
hal_system_start(img_start);
}
diff --git a/hw/mcu/nordic/nrf91xx/src/hal_system_start.c b/hw/mcu/nordic/nrf91xx/src/hal_system_start.c
index 43b4389..e8b86b7 100644
--- a/hw/mcu/nordic/nrf91xx/src/hal_system_start.c
+++ b/hw/mcu/nordic/nrf91xx/src/hal_system_start.c
@@ -52,17 +52,22 @@ void
hal_system_restart(void *img_start)
{
int i;
- int sr;
/*
- * Disable interrupts, and leave the disabled.
- * They get re-enabled when system starts coming back again.
+ * NOTE: on reset, PRIMASK should have global interrupts enabled so
+ * the code disables interrupts, clears the interrupt enable bits,
+ * clears any pending interrupts, then enables global interrupts
+ * so processor looks like state it would be in if it reset.
*/
- __HAL_DISABLE_INTERRUPTS(sr);
+ __disable_irq();
for (i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++) {
NVIC->ICER[i] = 0xffffffff;
}
- (void)sr;
+
+ for (i = 0; i < sizeof(NVIC->ICPR) / sizeof(NVIC->ICPR[0]); i++) {
+ NVIC->ICPR[i] = 0xffffffff;
+ }
+ __enable_irq();
hal_system_start(img_start);
}