Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

CCS/TM4C123AE6PM: Problem linking standard library in CCS 6.1

Part Number: TM4C123AE6PM
Other Parts Discussed in Thread: TM4C123GH6PM,

Tool/software: Code Composer Studio

I wrote a program that uses the system call from "stdlib.h" and I get a linker error saying it cannot find the symbol "system". I looked at "software-dl.ti.com/.../sdto_cgt_tips_for_using_printf.html" and accordingly increased the heap size, but that didn't work. I also tried looking for "stdlib.lib" which might be a statically linked library for "stdlib.h", but I couldn't find any on my filesystem. All the libraries which I've included and linked so far are there in the build debug output below, along with the max heap and stack size I've used. I'm not sure what I'm missing here - I think I need to link a file, but I don't know which one. I thought "stdlib.h" was a pretty standard library so CCS would probably have done the linking itself or the linking process would be obvious and easy, but so far I've been proved wrong. How do I make the symbol 'system' defined?

Relevant piece of code:

#include <stdlib.h>

system("...")

Build of configuration Debug for project

"C:\\ti\\ccs1010\\ccs\\utils\\bin\\gmake" -k -j 4 all -O

Building target: "Interrupt.out"
Invoking: ARM Linker
"C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --preinclude="C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/include/stdlib.h" --define=ccs="ccs" --define=PART_TM4C123GH6PM -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi -z -m"Interrupt.map" --heap_size=2000 --stack_size=512 -i"C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/lib" -i"C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/include" -i"C:/ti/TivaWare_C_Series-2.2.0.295" -i"C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="Interrupt_linkInfo.xml" --rom_model -o "Interrupt.out" "./main.obj" "./tm4c123gh6pm_startup_ccs.obj" "C:/ti/TivaWare_C_Series-2.2.0.295/driverlib/ccs/Debug/driverlib.lib" "../tm4c123gh6pm.cmd" -llibc.a -l"C:/ti/TivaWare_C_Series-2.2.0.295/driverlib/rvmdk/driverlib.lib"
<Linking>

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

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "Interrupt.out" not built

>> Compilation failure
makefile:144: recipe for target 'Interrupt.out' failed
makefile:140: recipe for target 'all' failed
gmake[1]: * [Interrupt.out] Error 1
gmake: * [all] Error 2

  • K Saurav said:
    I thought "stdlib.h" was a pretty standard library so CCS would probably have done the linking itself or the linking process would be obvious and easy, but so far I've been proved wrong.

    According to http://www.iso-9899.info/n1570.html#4.p6 stdlib.h is only required to be supported by a C99 compiler for a hosted environment.

    Section 5.1.1 Implementation-Defined Behavior of the ARM Optimizing C/C++ Compiler v20.2.0.LTS User's Guide (Rev. V) contains:

    The TI compiler officially supports a freestanding environment. The C standard does not require a freestanding environment to supply every C feature; in particular the library need not be complete. However, the TI compiler strives to provide most features of a hosted environment.

    And section J.3.2 Environment contains:

    The system function is not supported. (7.20.4.6).

    The system function is designed to create a child process, and so only make sense in a hosted environment such as Windows or Linux which has an operating system which can create a child process.

    What did you expect the system call to do on a TM4C123AE6PM micro-controller?

  • Unfortunately, I can confirm that the TI ARM compiler does not support the system RTS function.

    Thanks and regards,

    -George

  • Just like a system call in a normal C function. I am basically trying to get data from my microcontroller, which is served through a REST API. I tried importing external libraries to make the REST client calls easier, but I ran into problems importing them. Like one library I tried importing was [https://github.com/whoshuu/cpr], but it starting throwing errors on "iostream" and "string" even though the main file had an extension of cpp. So instead of that I wrote a batch script which does that work, and I'm trying to execute that batch script through the system call. So now that I know `system` isn't supported, I'm going to try to keep a batch file running which dumps the filtered REST call to a file, and simply read the file from the code. I assume the file operation (fopen, fscanf, fprintf) will be supported?

    The microcontroller is Phyphox's if that helps.

  • K Saurav said:
    The microcontroller is Phyphox's if that helps.

    I'm not clear what microcontroller you are using. What is Phyphox's? Are you using TM4C123 MCU? Can you build a simple CCS project that comes with the TivaWare library? The TivaWare library can be downloaded from https://www.ti.com/tool/SW-TM4C