Project

General

Profile

Linux App CCS Project

Objective

This wiki page will walk through the steps needed to build, run, and debug a simple hello world program on the main ARM processor of the AM62x using a CCS Project.

Spoiler: While a CCS project can be used to create a working ARM program, Code Composer is not able to plant breakpoints in such a program when it is being debugged using gdbserver. The program can be loaded, connected to, and even stepped through. But alas, no breakpoints. This makes this type of project not viable when wanting to have a program that can be debugged (with breakpoints)

Prerequisites

Note

It would be nice to use the GDB (DSF) Automatic Remote Debugging Launcher but there is currently an incompatibility between the SSH key exchange methods supported in the AM62x target and the methods that CCS is willing to use. We are looking into a work-around and until one is available, the Manual Remote Debugging Launcher needs to be used. The serial and telnet methods of connecting also do not seem viable.

If the GDB (DSF) Automatic Remote Debugging Launcher could be used, then the program could be automatically copied to the target and gdbserver could be automatically started. This would avoid these manual steps and the process would greatly streamlined.

Steps

Create and build project

  • Start CCS in a new workspace
  • Close Getting Started View
    • Click x next to Getting Started to close the View
    • Click on Restore button in upper right so Project Explorer is visible
  • Add the Cross Compiler
    • Window->Preferences->Code Composer Studio->Build->Compilers
    • Tool discovery path
      • Click Add...
      • Browse to
        /home/<whatever>/ti-processor-sdk-linux-am62xx-evm-08.06.00.42/linux-devkit/sysroots/x86_64-arago-linux/usr/bin
        
    • Discover tools:
      • may need to click on Refresh
      • Should see GNU v9.2.1 (null aarch64) in the Arm tool chains
  • Create ProjectFile->New->CSS Project...
    • Target
      • Change Generic Arm7 Device to AM62x
    • Cortex A tab
      • Project name: hello_arm
      • Compiler version: GNU v9.2.1 (null aarch64)
      • Empty Project (with main.c)
      • Finish
  • Add Code to the project
    • File->New->Source file:
      • Source file name: hello.c
    • Add code in source view
      #include <stdio.h>
      
      int main()
      {
          printf ("Hello world from hello_arm\n");
          fflush (stdout);
          return 0;
      }
      

      Note that the fflush() is needed to get the output to the terminal sooner. When running the program through the method being used on this page, the output is buffered until the program runs to completion since stdout is not an actual terminal. To get the output to appear sooner while
      stepping through the program, the fflush is needed.
  • Change Compiler properties
    • In Project Explorer->hello_arm->right-mouse->Properties->Build->GNU Compiler->Miscellaneous
      • Delete the text in the Override built-in specs with the contents of the specified file (-specs)
        • Starts out at "nosys.specs", delete all this text so the box is empty.
      • Apply and Close
  • Build Project
    • Project->Build Project
    • or ctrl-B

Run the executable on the target

  • Transfer file to the target
    • Open the terminal view. Window->Show View->Other...->Terminal->Terminal
    • Press the Open a Terminal button (shift-ctrl-alt-T)
      • Local Terminal
    • Enter commands in the local terminal
      cd <workspace_path>/hello_arm/Debug
      scp hello_arm.out root@<target_ip>:
      
  • Run the program on the target:
    • Enter this command in the local terminal
      ssh root@<target_ip> ./hello_arm.out
      
      • where <target_ip> is the ip address of your target
      • Should see: Hello world from hello_arm

Step through the program

  • Start gdbserver on the target:
    • In Local Terminal window:
      ssh root@<target_ip> gdbserver :10000 ./hello_arm.out
      
    • Should see output like
      Process ./hello_arm.out created; pid = 4000
      Listening on port 10000
      
  • Make a debug configuration:
    • Run->Debug configurations
      • Pick C/C++ Remote Application->right-mouse->New Configuration
        • Main tab:
          • At bottom of page with "Using GDB (DSF) Automatic Remote Debugging Launcher" Click on Select other...
            • Check the checkbox for Use configuration specific settings
            • Select "GDB (DSF) Manual Remote Debugging Launcher"
            • Click OK
        • Debugger tab:
          • Debugger Options Main tab:
            • GDB debugger: change gdb to gdb-multiarch
          • Debugger Options Connection tab:
            • Change "Host name or IP address" from localhost to your target ip address
            • Change Port number to 10000
        • Click on Debug
    • CCS will switch to Debug Perspective
    • Stopped with arrow at printf line.
    • Open terminal view in the Debug Perspective (Window->Show View->Terminal)
    • In Local Terminal
      Remote debugging from host ::ffff:10.0.103.179, port 41160
      

      where 10.0.103.179 is your host ip address. The port will vary.
    • Step over
      • Run->Step Over
      • Step over button
      • or F6
    • Step over again to get past the fflush()
    • In Local Terminal window, should see
      Hello world from hello_arm
      
    • Terminate debug session
      • Terminate button
      • or Run->Terminate or ctrl-F2

Breakpoints

While a CCS project can be used to build a working executable and you can connect to that executable through a gdbserver connection, you cannot set breakpoints in the program. It is likely that since it is a CCS project, setting a breakpoint assumes it is a JTAG connection and can't set the breakpoint through gdb.

If you want an executable that can be debugged with breakpoints, use the C/C++ Projects.

Summary

This page has shown the steps needed to create, build, run, and debug a simple hello world C program using a CCS project. The same steps would be used for a more complicated program.

It has also been concluded that since breakpoints cannot be used, this is not a viable option when building a C/C++ program for the ARM.

Go to top
Add picture from clipboard (Maximum size: 1 GB)