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.

Problem in the TM4C123G_Workbook lab

Other Parts Discussed in Thread: TM4C123GH6PM

I'm working thru the TM4C workbook, currently on lab 9. I copied the code exactly as it is from main.txt into my main.c

#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/fpu.h"
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"

#ifndef M_PI
#define M_PI                    3.14159265358979323846
#endif

#define SERIES_LENGTH 100

float gSeriesData[SERIES_LENGTH];

int32_t i32DataCount = 0;

int main(void)
{
    float fRadians;

    ROM_FPULazyStackingEnable();
    ROM_FPUEnable();

    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

    fRadians = ((2 * M_PI) / SERIES_LENGTH);

    while(i32DataCount < SERIES_LENGTH)
    {
    	gSeriesData[i32DataCount] = sinf(fRadians * i32DataCount);

    	i32DataCount++;
    }

    while(1)
    {
    }
}

However the project has errors. I get warnings on the ROM calls about being declared implicitly and then I get linker errors because of unresolved symbols from the ROM functions. Below is the build output

 

**** Build of configuration Debug for project lab9 ****

"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 --display_error_number --diag_warning=225 --diag_wrap=off --preproc_with_compile --preproc_dependency="main.d" "../main.c"
"../main.c", line 24: warning #225-D: function "ROM_FPULazyStackingEnable" declared implicitly
"../main.c", line 25: warning #225-D: function "ROM_FPUEnable" declared implicitly
"../main.c", line 27: warning #225-D: function "ROM_SysCtlClockSet" 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: lab9.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"lab9.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="lab9_linkInfo.xml" --rom_model -o "lab9.out" "./main.obj" "./tm4c123gh6pm_startup_ccs.obj" "../tm4c123gh6pm.cmd" -llibc.a
<Linking>

undefined first referenced
symbol in file
--------- ----------------
ROM_FPUEnable ./main.obj
ROM_FPULazyStackingEnable ./main.obj
ROM_SysCtlClockSet ./main.obj

error #10234-D: unresolved symbols remain

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

**** Build Finished ****

 

 

  • Hello Justin,

    Please add the include file

    #include "driverlib/rom_map.h" and the preprocessor define TARGET_IS_TM4C123_RB1
  • Hi Amit,

    I've made the changes you suggested shown below

     

    #include <stdint.h>
    #include <stdbool.h>
    #include <math.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/fpu.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    
    #define TARGET_IS_TM4C123_RB1
    

    However I still have the same output build error

    **** Build of configuration Debug for project lab9 ****

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

    undefined first referenced
    symbol in file
    --------- ----------------
    ROM_FPUEnable ./main.obj
    ROM_FPULazyStackingEnable ./main.obj
    ROM_SysCtlClockSet ./main.obj

    error #10234-D: unresolved symbols remain

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

    **** Build Finished ****

    Confused as to were to go from here. I also forgot to mention that there's a warning regarding the project being built with an old version compiler, not sure if this is relevant. 

     

     

     

  • Hello Justin

    The define has to be added to the preprocessor define in CCS Project Build Settings, at the same place where PART_TM4C123GH6PM is defined
  • Thank you so much that fixed the problem!
  • Hello Justin

    We plan to update the workbook to bring it up to speed with CCSv6 and TivaWare 2.1.3