This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi all,
I've tried to create a new project for CCS and I have configured the include options in ARM compiler, as well as the File Search Path in ARM Linker (As shown in the first two figures below).
However, when I try to compile the main.c I get the following error: unresolved symbol ROM_TimerIntClear, first referenced in ./main.obj TaskA C/C++ Problem
One point to clarifies, when I click cmd+click on the ROM_TimerIntClear function in the timers example that is provided in the resource explorer, it opens the driverlib/rom.h file. But when I click on it locally, it doesn't, open even though the driverlib/rom.h is included and the file opens when I click cmd+click locally and on resource explored. Also, I've tried to copy and paste the timers example, but it doesn't work since all the functions used prefixed with ROM_ and for some reason the timer won't work without ROM_
See the following structure of my project and the source code:
#include <stdint.h> #include <stdbool.h> #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/fpu.h" #include "driverlib/gpio.h" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/sysctl.h" #include "driverlib/timer.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" #include "grlib/grlib.h" #include "drivers/Kentec320x240x16_ssd2119_spi.h" #include "drivers/touch.h" #include "drivers/pinout.h" uint32_t g_ui32SysClock; uint32_t g_ui32Flags; tContext sContext; void configureIO(void) { PinoutSet(false, true); } void ConfigureGUI(void) { FPUEnable(); FPULazyStackingEnable(); Kentec320x240x16_SSD2119Init(g_ui32SysClock); GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); GrContextForegroundSet(&sContext, ClrWhite); GrContextFontSet(&sContext, &g_sFontCm20); GrStringDrawCentered(&sContext, "GUI", -1, GrContextDpyWidthGet(&sContext) / 2, 8, 0); } void Timer0IntHandler(void) { ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); HWREGBITW(&g_ui32Flags, 1) ^= 1; GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, g_ui32Flags); IntMasterDisable(); GrStringDraw(&sContext, (HWREGBITW(&g_ui32Flags, 0) ? "1" : "0"), -1,195, 108, 1); IntMasterEnable(); } void ConfigureTimers(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); // Enable processor interrupts. IntMasterEnable(); // Setup the interrupts for the timer timeouts. TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); TimerLoadSet(TIMER0_BASE, TIMER_A, g_ui32SysClock); // Setup the interrupts for the timer timeouts. IntEnable(INT_TIMER0A); TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // Enable the timers. TimerEnable(TIMER0_BASE, TIMER_A); } void ConfigureUART(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // Enable UART0. SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // Configure GPIO Pins for UART mode. GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // Initialize the UART for console I/O. UARTStdioConfig(0, 115200, g_ui32SysClock); } int main(void) { g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); configureIO(); ConfigureUART(); UARTprintf("\033[2Jexample\n"); ConfigureGUI(); ConfigureTimers(); while (1) {}; }
The driverlib/rom.h include file requires a TARGET_IS_* preprocessor symbol being defined to select which device is in use - see Linking error: unresolved symbols rom.h, pinout.c.Omar Alqarni said:However, when I try to compile the main.c I get the following error: unresolved symbol ROM_TimerIntClear, first referenced in ./main.obj TaskA C/C++ Problem
I've added the preprocessor defined symbol for TM4C1294 and the ROM_ now works fine. But still the timer doesn't work, can you please help? here is my code. Btw the project built and compiled with no errors. Also, the GUI and the UART works fine. but not the timer. Also, I've tried the timer code in the resource explorer but still doesn't work.
#include <stdint.h> #include <stdbool.h> #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/fpu.h" #include "driverlib/gpio.h" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/sysctl.h" #include "driverlib/timer.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" #include "grlib/grlib.h" #include "drivers/Kentec320x240x16_ssd2119_spi.h" #include "drivers/touch.h" #include "drivers/pinout.h" uint32_t g_ui32SysClock; uint32_t g_ui32Flags; tContext sContext; void ConfigureIO(void) { PinoutSet(false, true); } void ConfigureGUI(void) { FPUEnable(); FPULazyStackingEnable(); Kentec320x240x16_SSD2119Init(g_ui32SysClock); GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); GrContextForegroundSet(&sContext, ClrWhite); GrContextFontSet(&sContext, &g_sFontCm20); GrStringDrawCentered(&sContext, "Omar", -1, GrContextDpyWidthGet(&sContext) / 2, 8, 0); } void Timer0IntHandler(void) { ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); HWREGBITW(&g_ui32Flags, 1) ^= 1; GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, g_ui32Flags); ROM_IntMasterDisable(); GrStringDraw(&sContext, (HWREGBITW(&g_ui32Flags, 0) ? "1" : "0"), -1,195, 108, 1); ROM_IntMasterEnable(); } void ConfigureTimers(void) { ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); // Enable processor interrupts. ROM_IntMasterEnable(); // Setup the interrupts for the timer timeouts. ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, g_ui32SysClock); // Setup the interrupts for the timer timeouts. ROM_IntEnable(INT_TIMER0A); ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // Enable the timers. ROM_TimerEnable(TIMER0_BASE, TIMER_A); } void ConfigureUART(void) { ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // Enable UART0. ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // Configure GPIO Pins for UART mode. GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // Initialize the UART for console I/O. UARTStdioConfig(0, 115200, g_ui32SysClock); } int main(void) { g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); ConfigureIO(); ConfigureUART(); UARTprintf("\033[2JOmar\n"); ConfigureGUI(); ConfigureTimers(); while (1) {}; }
Has the Timer0IntHandler function been added to the vector table in the tm4c1294ncpdt_startup_ccs.c file?Omar Alqarni said:But still the timer doesn't work
To register the interrupt handler, in the tm4c1294ncpdt_startup_ccs.c:
1. Add the function prototype:
//***************************************************************************** // // External declarations for the interrupt handlers used by the application. // //***************************************************************************** extern void Timer0IntHandler(void);
2. Add the function as the entry in the g_pfnVectors[] array for Timer 0 subtimer A:
Timer0IntHandler, // Timer 0 subtimer A