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.

Toolchain Setup GNU for Stellaris LM3S1968 in Code Composer Studio (CCS)

Other Parts Discussed in Thread: LM3S1968, EK-LM3S1968

I'm trying to use the GNU toolchain https://launchpad.net/gcc-arm-embedded/4.7/4.7-2012-q4-major in Code Composer Studio V6. I want to use the Stellarisware drivers, so as a test I am trying to build and run the graphics.c project example from Stellarisware. I can build the project fine using TI's compiler, but I want to setup the GNU ARM toolchain as it is being used on another project.

I have added the compiler, so I have "GNU v4.8.4 (Linaro)" as my compiler version.

I have these under the compiler include paths (-l):

"${CG_TOOL_INCLUDE_PATH}"
"C:\StellarisWare"
"C:\StellarisWare\boards\ek-lm3s1968"
"C:\StellarisWare\utils"

But I am not sure how to setup the linker. So far I have these entries under the Libraries (-l):

"c"
"gcc"
"nosys"

I have not changed anything else. As expected I am build errors like this when try and build the LM3S1968 "graphics" example project:

  • I know this has to do with setting up driverlib-cm3 for the linker, but I don't know how to do this properly. Also, when it comes to specifying the linker command file what should I use? 

    I've manged to compile/built the driverlib-cm3 project driver files using the GCC v4.8.4 compiler: 

    .........
    ' '
    'Building file: C:/StellarisWare/driverlib/watchdog.c'
    'Invoking: GNU Compiler'
    "C:/Program Files (x86)/GNU Tools ARM Embedded/4.8 2014q2/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-m3 -mthumb -DPART_LM3S1968 -I"C:/Program Files (x86)/GNU Tools ARM Embedded/4.8 2014q2/arm-none-eabi/include" -I"C:/StellarisWare" -ffunction-sections -fdata-sections -g -gstrict-dwarf -Wall -MMD -MP -MF"watchdog.d" -MT"watchdog.d" -o"watchdog.o"  "C:/StellarisWare/driverlib/watchdog.c"
    'Finished building: C:/StellarisWare/driverlib/watchdog.c'
    ' '
    'Building target: libdriverlib-cm3.a'
    'Invoking: GNU Librarian'
    "C:/Program Files (x86)/GNU Tools ARM Embedded/4.8 2014q2/bin/arm-none-eabi-ar.exe" -r "libdriverlib-cm3.a" "./watchdog.o" "./usb.o" "./udma.o" "./uart.o" "./timer.o" "./systick.o" "./sysctl.o" "./ssi.o" "./qei.o" "./pwm.o" "./mpu.o" "./interrupt.o" "./i2s.o" "./i2c.o" "./hibernate.o" "./gpio.o" "./flash.o" "./ethernet.o" "./epi.o" "./cpu.o" "./comp.o" "./can.o" "./adc.o"  
    C:/Program Files (x86)/GNU Tools ARM Embedded/4.8 2014q2/bin/arm-none-eabi-ar.exe: creating libdriverlib-cm3.a
    'Finished building target: libdriverlib-cm3.a'
    ' '
    
    **** Build Finished ****

    But I keep getting these "cannot find -l<lib_name>" errors, no matter what file I try and include:

    **** Build of configuration Debug__GNU for project graphics ****
    
    "c:\\ti\\ccsv6\\utils\\bin\\gmake" -k all 
    'Building target: graphics.out'
    'Invoking: GNU Linker'
    "C:/Program Files (x86)/GNU Tools ARM Embedded/4.8 2014q2/bin/arm-none-eabi-gcc.exe" -mthumb -DPART_LM3S1968 -ffunction-sections -fdata-sections -g -gstrict-dwarf -Wall -Wl,-Map,"graphics.map" -o"graphics.out" "./drivers/rit128x96x4.o" "./lm3s1968_startup_ccs_gcc.o" "./graphics.o"  -Wl,--start-group -l"c" -l"C:\StellarisWare\driverlib\ccs-cm3\Debug__GNU\libdriverlib-cm3.a" -l"gcc" -l"nosys" -Wl,--end-group 
    c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: cannot find -lC:\StellarisWare\driverlib\ccs-cm3\Debug__GNU\libdriverlib-cm3.a
    collect2.exe: error: ld returned 1 exit status
    gmake: *** [graphics.out] Error 1
    gmake: Target `all' not remade because of errors.
    
    **** Build Finished ****

  • Hello Sean

    In the linker search path you have to give the full path for where the linker can find

    libdriverlib-cm3.a

    Regards

    Amit

  • Hi Amit

    I've tried that. I've also tried shortening the library (-l) to just "libdriverlib-cm3.a" even though the full file path gets inserted automatically. I have also verified that the file "libdriverlib-cm3.a" was successfully built (using GCC) and is contained in the directory: C:\StellarisWare\driverlib\ccs-cm3\Debug__GNU.

  • Hello Sean,

    Can you attach the CCS Project and the libdriver file? I would need to check

    Regards

    Amit

  • 7558.graphics.7z

    8737.libdriverlib-cm3.7z

    I've attached both the project and the libdriver-cm3.a file as 7zip files.

  • Hello Sean,

    It took some time. But basically, what you need to do is in the project linker options put the pre compiled librrary as driverlib-cm3 while the main file is called libdriverlib-cm3.a LD adds ,a and lib automatically

    Regards

    Amit

  • Thanks Amit, that solves the problem with linking in Stellarisware. Do you have any suggestions on fixing the remaining two build errors: undefined reference to `__data_start__' and undefined reference to `__data_end__'?

    I've read that these symbols are normally defined in linker command file (*.ld), so I tried copying in the graphics.ld file from C:\StellarisWare\boards\ek-lm3s1968\graphics and directing the linker to use the file but it did not work. I also tried replacing the file lm3s1968_startup_ccs_gcc.c with startup_gcc.c file from the directory C:\StellarisWare\boards\ek-lm3s1968\graphics, but that didn't work either. 

  • Hello Sean

    I would need to look into it as well. Will take some time to see why it is giving an error

    Regards

    Amit

  • Hello Sean

    Cleaned up the project. Please use the attached zip file as reference

    2425.graphics.7z

    Regards

    Amit

  • Thanks again - that seems to have done the trick. Mind sharing what needed to be changed/setup? 

    I also found that with the project you provided in the post above that I got the error: "undefined reference to `SysCtlDelay'"  - the function SysCtlDelay occurred four times in the sysctl.c file (which in driverlib-cm3). This happened when I built the actual project "graphics" as supplied from the folder in the above post. Strangely, the file builds fine when just driverlib-cm3 is built.

    I found this site which suggested adding the symbol gcc (I added it both driverlib-cm3 and graphics) http://www.coocox.org/forum/topic.php?id=2409 After that the project built and ran on the board fine. I then removed the symbols from both projects and cleaned and rebuilt them and everything was fine. Any hint as to why that might be?

  • Hello Sean,

    I think it was remove unused symbols tick box.

    Honestly, I find using GCC in Linux environment way more convenient.

    Regards

    Amit