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/EVMK2H: Building a Simple C++ Program

Part Number: EVMK2H

Tool/software: Code Composer Studio

In order to build an Image Processing OpenCV program, I first tried to build a simple Hello World C++ program.

The build went well, with the following output below:

Building target: samplecplusx2
Invoking: Cross G++ Linker
g++  -o "samplecplusx2"  ./src/samplecplusx2.o   
Finished building target: samplecplusx2
 

However as I was trying to load the program (in this case, samplecplusx2) using one the 66x DSP cores, it instead showed this error:

C66xx_0: GEL: Encountered a problem loading file: /home/workspace_v8/samplecplusx2/Debug/samplecplusx2 Could not determine target type of file

It would be greatly appreciated if you could help me out with this, thank you.

Best regards,

Madeleine

  • Did you rebuild the program with the TI C6000 compiler?

    Thanks and regards,

    -George

  • Hello George,

    Yes I did.

    Best Regards,
    Madeleine
  • Please perform the C6000 build again, then save the build log to a text file with the Copy Build Log icon.  Be sure to use the file extension .txt.  Then attach that file to your next post.

    Thanks and regards,

    -George

  • Hello George,

    Noted. Attached is the build log file. 

    Thank you.

    Best Regards,

    Madeleine

    08:41:23 **** Build of configuration Debug for project samplecplusx2 ****
    make all 
    Building file: ../src/samplecplusx2.cpp
    Invoking: Cross G++ Compiler
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/samplecplusx2.d" -MT"src/samplecplusx2.o" -o "src/samplecplusx2.o" "../src/samplecplusx2.cpp"
    Finished building: ../src/samplecplusx2.cpp
     
    Building target: samplecplusx2
    Invoking: Cross G++ Linker
    g++  -o "samplecplusx2"  ./src/samplecplusx2.o   
    Finished building target: samplecplusx2
     
    
    08:41:23 Build Finished (took 513ms)
    
    

  • To build for execution on a C6000 system, you have to build with the TI C6000 compiler.  The name of the compiler is cl6x.  This is the analog to the g++ executable you invoked in the attached build log.

    Thanks and regards,

    -George

  • Hi George,

    I realized that careless mistake of mine after a while and tried to build using the C66x compiler.

    Thank you for noting that. The build worked as shown in the attachment below.

    **** Build of configuration Debug for project test3 ****
    
    /home/joshuaquinto/ti/ccsv8/utils/bin/gmake -k -j 8 all -O 
     
    Building file: "../hello.cpp"
    Invoking: C6000 Compiler
    "/home/joshuaquinto/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.2.3/bin/cl6x" --include_path="/home/joshuaquinto/workspace_v8/test3" --include_path="/home/joshuaquinto/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.2.3/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="hello.d_raw"  "../hello.cpp"
    Finished building: "../hello.cpp"
     
    Building target: "test3.out"
    Invoking: C6000 Linker
    "/home/joshuaquinto/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.2.3/bin/cl6x" -g --diag_warning=225 --diag_wrap=off --display_error_number -z -m"test3.map" -i"/home/joshuaquinto/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.2.3/lib" -i"/home/joshuaquinto/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.2.3/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="test3_linkInfo.xml" --rom_model -o "test3.out" "./hello.obj" "../66AK2Gxx_C66.cmd"  -llibc.a 
    <Linking>
    warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default size
    warning #10210-D: creating ".sysmem" section with default size of 0x400; use the -heap option to change the default size
    Finished building target: "test3.out"
     
    
    **** Build Finished ****
    

    Although whenever I try to load the Hello World program into one of the cores, it eventually gets stuck in the "Running" phase.

  • Please consider the suggestions in the article Tips for Using Printf.

    Thanks and regards,

    -George

  • Hi George,

    Thank you for your help.

    I have successfully compiled my simple Hello World C++ code as shown below.

    #include <iostream>
    using namespace std;
    
    int main(void) {
    
        cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    
        return 0;
    }
    

    But when I try to run it on the DSP core, the console does not display any output.

    Did I miss any libraries to include or is there something wrong with my code? 

    Or maybe I might have missed a configuration file during project creation?

    I hope you could help me with this.

    Best Regards,

    Madeleine

  • Please follow the suggestions in the article Tips for Using Printf.  In particular, I suggest you change your code to call puts instead.  That is much simpler.  But once you get that to work, it is likely the more complicated forms of printing will start to work.

    Thanks and regards,

    -George