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.

Can't link a CCS 5.1 app using pthreads on 816X EVM



Hi,

I am trying to write an app in CCS 5.1 for the 816X EVM that uses pthreads and semaphores, and it compiles, but I am getting the following linker errors.


**** Build of configuration Debug for project evm_test ****

make all
Building target: evm_test
Invoking: Cross GCC Linker
arm-none-linux-gnueabi-gcc -L/home/user/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib -o "evm_test"  ./brd_dat.o ./brd_txt.o ./ctrl.o ./mem_acc.o ./vcm_decoder.o   
./brd_dat.o: In function `Board_InitStatusTask':
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:539: undefined reference to `sem_init'
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:546: undefined reference to `sem_init'
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:559: undefined reference to `pthread_create'
./brd_dat.o: In function `Board_StartStatusTask':
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:584: undefined reference to `sem_wait'
./brd_dat.o: In function `Board_CloseStatusTask':
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:611: undefined reference to `sem_wait'
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:618: undefined reference to `sem_destroy'
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:620: undefined reference to `sem_destroy'
./brd_dat.o: In function `Board_StatusTask':
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:644: undefined reference to `sem_post'
/home/user/workspace_v5_1/evm_test/Debug/../brd_dat.c:786: undefined reference to `sem_post'
collect2: ld returned 1 exit status
make: *** [evm_test] Error 1

**** Build Finished ****

Do I need to specify a library and if so where is it and how do I specify it?

Paul

  • So I was able to get rid of all the compile errors.

    In the "Build Options..." of my project, I went to "C/C++ Build | Settings", then selected the "Tool Settings" tab.

    Then I selected "Cross GCC Linker | Libraries", and I added "pthread" in the "Libraries" section and "/home/user/targetfs/lib" in the "Library search path" section.

    This got my compile errors to go away.

    However, when I try to debug my app with Eclipse, I can step through code until the first pthread_create() call and then the debugger prints this error message in the console window:

    [New Thread 1224]
    Cannot remove breakpoints because program is no longer writable.
    It might be running in another process.
    Further execution is probably impossible.
    warning: Error removing breakpoint 0

    So, it is clear I am still doing something wrong.

    I would greatly appreciate any help with this.

    Paul

  • Is the free version of CodeSourcery (including gdb) that comes with the EVM capable of debugging multithreaded apps?  If not, do we need to update to a paid version?

    Some more information on my problem:

    When I try debugging my multithreaded app, I get the following output on the target:

    root@dm816x-evm:~/dm816x-evm# gdbserver :10000 evm_test
    Process evm_test created; pid = 1393
    Listening on port 10000
    Remote debugging from host 10.10.0.111
    MPEG2 Decoder
    APP Version:      1.81
    APP Build Date:   Mar  5 2012
    APP Build Time:   11:05:27
    Control echo        : DISABLE
    Control verbose     : DISABLE
    Video output        : DECODED VIDEO

    Child terminated with signal = 5

    Child terminated with signal = 0x5 (SIGTRAP)
    GDBserver exiting
    root@dm816x-evm:~/dm816x-evm#

  • Hi,

    The problem may be coming from the GDB/GDBserver tool combination, therefore I send some threads below that may help you with several tips:

    http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/138629.aspx#509944

    http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/146092.aspx#528758

    Hope this helps,

    Rafael

  • Hi Rafael,

    Thanks so much for your response.

    The threads you pointed to had the solution.

    I copied gdbserver from

    /home/user/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/usr/bin

    to

    /home/user/targetfs/usr/bin

    and now I can step through a second thread.

    I noticed that the gdbserver from the CodeSourcery toolchain was 111.1 KB while the gdbserver in the target filesystem was 51.5 KB, so they are obviously different files.

    Thanks again for getting me over this hurdle.

    Paul