[stm32f429i-discovery] Replaced the ctrl-c handler in console for a shorter version.
Thanks to ChuckM for that.
This commit is contained in:
@@ -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" */
|
||||
|
||||
@@ -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" */
|
||||
|
||||
@@ -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" */
|
||||
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.
|
||||
/*
|
||||
* This bit of code will jump to the ResetHandler if you
|
||||
* hit ^C
|
||||
*/
|
||||
volatile uint32_t *ret = (®) + 7;
|
||||
|
||||
*ret = (uint32_t) &reset_handler;
|
||||
return;
|
||||
if (recv_buf[recv_ndx_nxt] == '\003') {
|
||||
scb_reset_system();
|
||||
return; /* never actually reached */
|
||||
}
|
||||
#endif
|
||||
/* Check for "overrun" */
|
||||
|
||||
Reference in New Issue
Block a user