Hi all,
I am working on a C++ project using the TM4C123 family MCUs and am getting an undefined reference to my interrupt handlers during linking. The exact error is this: (.isr_vector+0x3c): undefined reference to `SysTickIntHandler'
Since I have a C++ project, I am assuming I am missing an extern "C" {} somewhere but this is what I have so far. First is a snippet of the startup file (startup_gcc.c)
extern void SysTickIntHandler(); //***************************************************************************** // // The entry point for the application. // //***************************************************************************** extern int main(void); //***************************************************************************** // // Reserve space for the system stack. // //***************************************************************************** static uint32_t pui32Stack[128]; //***************************************************************************** // // The vector table. Note that the proper constructs must be placed on this to // ensure that it ends up at physical address 0x0000.0000. // //***************************************************************************** __attribute__((section(".isr_vector"))) void (*const g_pfnVectors[])(void) = { (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), // The initial stack pointer ResetISR, // The reset handler NmiSR, // The NMI handler FaultISR, // The hard fault handler IntDefaultHandler, // The MPU fault handler IntDefaultHandler, // The bus fault handler IntDefaultHandler, // The usage fault handler 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // SVCall handler IntDefaultHandler, // Debug monitor handler 0, // Reserved IntDefaultHandler, // The PendSV handler SysTickIntHandler, // The SysTick handler
The following is how I declare my interrupt handler
#ifdef __cplusplus extern "C" { #endif void SysTickIntHandler() { system_counter++; } #ifdef __cplusplus } #endif
What I have tried:
1. Renaming startup file with .cpp extension
2. extern "C" {} on the interrupt handler.
I have followed a few posts that had a similar issue but they said extern "C" {} fixed theirs, but I'm still getting the linkage error. I'm sure it's something silly.
Any help would be greatly appreciated, thanks!