Jump to content

Recommended Posts

Hey all! Finicky issue, and I've been up for way too many hours so I'm breaking from usual habit and posting after only doing minimal digging. Hopefully it's a simple solution. Fingers crossed.


Board: TM4C1294NCPDT

IDE: CCSv6.1

OS: Ubuntu 16.04

Compiler: GNU v4.9.3 (Linaro)


So here's what's up: I'm versed using timers and setting up my vector table properly, or so I thought.


Code Composer Studio isn't finding my interrupt handler... It's confuzzling me to say the least... 


Here's what I'm doing:


In startup_gcc.c

//......Skipping top of file for readability, all is stock

// External declarations for the interrupt handlers used by the application.
extern void Timer1AIntHandler(void);

//......Skipping a bunch of nonsense for readabilities sake

//Beginning of vector table (NOT Blizzard, but Snowflake/RA0)
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) =
    (void *)&_estack,                       // 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
    GPIOAIntHandler,                        // GPIO Port A
    GPIOBIntHandler,                        // GPIO Port B
    GPIOCIntHandler,                        // GPIO Port C
    GPIODIntHandler,                        // GPIO Port D
    GPIOEIntHandler,                        // GPIO Port E
    UARTStdioIntHandler,          	    // For UARTStdio - UART0 Rx and Tx
    UARTIntHandler1,                        // UART1 Rx and Tx
    IntDefaultHandler,                      // SSI0 Rx and Tx
    IntDefaultHandler,                      // I2C0 Master and Slave
    IntDefaultHandler,                      // PWM Fault
    IntDefaultHandler,                      // PWM Generator 0
    IntDefaultHandler,                      // PWM Generator 1
    IntDefaultHandler,                      // PWM Generator 2
    IntDefaultHandler,                      // Quadrature Encoder 0
    ADC0IntHandler,                         // ADC Sequence 0
    IntDefaultHandler,                      // ADC Sequence 1
    IntDefaultHandler,                      // ADC Sequence 2
    IntDefaultHandler,                      // ADC Sequence 3
    IntDefaultHandler,                      // Watchdog timer
    IntDefaultHandler,                      // Timer 0 subtimer A
    IntDefaultHandler,                      // Timer 0 subtimer B
    Timer1AIntHandler,                      // Timer 1 subtimer A (Thar she blows...)

And then in my main project file:

// Only showing relevant pieces...

// Prototypes
// ==========
// Bunch of skipped out-of-scope stuff...
void init_Timer(void);
void Timer1AIntHandler(void);

void init_Timer(void)
  // Enable interrupts to the processor.

  // Enable Timer Peripheral

  // Configure Timer1 to be Periodic, with a 100Hz interrupt
  ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, g_ui32SysClock / 100);

  // Setup the interrupts for Timer1 timeout.

  // Enable Timer1A.
  ROM_TimerEnable(TIMER1_BASE, TIMER_A);

// void loop() is there somewhere, but it's HUGE, doesn't use the timer anyway.

void Timer1AIntHandler(void) {
  // Clear the timer interrupt.

  // Call the FatFs tick timer.

I need the timer for FatFS by ChaN.


CCS gives me this on building (skipped everything until the linker output): 

Building target: Knkt_Dev_CPY_Cleaned_SDcard.out
Invoking: GNU Linker
"/home/captain/ti/ccsv6/tools/compiler/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc" -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fno-exceptions -DF_CPU=120000000L -DENERGIA=17 -DARDUINO=101 -Dccs="ccs" -DTARGET_IS_TM4C129_RA0 -D__FPU_PRESENT=1 -DUART_BUFFERED -DENABLE_LFN -Drestrict=__restrict__ -DARM_MATH_CM4 -O0 -ffunction-sections -fdata-sections -fsingle-precision-constant -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,"Knkt_Dev_CPY_Cleaned_SDcard.map" --entry ResetISR -nostartfiles -nostdlib -Wl,--gc-sections -L"/home/captain/w-DEFAULTS/lptm4c1294ncpdt_PubSubClient/Debug" -L"/home/captain/w-DEFAULTS/lptm4c1294ncpdt_MQTTClient/Debug" -L"/home/captain/w-DEFAULTS/lptm4c1294ncpdt_SPI/Debug" -L"/home/captain/w-DEFAULTS/lptm4c1294ncpdt_Ethernet/Debug" -L"/home/captain/w-DEFAULTS/lptm4c1294ncpdt_WiFi/Debug" -L"/home/captain/w-DEFAULTS/lptm4c1294ncpdt_core/Debug" -L"/home/captain/ti/energia-0101E0017/hardware/lm4f/cores/lm4f/driverlib" -L"/home/captain/ti/CMSIS-SP-00300-r4p5-00rel0/CMSIS/Lib/GCC" -L"/home/captain/ti/energia-0101E0017/hardware/lm4f/cores/lm4f/driverlib" -o"Knkt_Dev_CPY_Cleaned_SDcard.out" "./ADC0IntHandler.o" "./fatfs/port/mmc-ek-tm4c1294xl.o" "./fatfs/src/ff.o" "./fatfs/src/option/cc932.o" "./terminal/uartstdio.o" "./terminal/ustdlib.o" "./Knkt_Dev_Cleaned.o" "./terminal/terminal.o"  -Wl,--start-group -Wl,-T"/home/captain/ti/energia-0101E0017/hardware/lm4f/cores/lm4f/lm4fcpp_snowflake.ld" -llptm4c1294ncpdt_PubSubClient -llptm4c1294ncpdt_MQTTClient -llptm4c1294ncpdt_SPI -llptm4c1294ncpdt_Ethernet -llptm4c1294ncpdt_WiFi -llptm4c1294ncpdt_core -lc -ldriverlib -larm_cortexM4lf_math -ldriverlib -lm -lc -lgcc -Wl,--end-group 
makefile:175: recipe for target 'Knkt_Dev_CPY_Cleaned_SDcard.out' failed
/home/captain/w-DEFAULTS/lptm4c1294ncpdt_core/Debug/liblptm4c1294ncpdt_core.a(startup_gcc.o) :(.isr_vector+0x94): undefined reference to `Timer1AIntHandler'
collect2: error: ld returned 1 exit status



Sooo what's going on here? Does the Energia part of CCS do something different with the timer section of the vector table? I have a custom ADC0IntHandler which works just fine...
If anyone needs more info, I'm more than glad to provide it. Frustrations abound, and it especially sucks 'cuz after a 20 hour coding marathon, a problem like this is just... Awful.
Link to post
Share on other sites

With "main project file" you mean the Sketch? Note that if you implement your timer interrupt handler in the .ino file, it is considered c++ and the function name will get mangled, hence an undefined reference during link time. Best is to do it as I described in the post you pointed out. This way you do not have to deal with editing startup_gcc.c.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...