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.

Linker error on the TM4C123GH6PM Lab 5 Workbook

Other Parts Discussed in Thread: TM4C123GH6PM
Greetings, trying to expand my knowledge of micro-controllers by working on the TIVA C Series Launchpad and completing the workbook
Below is the code straight from Lab 5 workbook.



#include <stdint.h> #include <stdbool.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #define TARGET_IS_BLIZZARD_RB1 #include "driverlib/rom.h" int main(void) { uint32_t ui32ADC0Value[4]; volatile uint32_t ui32TempAvg; volatile uint32_t ui32TempValueC; volatile uint32_t ui32TempValueF; ROM_SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); ROM_ADCHardwareOversampleConfigure(ADC0_BASE, 64); ROM_ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS); ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS); ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS); ROM_ADCSequenceStepConfigure(ADC0_BASE,1,3,ADC_CTL_TS|ADC_CTL_IE|ADC_CTL_END); ROM_ADCSequenceEnable(ADC0_BASE, 1); while(1) { ROM_ADCIntClear(ADC0_BASE, 1); ROM_ADCProcessorTrigger(ADC0_BASE, 1); while(!ROM_ADCIntStatus(ADC0_BASE, 1, false)) { } ROM_ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value); ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2)/4; ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096)/10; ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5; } }

I'm getting a warning on the call

ROM_ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);

That states: function "ROM_ADCSequenceConfigure" declared implicitly

When debugging i get a linker error, the CDT console says:

**** Build of configuration Debug for project lab5 ****

"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
'Building target: lab5.out'
'Invoking: ARM Linker'
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --define=PART_TM4C123GH6PM --display_error_number --diag_warning=225 --diag_wrap=off -z -m"lab5.map" --heap_size=0 --stack_size=100 -i"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/lib" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="lab5_linkInfo.xml" --rom_model -o "lab5.out" "./main.obj" "./tm4c123gh6pm_startup_ccs.obj" "C:/ti/TivaWare_C_Series-2.1.3.156/driverlib/ccs/Debug/driverlib.lib" "../tm4c123gh6pm.cmd" -llibc.a
<Linking>

undefined first referenced
symbol in file
--------- ----------------
ROM_ADCSequenceConfigure ./main.obj

error #10234-D: unresolved symbols remain

error #10010: errors encountered during linking; "lab5.out" not built
>> Compilation failure
makefile:136: recipe for target 'lab5.out' failed
gmake: *** [lab5.out] Error 1
gmake: Target 'all' not remade because of errors.

**** Build Finished ****

I've searched on the forums the linker error possibly being related to not having the driverlib added to the file search path under build options, however this does not fix the issue. If i comment out the call to ROM_ADCSequenceConfigure the project complies no problem, no linker errors. 

  • Hello Justin

    Add the define TARGET_IS_TM4C123_RB1 in the compile option for pre-processors and remove the TARGET_IS_BLIZZARD_RB1 from the main code.

    Regards
    Amit
  • Thank you for your response.
    I added the part IS_TM4C123 in the command file pre-processors and took out the IS_BLIZZARD part from main, however still running into the linker error and the same warning regarding ROM_ADCSequenceConfigure. The build is shown below

    **** Build of configuration Debug for project lab5 ****

    "C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
    'Building file: ../main.c'
    'Invoking: ARM Compiler'
    "C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" --include_path="C:/ti/TivaWare_C_Series-2.1.3.156" -g --define=PART_TM4C123GH6PM --define=TARGET_IS_TM4C123_RB1 --display_error_number --diag_warning=225 --diag_wrap=off --preproc_with_compile --preproc_dependency="main.d" "../main.c"
    "../main.c", line 23: warning #225-D: function "ROM_ADCSequenceConfigure" declared implicitly
    'Finished building: ../main.c'
    ' '
    'Building file: ../tm4c123gh6pm_startup_ccs.c'
    'Invoking: ARM Compiler'
    "C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" --include_path="C:/ti/TivaWare_C_Series-2.1.3.156" -g --define=PART_TM4C123GH6PM --display_error_number --diag_warning=225 --diag_wrap=off --preproc_with_compile --preproc_dependency="tm4c123gh6pm_startup_ccs.d" "../tm4c123gh6pm_startup_ccs.c"
    'Finished building: ../tm4c123gh6pm_startup_ccs.c'
    ' '
    'Building target: lab5.out'
    'Invoking: ARM Linker'
    "C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --define=PART_TM4C123GH6PM --display_error_number --diag_warning=225 --diag_wrap=off -z -m"lab5.map" --heap_size=0 --stack_size=100 -i"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/lib" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" --reread_libs --define=TARGET_IS_TM4C123_RB1 --warn_sections --display_error_number --diag_wrap=off --xml_link_info="lab5_linkInfo.xml" --rom_model -o "lab5.out" "./main.obj" "./tm4c123gh6pm_startup_ccs.obj" "C:/ti/TivaWare_C_Series-2.1.3.156/driverlib/ccs/Debug/driverlib.lib" "../tm4c123gh6pm.cmd" -llibc.a
    <Linking>

    undefined first referenced
    symbol in file
    --------- ----------------
    ROM_ADCSequenceConfigure ./main.obj

    error #10234-D: unresolved symbols remain

    error #10010: errors encountered during linking; "lab5.out" not built
    >> Compilation failure
    makefile:136: recipe for target 'lab5.out' failed
    gmake: *** [lab5.out] Error 1
    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****

    It still warns me ROM_ADCSequenceConfigure is declared implicitly, so I was looking through the rom.h file and found the declaration of the that function.

    #define ROM_ADCSequenceConfigure \
    ((void (*)(uint32_t ui32Base, \
    uint32_t ui32SequenceNum, \
    uint32_t ui32Trigger, \
    uint32_t ui32Priority))ROM_ADCTABLE[7])
    #endif

    Still a little new to this so any eyes that can spot my mistake are greatly appreciated .
  • Hello Justin,

    I checked the rom.h and it seems that the function is not available for TM4C123x device. You would need to use the flash based version using ADCSequenceConfigure.

    #if defined(TARGET_IS_TM4C129_RA0) || \
    defined(TARGET_IS_TM4C129_RA1) || \
    defined(TARGET_IS_TM4C129_RA2)
    #define ROM_ADCSequenceConfigure \
    ((void (*)(uint32_t ui32Base, \
    uint32_t ui32SequenceNum, \
    uint32_t ui32Trigger, \
    uint32_t ui32Priority))ROM_ADCTABLE[7])
    #endif

    Regards
    Amit