diff --git a/cc3200/hal/startup_gcc.c b/cc3200/hal/startup_gcc.c index 30831eb889..ecae05bdc5 100644 --- a/cc3200/hal/startup_gcc.c +++ b/cc3200/hal/startup_gcc.c @@ -61,11 +61,13 @@ extern uint32_t __init_data; // //***************************************************************************** void ResetISR(void); +#ifdef DEBUG static void NmiSR(void) __attribute__( ( naked ) ); static void FaultISR( void ) __attribute__( ( naked ) ); -static void IntDefaultHandler(void) __attribute__( ( naked ) ); -static void BusFaultHandler(void) __attribute__( ( naked ) ); void HardFault_HandlerC(unsigned long *hardfault_args); +static void BusFaultHandler(void) __attribute__( ( naked ) ); +#endif +static void IntDefaultHandler(void) __attribute__( ( naked ) ); //***************************************************************************** // @@ -96,10 +98,19 @@ void (* const g_pfnVectors[256])(void) = { (void (*)(void))((uint32_t)&_estack), // The initial stack pointer ResetISR, // The reset handler +#ifdef DEBUG NmiSR, // The NMI handler FaultISR, // The hard fault handler +#else + IntDefaultHandler, // The NMI handler + IntDefaultHandler, // The hard fault handler +#endif IntDefaultHandler, // The MPU fault handler +#ifdef DEBUG BusFaultHandler, // The bus fault handler +#else + IntDefaultHandler, // The bus fault handler +#endif IntDefaultHandler, // The usage fault handler 0, // Reserved 0, // Reserved @@ -263,6 +274,7 @@ void ResetISR(void) main(); } +#ifdef DEBUG //***************************************************************************** // // This is the code that gets called when the processor receives a NMI. This @@ -273,10 +285,8 @@ void ResetISR(void) static void NmiSR(void) { -#ifdef DEBUG // Break into the debugger __asm volatile ("bkpt #0 \n"); -#endif // // Enter an infinite loop. @@ -316,55 +326,9 @@ static void FaultISR(void) ) ; } -//***************************************************************************** -// -// This is the code that gets called when the processor receives an unexpected -// interrupt. This simply enters an infinite loop, preserving the system state -// for examination by a debugger. -// -//***************************************************************************** - -static void BusFaultHandler(void) -{ -#ifdef DEBUG - // Break into the debugger - __asm volatile ("bkpt #0 \n"); -#endif - - // - // Enter an infinite loop. - // - for ( ; ; ) - { - } -} - -//***************************************************************************** -// -// This is the code that gets called when the processor receives an unexpected -// interrupt. This simply enters an infinite loop, preserving the system state -// for examination by a debugger. -// -//***************************************************************************** -static void IntDefaultHandler(void) -{ -#ifdef DEBUG - // Break into the debugger - __asm volatile ("bkpt #0 \n"); -#endif - - // - // Enter an infinite loop. - // - for ( ; ; ) - { - } -} - - //*********************************************************************************** // HardFaultHandler_C: -// This is called from the HardFault_HandlerAsm with a pointer the Fault stack +// This is called from the FaultISR with a pointer the Fault stack // as the parameter. We can then read the values from the stack and place them // into local variables for ease of reading. // We then read the various Fault Status and Address Registers to help decode @@ -403,10 +367,8 @@ void HardFault_HandlerC(uint32_t *pulFaultStackAddress) // Bus Fault Address Register _BFAR = (*((volatile uint32_t *)(0xE000ED38))); -#ifdef DEBUG // Break into the debugger __asm volatile ("bkpt #0 \n"); -#endif for ( ; ; ) { @@ -416,3 +378,47 @@ void HardFault_HandlerC(uint32_t *pulFaultStackAddress) } } +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** + +static void BusFaultHandler(void) +{ + // Break into the debugger + __asm volatile ("bkpt #0 \n"); + + // + // Enter an infinite loop. + // + for ( ; ; ) + { + } +} +#endif + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void IntDefaultHandler(void) +{ +#ifdef DEBUG + // Break into the debugger + __asm volatile ("bkpt #0 \n"); +#endif + + // + // Enter an infinite loop. + // + for ( ; ; ) + { + } +} +