diff --git a/examples/stm32/f4/stm32f429i-discovery/lcd-serial/console.c b/examples/stm32/f4/stm32f429i-discovery/lcd-serial/console.c index df498dc..bde64be 100644 --- a/examples/stm32/f4/stm32f429i-discovery/lcd-serial/console.c +++ b/examples/stm32/f4/stm32f429i-discovery/lcd-serial/console.c @@ -67,11 +67,13 @@ void usart1_isr(void) if (reg & USART_SR_RXNE) { recv_buf[recv_ndx_nxt] = USART_DR(CONSOLE_UART); #ifdef RESET_ON_CTRLC - /* Check for "reset" */ + /* + * This bit of code will jump to the ResetHandler if you + * hit ^C + */ if (recv_buf[recv_ndx_nxt] == '\003') { - /* reset the system */ scb_reset_system(); - return; /* not reached */ + return; /* never actually reached */ } #endif /* Check for "overrun" */ diff --git a/examples/stm32/f4/stm32f429i-discovery/sdram/console.c b/examples/stm32/f4/stm32f429i-discovery/sdram/console.c index 089e08a..5ea0a93 100644 --- a/examples/stm32/f4/stm32f429i-discovery/sdram/console.c +++ b/examples/stm32/f4/stm32f429i-discovery/sdram/console.c @@ -79,16 +79,13 @@ void usart1_isr(void) if (reg & USART_SR_RXNE) { recv_buf[recv_ndx_nxt] = USART_DR(CONSOLE_UART); #ifdef RESET_ON_CTRLC - /* Check for "reset" */ + /* + * This bit of code will jump to the ResetHandler if you + * hit ^C + */ if (recv_buf[recv_ndx_nxt] == '\003') { - /* reset the system */ - /* Return address on stack */ - volatile uint32_t *ret = (®) + 7; - - /* force system reset */ - *ret = (uint32_t) &reset_handler; - /* go to new address */ - return; + scb_reset_system(); + return; /* never actually reached */ } #endif /* Check for "overrun" */ diff --git a/examples/stm32/f4/stm32f429i-discovery/spi/console.c b/examples/stm32/f4/stm32f429i-discovery/spi/console.c index 3553203..d733696 100644 --- a/examples/stm32/f4/stm32f429i-discovery/spi/console.c +++ b/examples/stm32/f4/stm32f429i-discovery/spi/console.c @@ -67,26 +67,13 @@ void usart1_isr(void) if (reg & USART_SR_RXNE) { recv_buf[recv_ndx_nxt] = USART_DR(CONSOLE_UART); #ifdef RESET_ON_CTRLC - /* Check for "reset" */ + /* + * This bit of code will jump to the ResetHandler if you + * hit ^C + */ if (recv_buf[recv_ndx_nxt] == '\003') { - /* reset the system volatile definition of - * return address on the stack to insure it - * gets stored, changed to point to the - * trampoline function (do_the_nasty) which is - * required because we need to return of an - * interrupt to get the internal value of the - * LR register reset and put the processor back - * into "Thread" mode from "Handler" mode. - * - * See the PM0214 Programming Manual for Cortex - * M, pg 42, to see the format of the Cortex M4 - * stack after an interrupt or exception has - * occurred. - */ - volatile uint32_t *ret = (®) + 7; - - *ret = (uint32_t) &reset_handler; - return; + scb_reset_system(); + return; /* never actually reached */ } #endif /* Check for "overrun" */