Skip to content

Commit 2bba8a6

Browse files
authored
Set SYSRESETREQ repeatedly on M55+M85+M52 (#214)
Fixes #195
1 parent 6a0e36d commit 2bba8a6

File tree

3 files changed

+33
-27
lines changed

3 files changed

+33
-27
lines changed

CMSIS/Core/Include/core_cm52.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4125,16 +4125,18 @@ __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
41254125
*/
41264126
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
41274127
{
4128-
__DSB(); /* Ensure all outstanding memory accesses included
4129-
buffered write are completed before reset */
4130-
SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
4131-
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
4132-
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
4133-
__DSB(); /* Ensure completion of memory access */
4134-
4135-
for(;;) /* wait until reset */
4128+
/* SYSRESETREQ needs to be set repeatedly as it is cleared as soon as the CPU's P-channel
4129+
* enters WARM_RST state, but another device can deny the transition preventing the
4130+
* actual reset. Such denials are usually transient - we need to re-assert SYSRESETREQ
4131+
* to retry.
4132+
*/
4133+
for(;;)
41364134
{
4137-
__NOP();
4135+
__DSB(); /* Ensure all outstanding memory accesses included
4136+
buffered write are completed before reset */
4137+
SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
4138+
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
4139+
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
41384140
}
41394141
}
41404142

CMSIS/Core/Include/core_cm55.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4238,16 +4238,18 @@ __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
42384238
*/
42394239
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
42404240
{
4241-
__DSB(); /* Ensure all outstanding memory accesses included
4242-
buffered write are completed before reset */
4243-
SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
4244-
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
4245-
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
4246-
__DSB(); /* Ensure completion of memory access */
4247-
4248-
for(;;) /* wait until reset */
4241+
/* SYSRESETREQ needs to be set repeatedly as it is cleared as soon as the CPU's P-channel
4242+
* enters WARM_RST state, but another device can deny the transition preventing the
4243+
* actual reset. Such denials are usually transient - we need to re-assert SYSRESETREQ
4244+
* to retry.
4245+
*/
4246+
for(;;)
42494247
{
4250-
__NOP();
4248+
__DSB(); /* Ensure all outstanding memory accesses included
4249+
buffered write are completed before reset */
4250+
SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
4251+
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
4252+
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
42514253
}
42524254
}
42534255

CMSIS/Core/Include/core_cm85.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4262,16 +4262,18 @@ __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
42624262
*/
42634263
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
42644264
{
4265-
__DSB(); /* Ensure all outstanding memory accesses included
4266-
buffered write are completed before reset */
4267-
SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
4268-
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
4269-
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
4270-
__DSB(); /* Ensure completion of memory access */
4271-
4272-
for(;;) /* wait until reset */
4265+
/* SYSRESETREQ needs to be set repeatedly as it is cleared as soon as the CPU's P-channel
4266+
* enters WARM_RST state, but another device can deny the transition preventing the
4267+
* actual reset. Such denials are usually transient - we need to re-assert SYSRESETREQ
4268+
* to retry.
4269+
*/
4270+
for(;;)
42734271
{
4274-
__NOP();
4272+
__DSB(); /* Ensure all outstanding memory accesses included
4273+
buffered write are completed before reset */
4274+
SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
4275+
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
4276+
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
42754277
}
42764278
}
42774279

0 commit comments

Comments
 (0)