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.
Tool/software: TI C/C++ Compiler
Hi,
I am trying to compile a larger project - initially made for linux - which makes use of clock_gettime() for approximate profiling. I was able to reproduce the linker error using a small example:
Building file: "../hello.c" Invoking: C6000 Compiler "/home/idris/ti/ti-cgt-c6000_8.2.2/bin/cl6x" -mv6600 --include_path="/home/idris/ti/bios_6_73_00_12/packages/ti/posix/ccs" --include_path="/home/idris/workspace_v8/first_hello_world" --include_path="/home/idris/ti/ti-cgt-c6000_8.2.2/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="hello.d_raw" "../hello.c" Finished building: "../hello.c" Building target: "first_hello_world.out" Invoking: C6000 Linker "/home/idris/ti/ti-cgt-c6000_8.2.2/bin/cl6x" -mv6600 -g --diag_warning=225 --diag_wrap=off --display_error_number -z -m"first_hello_world.map" -i"/home/idris/ti/ti-cgt-c6000_8.2.2/lib" -i"/home/idris/ti/ti-cgt-c6000_8.2.2/include" --reread_libs --define=COREn=1 --diag_wrap=off --display_error_number --warn_sections --xml_link_info="first_hello_world_linkInfo.xml" --rom_model -o "first_hello_world.out" "./hello.obj" "../C6678_unified.cmd" -llibc.a <Linking> undefined first referenced symbol in file --------- ---------------- clock_gettime ./hello.obj error #10234-D: unresolved symbols remain
The corresponding code is:
#include <stdio.h> #include <time.h> #include <sys/time.h>
int main(void) { struct timespec tic, toc; clock_gettime(CLOCK_MONOTONIC, &tic); printf("Hello World!\n"); clock_gettime(CLOCK_MONOTONIC, &toc); return 0; }
I guess that I am not linking some library, but I could not figure out what is missing yet. Would you have any hints?
Thank you very much for your help.
Best wishes,
Idris
Idris,
clock_gettime API is not part of traditional TI RTOS/BIOS APIs but was introduced as part of POSIX support. The API requires you to include and link to TI RTOS posix libraries as described here:
http://processors.wiki.ti.com/index.php/SYS/BIOS_POSIX_Thread_(pthread)_Support#Clock_APIs
Generally this is recommended for code that is being ported from a UNIX/Linux environment.
Hope this helps.
Regards,
Rahul
Hi Rahul,
Thank you very much for your answer. The link you posted is very helpful. By generating an example via "CCS->New Project -> SYS/BIOS -> TI Target Examples -> Typical" and adding a line "xdc.useModule('ti.sysbios.posix.Settings');" to the app.cfg file solved my problem.
Seems like I still lack some understanding here. I only started to look into these cfg-files now and I realized that there are quite some differences between this sysbios project and the OMP projects I was working with. Would you maybe also be able to point me to some more elaborate explanations regarding this subject?