Skip to content

_NVIC_SystemReset stuck in infinite loop when calling pm_reboot through shell after flashing with J-Link #13044

@tinstructor

Description

@tinstructor

For some curious reason, after flashing several openmote-b nodes with a J-Link programmer, trying to reboot said nodes via the shell "reboot" command causes those nodes to hang forever. I verified that the infinite for loop in cpu/cortexm_common/include/vendor/core_cm3.h is reached as it's supposed to while awaiting a reset. However, this reset actually never occurs, causing the node to hang forever. I also tested this with openmote-b nodes that where only ever flashed via USB and they work just fine. This issue persists even after disconnecting the J-Link programmer and, worse, after reflashing the node via USB. As such I suspect that flashing over J-Link writes to certain registers that are otherwise untouched when flashing over USB.

__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
{
  __DSB();                                                          /* Ensure all outstanding memory accesses included
                                                                       buffered write are completed before reset */
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
                            SCB_AIRCR_SYSRESETREQ_Msk    );         /* Keep priority group unchanged */
  __DSB();                                                          /* Ensure completion of memory access */

  for(;;)                                                           /* wait until reset */
  {
    /* this loop is called infinitely until reset, which never 
       happens and thus causes the node to hang forever */
    __NOP();
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: boardsArea: Board portsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions