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.
Hello All,
I'am trying to compile my program but I'am getting below error
undefined first referenced
symbol in file
--------- ----------------
disk_initialize ./main.obj
f_close ./main.obj
f_mount ./main.obj
f_open ./main.obj
f_write ./main.obj
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "main communication.out" not built
I'am using CCSv6 with tivaware version 2.1.0.12573.
Hello Amit,
I referred to the SDcard.c example in DK-TM4C129X and i check my below project settings. Iam posting screen shots for your reference
Also , I'am confused about the SPI Pin settings. Suppose i want to use SSI3 to interface with sd card module, Do I have to do SPI Pins configuration in my main() function? I'am asking this because in mmc-dk-tm4c129x.c file the SPI pins are already defined.
The CS pin is mentioned as PH4 where as PH4 Pin is not available on EK-TM4C1294xl launchpad!!
/************ test code for SD CARD************/ #include <stdint.h> #include <stdbool.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "inc/hw_udma.h" #include "inc/hw_adc.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/uart.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" #include "driverlib/debug.h" #include "driverlib/adc.h" #include "driverlib/timer.h" #include "arm_math.h" #include <math.h> #include "driverlib/fpu.h" #include "driverlib/udma.h" #include "driverlib/ssi.h" //#include "math_helper.h" #include "fatfs/src/ff.h" #include "fatfs/src/diskio.h" static FATFS g_sFatFs; // The following are data structures used by FatFs. static FIL fil; int main(void) { int nStatus; FRESULT iFResult; ui32SysClkFreq= SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ); while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOQ))); SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3); //for sd card GPIOPinConfigure(GPIO_PQ0_SSI3CLK); GPIOPinConfigure(GPIO_PQ1_SSI3FSS); GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0); GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1); GPIOPinTypeSSI(GPIO_PORTQ_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0); SSIConfigSetExpClk(SSI3_BASE, ui32SysClkFreq, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 400000, 8); SSIEnable(SSI3_BASE); iFResult = f_mount(0, &g_sFatFs); power_on(); BOOL a = wait_ready(); DSTATUS errd; if(a) { send_initial_clock_train(); errd = disk_initialize(0); uint32_t count = 8*512; iFResult = f_open(&fil, "testfile.txt", FA_CREATE_NEW|FA_WRITE); iFResult = f_write(&fil, "Hello world", 11, &count); iFResult = f_close(&fil); f_mount(0, NULL); }
I'am still getting error as mentioned below
undefined first referenced
symbol in file
--------- ----------------
ROM_GPIOPinTypeGPIOOutput ./mmc-dk-tm4c129x.obj
ROM_GPIOPinTypeSSI ./mmc-dk-tm4c129x.obj
ROM_GPIOPinWrite ./mmc-dk-tm4c129x.obj
ROM_SSIConfigSetExpClk ./mmc-dk-tm4c129x.obj
ROM_SSIDataGet ./mmc-dk-tm4c129x.obj
ROM_SSIDataPut ./mmc-dk-tm4c129x.obj
ROM_SSIDisable ./mmc-dk-tm4c129x.obj
ROM_SSIEnable ./mmc-dk-tm4c129x.obj
ROM_SysCtlPeripheralEnable ./mmc-dk-tm4c129x.obj
g_ui32SysClock ./mmc-dk-tm4c129x.obj
power_on ./main.obj
>> Compilation failure
send_initial_clock_train ./main.obj
wait_ready ./main.obj
Hello Amit,
I've included the rom.h and rom_map.h file but still i'am getting the same error.
since i'am using SSI3 and the EK-TM4C1294XL launchpad pinout diagram shows that PORT Q is used for SSI3
I've changed the SSI pins configuration in mmc-ek-tm4c1294xl.c file as shown below
/* Peripheral definitions for EK-TM4C129EXL board */ /* SSI port */ #define SDC_SSI_BASE SSI3_BASE #define SDC_SSI_SYSCTL_PERIPH SYSCTL_PERIPH_SSI3 /* GPIO for SSI pins */ /* CLK pin */ #define SDC_SSI_CLK_GPIO_PORT_BASE GPIO_PORTQ_BASE #define SDC_SSI_CLK GPIO_PIN_0 /* TX pin */ #define SDC_SSI_TX_GPIO_PORT_BASE GPIO_PORTQ_BASE // GPIO_PORTF_BASE #define SDC_SSI_TX GPIO_PIN_2 // GPIO_PIN_0 /* RX pin */ #define SDC_SSI_RX_GPIO_PORT_BASE GPIO_PORTQ_BASE #define SDC_SSI_RX GPIO_PIN_3 //GPIO_PIN_2 /* CS pin */ #define SDC_SSI_FSS_GPIO_PORT_BASE GPIO_PORTQ_BASE // GPIO_PORTH_BASE #define SDC_SSI_FSS GPIO_PIN_1 // GPIO_PIN_4 /* must be supplied by the application */ extern uint32_t ui32SysClkFreq; // g_ui32SysClock
Also, I've changed the power_on() function as shown below.
static
void power_on (void)
{
/*
* This doesn't really turn the power on, but initializes the
* SSI port and pins needed to talk to the card.
*/
/* Enable the peripherals used to drive the SDC on SSI */
ROM_SysCtlPeripheralEnable(SDC_SSI_SYSCTL_PERIPH);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
/*
* CUSTOM ADDITON
*/
ROM_GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1);
ROM_GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0);
ROM_GPIOPinConfigure(GPIO_PQ0_SSI3CLK);
/*
* Configure the appropriate pins to be SSI instead of GPIO. The FSS (CS)
* signal is directly driven to ensure that we can hold it low through a
* complete transaction with the SD card.
*/
ROM_GPIOPinTypeSSI(SDC_SSI_TX_GPIO_PORT_BASE, SDC_SSI_TX);
ROM_GPIOPinTypeSSI(SDC_SSI_RX_GPIO_PORT_BASE, SDC_SSI_RX);
ROM_GPIOPinTypeSSI(SDC_SSI_CLK_GPIO_PORT_BASE, SDC_SSI_CLK);
ROM_GPIOPinTypeGPIOOutput(SDC_SSI_FSS_GPIO_PORT_BASE, SDC_SSI_FSS);
/*
* Set the SSI output pins to 4MA drive strength and engage the
* pull-up on the receive line.
*/
MAP_GPIOPadConfigSet(SDC_SSI_RX_GPIO_PORT_BASE, SDC_SSI_RX,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
MAP_GPIOPadConfigSet(SDC_SSI_CLK_GPIO_PORT_BASE, SDC_SSI_CLK,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
MAP_GPIOPadConfigSet(SDC_SSI_TX_GPIO_PORT_BASE, SDC_SSI_TX,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
MAP_GPIOPadConfigSet(SDC_SSI_FSS_GPIO_PORT_BASE, SDC_SSI_FSS,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
/* Configure the SSI3 port */
ROM_SSIConfigSetExpClk(SDC_SSI_BASE, ui32SysClkFreq,
SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 400000, 8);
ROM_SSIEnable(SDC_SSI_BASE);
/* Set DI and CS high and apply more than 74 pulses to SCLK for the card */
/* to be able to accept a native command. */
send_initial_clock_train();
PowerFlag = 1;
}
However, when i add the below lines in power_on() function
ROM_GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1);
ROM_GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0);
ROM_GPIOPinConfigure(GPIO_PQ0_SSI3CLK);
It gives me error as shown below
"C:/ti/TivaWare_C_Series-2.1.0.12573/third_party/fatfs/port/mmc-ek-tm4c1294xl.c", line 211: error: identifier "GPIO_PQ3_SSI3XDAT1" is undefined
"C:/ti/TivaWare_C_Series-2.1.0.12573/third_party/fatfs/port/mmc-ek-tm4c1294xl.c", line 212: error: identifier "GPIO_PQ2_SSI3XDAT0" is undefined
"C:/ti/TivaWare_C_Series-2.1.0.12573/third_party/fatfs/port/mmc-ek-tm4c1294xl.c", line 214: error: identifier "GPIO_PQ0_SSI3CLK" is undefined
The way Iam adding files to the project is
Right Click on project name-> select "Add Files" -> browse to mmc-dk-tm4c1294xl.c file in Tivaware folder-> Click on "Link to files"
Right Click on project name-> select "Add Files" -> browse to ff.c file in Tivaware folder-> Click on "Link to files"
Below is my simple code
#include <stdint.h> #include <stdbool.h> #include <string.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "inc/hw_udma.h" #include "inc/hw_adc.h" #include "driverlib/systick.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/uart.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" #include "driverlib/debug.h" #include "driverlib/adc.h" #include "driverlib/timer.h" #include "arm_math.h" #include <math.h> #include "driverlib/fpu.h" #include "driverlib/udma.h" #include "driverlib/ssi.h" //#include "math_helper.h" #include "utils/ustdlib.h" #include "utils/cmdline.h" #include "fatfs/src/ff.h" #include "fatfs/src/diskio.h" uint32_t ui32SysClkFreq; static FATFS g_sFatFs; // The following are data structures used by FatFs. static FIL fil; int main(void) { FRESULT iFResult; FPULazyStackingEnable(); FPUEnable(); ui32SysClkFreq= SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); SysTickPeriodSet(ui32SysClkFreq / 100); SysTickEnable(); SysTickIntEnable(); iFResult = f_mount(0, &g_sFatFs); uint32_t count = 8*512; iFResult = f_open(&fil, "testfile.txt", FA_CREATE_NEW|FA_WRITE); iFResult = f_write(&fil, "Hello world", 11, &count); iFResult = f_close(&fil); f_mount(0, NULL);
}
sd card test.rarHello Amit,
I've attached the zipped project. I'am using CCSv6 & TIVAWARE VERSION 2.1.0.12573
I've included the mmc-ek-tm4c1294xl.c & ff.c file in the project as well.