Part Number: EVMK2G
Tool/software: Code Composer Studio
Hello,
I’m having trouble adding/using additional GPIO LLD functionality to a bundled SPI test project.
I’m working on the EVMK2G and am trying to attach to it to an ADC that requires a conversion control signal to trigger a reading. I chose to start with the included project ”SPI_BasicExample_evmK2G_arm_TestProject”. I modified the project to use SPI0 on the serial expansion header (J12) and verified that I have clock and data coming out (from the EVM to the peripheral) as expected. I intend to use GPIO1_47 (SOC_ECAP1_IN_PWN1_OUT / serial expansion header pin 42) to trigger the conversion on the ADC.
I keep running into issues where structs and function calls are flagged by the linker for being an undefined reference despite having the file(s) containing the struct/function implementation included in the project
- I added the same #include files that are in main_led_blink.c from the project “GPIO_LedBlink_evmK2G_armTestProject”. Since the project is in a different relative location, I also tried #3 and #4 as absolute paths.
- #include <ti/drv/gpio/GPIO.h>
- #include <ti/drv/gpio/soc/GPIO_soc.h>
- #include "ti/drv/gpio/test/led_blink/src/GPIO_log.h"
- #include "ti/drv/gpio/test/led_blink/src/GPIO_board.h"
- I added the project “GPIO_LedBlink_evmK2G_armTestProject” as a dependency to my SPI project. Right-click project -> build -> dependencies -> add… -> GPIO_LedBlink_evmK2G_armTestProject
- I added .h and .c files to the project Right_click project name -> Add Files . . . -> Link to files, create link relative to PDK_INSTALL_PATH (just like the other files in the project).
- I noticed some differences in the .cfg files (gpio_arm.cfg and spi_arm.cfg) so I tried to incorporate those into spi_arm.cfg:
/* Load the spi package */
var Spi = xdc.loadPackage('ti.drv.spi');
Spi.Settings.enableProfiling = true;
Spi.Settings.socType = devType;
var Gpio = xdc.loadPackage('ti.drv.gpio');//added
Gpio.Settings.enableProfiling = true;
Gpio.Settings.socType = devType;
…
var peripheralBaseAddrs = [
{ base: 0x4ae00000, size: 0x00100000 }, // PRM
{ base: 0x02530C00, size: 0x00000400 }, // UART 0 regs
{ base: 0x02531000, size: 0x00000400 }, // UART 1 regs
{ base: 0x21805400, size: 0x00000800 } // SPI 0/1/2/3 regs
{ base: 0x02603000, size: 0x00000100 }, // GPIO 0 regs
{ base: 0x0260a000, size: 0x00000100 } // GPIO 1 regs
];
I think that what’s happening here is that I somehow haven’t initialized the GPIO_Config struct meaning there would be no EVMK2G specific drivers for any of the GPIO functions i.e. GPIO_read(), GPIO_write(), GPIO_setCallback() etc.
How do I know exactly what needs to be included in the project to add this functionality?
Linker output from failed build:
Building target: "SPI_BasicExample_evmK2G_armTestProject.out"
Invoking: GNU Linker
"C:/ti/ccs910/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a15 -marm -Dk2g02 -Darm0 -DUSE_BIOS -DSOC_K2G -DevmK2G -Og -g -gdwarf-3 -gstrict-dwarf -Wall -finstrument-functions -MMD -MP -mfloat-abi=hard -Wl,-Map,"SPI_BasicExample_evmK2G_armTestProject.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/bios_6_75_02_00/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,ARM_CORE=1 -Wl,--defsym,STACKSIZE=0x10000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"SPI_BasicExample_evmK2G_armTestProject.out" "./GPIO_drv.o" "./GPIO_v0.o" "./main_spi_flash_read_write_test.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lrdimon -lgcc -lm -lnosys -lc -Wl,--end-group
makefile:148: recipe for target 'SPI_BasicExample_evmK2G_armTestProject.out' failed
./GPIO_drv.o: In function `GPIO_clearInt':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/GPIO_drv.c:56: undefined reference to `GPIO_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/GPIO_drv.c:56: undefined reference to `GPIO_config'
./GPIO_drv.o: In function `GPIO_disableInt':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/GPIO_drv.c:67: undefined reference to `GPIO_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/GPIO_drv.c:67: undefined reference to `GPIO_config'
./GPIO_drv.o: In function `GPIO_enableInt':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/GPIO_drv.c:78: undefined reference to `GPIO_config'
./GPIO_drv.o:C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/GPIO_drv.c:78: more undefined references to `GPIO_config' follow
./GPIO_v0.o: In function `GPIO_toggle_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:580: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:580: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:583: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:583: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:592: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:592: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:594: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:594: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:597: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:597: undefined reference to `GPIO_v0_config'
./GPIO_v0.o: In function `GPIO_setCallback_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:380: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:380: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:399: undefined reference to `GPIO_v0_config'
./GPIO_v0.o:C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:399: more undefined references to `GPIO_v0_config' follow
./GPIO_v0.o: In function `GPIO_write_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:634: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:634: undefined reference to `GPIO_v0_hwAttrs'
./GPIO_v0.o: In function `GPIO_setConfig_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:431: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:431: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:438: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:438: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:439: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:439: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:467: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:467: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:516: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:516: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:527: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:527: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:551: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:551: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:555: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:555: undefined reference to `GPIO_v0_config'
./GPIO_v0.o: In function `GPIO_clearInt_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:138: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:138: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:141: undefined reference to `GPIO_v0_config'
./GPIO_v0.o:C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:141: more undefined references to `GPIO_v0_config' follow
./GPIO_v0.o: In function `GPIO_clearInt_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:147: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:147: undefined reference to `GPIO_v0_hwAttrs'
./GPIO_v0.o: In function `GPIO_enableInt_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:222: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:222: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:225: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:225: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:235: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:235: undefined reference to `GPIO_v0_hwAttrs'
./GPIO_v0.o: In function `GPIO_disableInt_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:163: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:163: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:166: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:166: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:175: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:175: undefined reference to `GPIO_v0_hwAttrs'
./GPIO_v0.o: In function `GPIO_read_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:354: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:354: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:357: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:357: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:363: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:363: undefined reference to `GPIO_v0_hwAttrs'
./GPIO_v0.o: In function `GPIO_init_v0':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:308: undefined reference to `GPIO_socGetNumPinsPorts'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:323: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:323: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:325: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:325: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:330: undefined reference to `GPIO_v0_config'
./GPIO_v0.o:C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:330: more undefined references to `GPIO_v0_config' follow
./GPIO_v0.o: In function `GPIO_v0_hwiFxn':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:259: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:259: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:261: undefined reference to `GPIO_socGetNumPinsPorts'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:284: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:284: undefined reference to `GPIO_v0_config'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:288: undefined reference to `GPIO_v0_hwAttrs'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/gpio/src/v0/GPIO_v0.c:288: undefined reference to `GPIO_v0_hwAttrs'
./main_spi_flash_read_write_test.o: In function `Board_initGPIO':
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/spi/test/spi_flash/src/main_spi_flash_read_write_test.c:59: undefined reference to `GPIO_socGetInitCfg'
C:/ti/pdk_k2g_1_0_14/packages/ti/drv/spi/test/spi_flash/src/main_spi_flash_read_write_test.c:62: undefined reference to `GPIO_socSetIntMux'
collect2.exe: error: ld returned 1 exit status
gmake[1]: *** [SPI_BasicExample_evmK2G_armTestProject.out] Error 1
gmake: *** [all] Error 2
makefile:144: recipe for target 'all' failed
**** Build Finished ****