Hello,
I've make a simple UART code using LM4F120H5QR.
It works fine, here is the code :
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.c"
void InitConsole(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
ROM_GPIOPinConfigure(GPIO_PB0_U1RX);
ROM_GPIOPinConfigure(GPIO_PB1_U1TX);
ROM_GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 9600,
//(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
UARTStdioInitExpClk(1, 9600);
UARTprintf("UART Initialized...");
//ROM_SysCtlDelay(2000000);
}
void UARTIntHandler(void)
{
unsigned long ulStatus;
ulStatus = ROM_UARTIntStatus(UART1_BASE, true);
ROM_UARTIntClear(UART1_BASE, ulStatus);
while(ROM_UARTCharsAvail(UART1_BASE))
{
ROM_UARTCharPutNonBlocking(UART1_BASE, ROM_UARTCharGetNonBlocking(UART1_BASE));
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
ROM_SysCtlDelay(ROM_SysCtlClockGet() / (1000 * 3)); // Delay for 1 millisecond. Each SysCtlDelay is about 3 clocks.
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
}
}
void main(void)
{
ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
InitConsole();
ROM_IntMasterEnable();
ROM_IntEnable(INT_UART1);
ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
while(1){}
}
Here I've include "utils/uartstdio.c" BUT when I use "utils/uartstdio.h" then I am getting these errors:
undefined first referenced
symbol in file
--------- ----------------
UARTStdioInitExpClk ./zigbee.obj
UARTprintf ./zigbee.obj
error #10234-D: unresolved symbols remain
I've check both the files (.c & .h) and I didn't get why this is happening.
I've defined PART_LM4F120H5QR for pin_map.h file &
TARGET_IS_BLIZZARD_RA1 for rom.h.
I haven't defined any other symbols. I am using ccsv5.3 on win7 32bit.
Though it is working absolutely fine, I want to know why this has happened?
Could someone please make me aware with the reason please?
Thanks for your time.