File tree Expand file tree Collapse file tree 3 files changed +17
-31
lines changed
examples/stm32/f4/stm32f429i-discovery Expand file tree Collapse file tree 3 files changed +17
-31
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,13 @@ void usart1_isr(void)
67
67
if (reg & USART_SR_RXNE ) {
68
68
recv_buf [recv_ndx_nxt ] = USART_DR (CONSOLE_UART );
69
69
#ifdef RESET_ON_CTRLC
70
- /* Check for "reset" */
70
+ /*
71
+ * This bit of code will jump to the ResetHandler if you
72
+ * hit ^C
73
+ */
71
74
if (recv_buf [recv_ndx_nxt ] == '\003' ) {
72
- /* reset the system */
73
75
scb_reset_system ();
74
- return ; /* not reached */
76
+ return ; /* never actually reached */
75
77
}
76
78
#endif
77
79
/* Check for "overrun" */
Original file line number Diff line number Diff line change @@ -79,16 +79,13 @@ void usart1_isr(void)
79
79
if (reg & USART_SR_RXNE ) {
80
80
recv_buf [recv_ndx_nxt ] = USART_DR (CONSOLE_UART );
81
81
#ifdef RESET_ON_CTRLC
82
- /* Check for "reset" */
82
+ /*
83
+ * This bit of code will jump to the ResetHandler if you
84
+ * hit ^C
85
+ */
83
86
if (recv_buf [recv_ndx_nxt ] == '\003' ) {
84
- /* reset the system */
85
- /* Return address on stack */
86
- volatile uint32_t * ret = (& reg ) + 7 ;
87
-
88
- /* force system reset */
89
- * ret = (uint32_t ) & reset_handler ;
90
- /* go to new address */
91
- return ;
87
+ scb_reset_system ();
88
+ return ; /* never actually reached */
92
89
}
93
90
#endif
94
91
/* Check for "overrun" */
Original file line number Diff line number Diff line change @@ -67,26 +67,13 @@ void usart1_isr(void)
67
67
if (reg & USART_SR_RXNE ) {
68
68
recv_buf [recv_ndx_nxt ] = USART_DR (CONSOLE_UART );
69
69
#ifdef RESET_ON_CTRLC
70
- /* Check for "reset" */
70
+ /*
71
+ * This bit of code will jump to the ResetHandler if you
72
+ * hit ^C
73
+ */
71
74
if (recv_buf [recv_ndx_nxt ] == '\003' ) {
72
- /* reset the system volatile definition of
73
- * return address on the stack to insure it
74
- * gets stored, changed to point to the
75
- * trampoline function (do_the_nasty) which is
76
- * required because we need to return of an
77
- * interrupt to get the internal value of the
78
- * LR register reset and put the processor back
79
- * into "Thread" mode from "Handler" mode.
80
- *
81
- * See the PM0214 Programming Manual for Cortex
82
- * M, pg 42, to see the format of the Cortex M4
83
- * stack after an interrupt or exception has
84
- * occurred.
85
- */
86
- volatile uint32_t * ret = (& reg ) + 7 ;
87
-
88
- * ret = (uint32_t ) & reset_handler ;
89
- return ;
75
+ scb_reset_system ();
76
+ return ; /* never actually reached */
90
77
}
91
78
#endif
92
79
/* Check for "overrun" */
You can’t perform that action at this time.
0 commit comments