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.

TMS570LC4357: Debug cmake TI build with CCS

Part Number: TMS570LC4357

Hello,

I have a cmake project being able to coss-compile an application for a TMS570LC43xx.
I'm able to produce a binary, load it into the target with uni-flash, but now I want to debug it in the target.
I'm struggling to get CCS to take my .out file, load it into the target, run it, and brake-point in the statements of my source code.
Is it possible to do this? is there any wiki or guideline I can use?
Regards

  • Hi Martin,

    I don't think the CCS can view the source code from the out file generated by cmake. 

  • Hi Martin,

    I will forward your question to CCS/Compiler E2E forum for help

  • Hello,

    I'm struggling to get CCS to take my .out file, load it into the target, run it, and brake-point in the statements of my source code.

    Can you provide more details on what the exact issues you are encountering?

    Also provide the exact CCS version being used.

    Thanks

    ki

  • Hi Ki

    Sorry, I had to step away of the project for a while. So I have been able to create a CMakeList.txt using a toolchain.cmake  file and ninja that is able to compile a .out file.
    Using the "New Project > Makefile Project with Existing Code" and create a new Target Connection I'm also able now to flash the micro and run the SW.
    It was not working because I was using the Eclipse Generator from cmake and then using the "Import > Existing project". Using this last option, the debug does not load the binary into the target, it just try to run whatever is in the memory.

    Now I check the memory and it has the interrupt vectors and all the application binary and debug symbols:

    Now I'm blocked in the execution of the code. I'm having an _undef exception when executing this line on the _c_init00(void) function

    Any help would be appreciated.

  • Are you building your project outside of CCS and just looking to use CCS to load your program and debug only?

  • Yes I do.

    I have progressed in my analysis. I have manually build a CCS project with the same files that are being compiled in the cmake project. The CCS project works perfectly, so I conclude there is something not well configured in the cmake toolchain or that something is failing to be loaded into the target because I'm using a simple Eclipse project debugging and not a CCS project debugging.

    I have compared the compiler command line and they are equivalent. The same parameters are passed, but not always in the same order. For example:

    CCS:

    CMake:


    The linker command files are the same.


    I have compared the linker command line and they are equivalent (mentioned above). The same parameters are passed, but not always in the same order. For example:

    CCS:

    CMake:

    we compile some of the files into a library first, this is something the CCS project is not doing. The library is being packed in this way:

    where amar_wrapper.bat is:


    This is done to overcome the problem mentioned in e2e.ti.com/.../warning-10189-d-archive-symbol-directory-is-missing-from-archive.

    I have compared the map files and I see they have the same sections, the same number of symbols, the same symbols (excepting that some of them are marked as being part of the library we create for the cmake project one), the same memory sizes.

    Do you think using a library could be the problem? Any other idea?

  • Thanks. In summary, a CCS project can be built and debugged successfully in CCS while a CMake based makefile project is not.

    Using the "New Project > Makefile Project with Existing Code" and create a new Target Connection I'm also able now to flash the micro and run the SW.

    I'm a little unclear with what you are doing here if you are building outside CCS. You don't need a project to debug. You can start a manual launch and then manually load the program without a project. When you do this, you still see the same issue?

  • Thanks a lot for the help, really appreciated. But I'm still having the same issue.

    Regarding

    Using the "New Project > Makefile Project with Existing Code" and create a new Target Connection I'm also able now to flash the micro and run the SW.

    cmake generates a ninja makefiles that are able to build.
    I can run the build using the command line:

    cmake --build build

    So I create a new Eclipse project of type "Make Project with Existing Code" and configure eclipse to run cmake --build build to build the program:



    Then I go to the Debug Configuration and configure a new debug configuration with a ccxml file for the target (the same I use for debugging the CCS project), and the source files from this Eclipse Make Project and few flash options for ECC compatibility.


    I have also done a Manual Launch and it is the same observation as when debugging in automatic with the imported project.
    The program is loaded into the target, it is running, when I pause the execution it is in the _udef interrupt vector:

  • FYI I have also tried without compiling a set of the .c files in a lib and then linking it with the binary.
    The map file are now even more equal (some changing in the .obj naming only, but same everything else)

    Example of different naming

    There is only one difference:

    Not sure it matters.
    Same sizes

    No difference in the section "GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name " (same names and addresses)
    Same number of symbols


    But I'm not able to run the binary into the target, I get _undef exception.

    I'm concluding there is something during the target loading that CCS project does, but the Manual Launch or my method do not do.

  • I'm concluding there is something during the target loading that CCS project does, but the Manual Launch or my method do not do.

    Can you try one last test:

    1) Do a manual launch and connect

    2) Manually load/run the executable generated by a standard CCS project. Does everything still work as expected?

    3) Manually load/run the executable generated via cmake custom makefile project. Does everything work as expected or you see the error?

  • I did the tests, The .out compiled with CCS project works fine


    but not the one compiled using cmake:

  • Don´t known if it is relevant, but I have compiled a library with a subset of the .c files using cmake toolchain, and then using this library in the CCS Project instead of adding the .c files, and it works.

  • Would it be a good idea to use this API to create the project instead of using cmake toolchian?

    software-dl.ti.com/.../ccs_projects-command-line.html

  • Would it be a good idea to use this API to create the project instead of using cmake toolchian?

    What is your main reason why you are using cmake instead of CCS/gmake?

  • To avoid manual configuration (error prone) of the project and to ease review of build options.
    I'm having the prob with a manually created CCS project now after I had to deleted it and created it in a different folder, investigating...

  • To avoid manual configuration (error prone) of the project and to ease review of build options.

    In that case, I would recommend using CCS projects and using the command-line interface to create/build them in the link you mentioned earlier.

    If you still wish to investigate the cmake issue, I'll need to forward to the compiler team as this does not appear to be a CCS build/debug issue.

  • Hello, I have a working solution again ( I had to re-do the CCS project to make it work again). I will proceed with this solution for the moment, but I would like to understand  why the Cmake toolchain is not working. If you can fwd the question to the compiler team, I would appreciate, even if I will not be able to dedicate a lot of time to it.

  • but I would like to understand  why the Cmake toolchain is not working. If you can fwd the question to the compiler team, I would appreciate, even if I will not be able to dedicate a lot of time to it.

    I will bring this thread to their attention.

    Thanks

    ki

  • Please put things back in the state where, when comparing the linker map files from the two builds, this is the case ...

    No difference in the section "GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name " (same names and addresses)
    Same number of symbols

    yet this behavior still occurs when running the code built with CMake ...

    I'm not able to run the binary into the target, I get _undef exception.

    Please install the Code Generation Tools XML Processing Utilities.  Use the utility objdiff from that package to compare the two executable .out files from each build.  Are they the same?  If they are not the same, capture the output of objdiff in a file (be sure it has the file extension .txt), and attach it to your next post.

    Thanks and regards,

    -George