Commit 02fda44a authored by danicampora's avatar danicampora
Browse files

cc3200: Combine and disable sections in startup_gcc.c to reduce size.

parent d226dd2f
...@@ -61,11 +61,13 @@ extern uint32_t __init_data; ...@@ -61,11 +61,13 @@ extern uint32_t __init_data;
// //
//***************************************************************************** //*****************************************************************************
void ResetISR(void); void ResetISR(void);
#ifdef DEBUG
static void NmiSR(void) __attribute__( ( naked ) ); static void NmiSR(void) __attribute__( ( naked ) );
static void FaultISR( 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); 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) = ...@@ -96,10 +98,19 @@ void (* const g_pfnVectors[256])(void) =
{ {
(void (*)(void))((uint32_t)&_estack), // The initial stack pointer (void (*)(void))((uint32_t)&_estack), // The initial stack pointer
ResetISR, // The reset handler ResetISR, // The reset handler
#ifdef DEBUG
NmiSR, // The NMI handler NmiSR, // The NMI handler
FaultISR, // The hard fault handler FaultISR, // The hard fault handler
#else
IntDefaultHandler, // The NMI handler
IntDefaultHandler, // The hard fault handler
#endif
IntDefaultHandler, // The MPU fault handler IntDefaultHandler, // The MPU fault handler
#ifdef DEBUG
BusFaultHandler, // The bus fault handler BusFaultHandler, // The bus fault handler
#else
IntDefaultHandler, // The bus fault handler
#endif
IntDefaultHandler, // The usage fault handler IntDefaultHandler, // The usage fault handler
0, // Reserved 0, // Reserved
0, // Reserved 0, // Reserved
...@@ -263,6 +274,7 @@ void ResetISR(void) ...@@ -263,6 +274,7 @@ void ResetISR(void)
main(); main();
} }
#ifdef DEBUG
//***************************************************************************** //*****************************************************************************
// //
// This is the code that gets called when the processor receives a NMI. This // This is the code that gets called when the processor receives a NMI. This
...@@ -273,10 +285,8 @@ void ResetISR(void) ...@@ -273,10 +285,8 @@ void ResetISR(void)
static void NmiSR(void) static void NmiSR(void)
{ {
#ifdef DEBUG
// Break into the debugger // Break into the debugger
__asm volatile ("bkpt #0 \n"); __asm volatile ("bkpt #0 \n");
#endif
// //
// Enter an infinite loop. // Enter an infinite loop.
...@@ -316,55 +326,9 @@ static void FaultISR(void) ...@@ -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: // 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 // as the parameter. We can then read the values from the stack and place them
// into local variables for ease of reading. // into local variables for ease of reading.
// We then read the various Fault Status and Address Registers to help decode // We then read the various Fault Status and Address Registers to help decode
...@@ -403,10 +367,8 @@ void HardFault_HandlerC(uint32_t *pulFaultStackAddress) ...@@ -403,10 +367,8 @@ void HardFault_HandlerC(uint32_t *pulFaultStackAddress)
// Bus Fault Address Register // Bus Fault Address Register
_BFAR = (*((volatile uint32_t *)(0xE000ED38))); _BFAR = (*((volatile uint32_t *)(0xE000ED38)));
#ifdef DEBUG
// Break into the debugger // Break into the debugger
__asm volatile ("bkpt #0 \n"); __asm volatile ("bkpt #0 \n");
#endif
for ( ; ; ) for ( ; ; )
{ {
...@@ -416,3 +378,47 @@ void HardFault_HandlerC(uint32_t *pulFaultStackAddress) ...@@ -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 ( ; ; )
{
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment