In the library source file stm32f10x_nvic.c :
#define AIRCR_VECTKEY_MASK ((u32)0x05FA0000)
/*******************************************************************************
* Function Name : NVIC_GenerateSystemReset
* Description : Generates a system reset.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void NVIC_GenerateSystemReset(void)
{
SCB->AIRCR = AIRCR_VECTKEY_MASK | (u32)0x04;
}
or
ldr r0,=0xE000ED0C ; SCB AIRCR
ldr r1,=0x05FA0004
str r1, [r0, #0]
#define AIRCR_VECTKEY_MASK ((u32)0x05FA0000)
/*******************************************************************************
* Function Name : NVIC_GenerateSystemReset
* Description : Generates a system reset.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void NVIC_GenerateSystemReset(void)
{
SCB->AIRCR = AIRCR_VECTKEY_MASK | (u32)0x04;
}
or
ldr r0,=0xE000ED0C ; SCB AIRCR
ldr r1,=0x05FA0004
str r1, [r0, #0]
Other variant :
SystemReset PROC
EXPORT SystemReset
ldr r1, =0xE000ED0C ; NVIC Application Interrupt and Controller
ldr r0, =0x05FA0004 ; Magic
str r0, [r1, #0] ; Reset
self b self
bx lr
ENDP
Saw a function in core_cm3.h. Didn't use it though.
/* This function initiate a system reset request to reset the MCU. */
static __INLINE void NVIC_SystemReset(void)
{
__DSB(); /* Ensure all outstanding memory accesses included
buffered write are completed before reset */
SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */
__DSB(); /* Ensure completion of memory access */
while(1); /* wait until reset */
}
Комментариев нет:
Отправить комментарий