Skip to content

Commit 02fda44

Browse files
committed
cc3200: Combine and disable sections in startup_gcc.c to reduce size.
1 parent d226dd2 commit 02fda44

File tree

1 file changed

+59
-53
lines changed

1 file changed

+59
-53
lines changed

cc3200/hal/startup_gcc.c

Lines changed: 59 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ extern uint32_t __init_data;
6161
//
6262
//*****************************************************************************
6363
void ResetISR(void);
64+
#ifdef DEBUG
6465
static void NmiSR(void) __attribute__( ( naked ) );
6566
static void FaultISR( void ) __attribute__( ( naked ) );
66-
static void IntDefaultHandler(void) __attribute__( ( naked ) );
67-
static void BusFaultHandler(void) __attribute__( ( naked ) );
6867
void HardFault_HandlerC(unsigned long *hardfault_args);
68+
static void BusFaultHandler(void) __attribute__( ( naked ) );
69+
#endif
70+
static void IntDefaultHandler(void) __attribute__( ( naked ) );
6971

7072
//*****************************************************************************
7173
//
@@ -96,10 +98,19 @@ void (* const g_pfnVectors[256])(void) =
9698
{
9799
(void (*)(void))((uint32_t)&_estack), // The initial stack pointer
98100
ResetISR, // The reset handler
101+
#ifdef DEBUG
99102
NmiSR, // The NMI handler
100103
FaultISR, // The hard fault handler
104+
#else
105+
IntDefaultHandler, // The NMI handler
106+
IntDefaultHandler, // The hard fault handler
107+
#endif
101108
IntDefaultHandler, // The MPU fault handler
109+
#ifdef DEBUG
102110
BusFaultHandler, // The bus fault handler
111+
#else
112+
IntDefaultHandler, // The bus fault handler
113+
#endif
103114
IntDefaultHandler, // The usage fault handler
104115
0, // Reserved
105116
0, // Reserved
@@ -263,6 +274,7 @@ void ResetISR(void)
263274
main();
264275
}
265276

277+
#ifdef DEBUG
266278
//*****************************************************************************
267279
//
268280
// This is the code that gets called when the processor receives a NMI. This
@@ -273,10 +285,8 @@ void ResetISR(void)
273285

274286
static void NmiSR(void)
275287
{
276-
#ifdef DEBUG
277288
// Break into the debugger
278289
__asm volatile ("bkpt #0 \n");
279-
#endif
280290

281291
//
282292
// Enter an infinite loop.
@@ -316,55 +326,9 @@ static void FaultISR(void)
316326
) ;
317327
}
318328

319-
//*****************************************************************************
320-
//
321-
// This is the code that gets called when the processor receives an unexpected
322-
// interrupt. This simply enters an infinite loop, preserving the system state
323-
// for examination by a debugger.
324-
//
325-
//*****************************************************************************
326-
327-
static void BusFaultHandler(void)
328-
{
329-
#ifdef DEBUG
330-
// Break into the debugger
331-
__asm volatile ("bkpt #0 \n");
332-
#endif
333-
334-
//
335-
// Enter an infinite loop.
336-
//
337-
for ( ; ; )
338-
{
339-
}
340-
}
341-
342-
//*****************************************************************************
343-
//
344-
// This is the code that gets called when the processor receives an unexpected
345-
// interrupt. This simply enters an infinite loop, preserving the system state
346-
// for examination by a debugger.
347-
//
348-
//*****************************************************************************
349-
static void IntDefaultHandler(void)
350-
{
351-
#ifdef DEBUG
352-
// Break into the debugger
353-
__asm volatile ("bkpt #0 \n");
354-
#endif
355-
356-
//
357-
// Enter an infinite loop.
358-
//
359-
for ( ; ; )
360-
{
361-
}
362-
}
363-
364-
365329
//***********************************************************************************
366330
// HardFaultHandler_C:
367-
// This is called from the HardFault_HandlerAsm with a pointer the Fault stack
331+
// This is called from the FaultISR with a pointer the Fault stack
368332
// as the parameter. We can then read the values from the stack and place them
369333
// into local variables for ease of reading.
370334
// We then read the various Fault Status and Address Registers to help decode
@@ -403,10 +367,8 @@ void HardFault_HandlerC(uint32_t *pulFaultStackAddress)
403367
// Bus Fault Address Register
404368
_BFAR = (*((volatile uint32_t *)(0xE000ED38)));
405369

406-
#ifdef DEBUG
407370
// Break into the debugger
408371
__asm volatile ("bkpt #0 \n");
409-
#endif
410372

411373
for ( ; ; )
412374
{
@@ -416,3 +378,47 @@ void HardFault_HandlerC(uint32_t *pulFaultStackAddress)
416378
}
417379
}
418380

381+
//*****************************************************************************
382+
//
383+
// This is the code that gets called when the processor receives an unexpected
384+
// interrupt. This simply enters an infinite loop, preserving the system state
385+
// for examination by a debugger.
386+
//
387+
//*****************************************************************************
388+
389+
static void BusFaultHandler(void)
390+
{
391+
// Break into the debugger
392+
__asm volatile ("bkpt #0 \n");
393+
394+
//
395+
// Enter an infinite loop.
396+
//
397+
for ( ; ; )
398+
{
399+
}
400+
}
401+
#endif
402+
403+
//*****************************************************************************
404+
//
405+
// This is the code that gets called when the processor receives an unexpected
406+
// interrupt. This simply enters an infinite loop, preserving the system state
407+
// for examination by a debugger.
408+
//
409+
//*****************************************************************************
410+
static void IntDefaultHandler(void)
411+
{
412+
#ifdef DEBUG
413+
// Break into the debugger
414+
__asm volatile ("bkpt #0 \n");
415+
#endif
416+
417+
//
418+
// Enter an infinite loop.
419+
//
420+
for ( ; ; )
421+
{
422+
}
423+
}
424+

0 commit comments

Comments
 (0)