element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Blog BeagleBone: Build and Debug a Linux C++ Program with Code Composer Studio
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
BeagleBoard requires membership for participation - click to join
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 18 May 2019 5:17 PM Date Created
  • Views 9241 views
  • Likes 6 likes
  • Comments 18 comments
  • ccs
  • bb
  • linaro
  • cross-compiling
  • bbb
  • code composr studio
  • arm
  • bbg
  • beaglebone green
Related
Recommended

BeagleBone: Build and Debug a Linux C++ Program with Code Composer Studio

Jan Cumps
Jan Cumps
18 May 2019

How to develop a Linux binary for the BeagleBone (any colour) on Windows in CCS, auto-deploy it to the BB and remotely debug.

No hardware debugger needed - all runs over TCP/IP

image

The great PRU blog from Fred27 inspired me to pick up the BeagleBone Green again. Because he uses CCS as development environment, it makes sense to also use CCS for Linux native C and C++ development.

 

I've blogged before on  how to set up a BeagleBone C/C++ environment with the ARM DS-5 suite.

Both DS-5 and CCS are Eclipse based. Things are not that different, and it's no surprise that I could get the CCS flavour working.

Functionally, there's no gain with this exercise if you are already happily developing with DS-5. I did it to have everything in a single IDE.

 

Software needed

  • Code Composer Studio. I used version 9 but earlier versions will very likely work too.
  • Cross-compile GCC toolchain. I used gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf .
    I could not get newer version 7.x to work. Download this archive if you want to use the same setup as me: gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf.tar.xz
    attention: run your extract program (e.g.: 7-Zip) as Administrator when you extract the toolchain tar or you will not get a working toolchain.

 

Create a Project: Blinky

 

Start Code Composer Studio and start a New -> Project

Select an Empty project, with Cross GCC as toolchain.

 

image

Press Next until you are asked for the toolchain details.

The prefix: arm-linux-gnueabihf-

Path: the bin folder of the location where you extracted the toolchain (in my case: D:\users\jancu\Documents\elektronica\arm\linaro\gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf\bin)

 

image

Finish.

 

Now add a src folder in the root of your project.

in that folder, create a new C++ file called bb_gpio_test.cpp

For the content, I used Derek Molloy's C++ makeLED example: Beaglebone: Controlling the on-board LEDs using C++ | derekmolloy.ie | derekmolloy.ie

 

image

 

Copy the source and paste it in the cpp file you just created.

Save.

 

Build the Project

 

Try to build it straight away. If everything works, be happy.

If CCS complains it can't find make, go to Properties -> C/C++ Build -> Builder settings.

First try the Internal builder and build again.

 

If that step fails, manually select the builder.

Uncheck the Use Default build command.

Enter the path of the CCS make utility: ${CCS_UTILS_DIR}/bin/gmake -k -j 8

image

 

Set the CCS_UTILS_DIR to the ccs\utils subdirectory of Eclipse.

image

 

Build. You should now get a Binaries folder in your project, with the Linux native executable.

 

image

 

Deploy and Debug

 

Go to Run -> Debug configurations, and add a new C/C++ Remote Configuration.

 

image

When you select the project, it will automatically find your executable too.

Press the New... button next to Connection, and make a connection to your BB. The host name of your BB should be beaglebone.local.

You can use user name and password (debian/xxx) - or if you have enabled secure key logon with your BB, you can use your private certificate.

When the connection is entered, you can Browse... for the location on the BB where you want CCS to deploy the binary.

I created a bin folder in my BB home, so I select /home/debian/bin.

 

image

In the Arguments tab, you can the arguments that the debugger will pass to your application at start.

Derek's app expects one parameter that tells it what to do with the LED. I passed flash as argument. It will flash the led in a half second on - half second off pace.

image

 

Then define the debugger (GDB client) installed on your computer. The one of the Linaro toolchain isn't called gdb but arm-linux-gnueabihf-gdb.

image

You should not have to install the debug server on the BB if you use a recent Debian image. It's there already.

(Fred27' Debian did not have it by default. It can be installed by executing :

sudo apt-get update -y

sudo apt-get install gdbserver

).

 

Push Apply.

 

Go!

 

Push the Debug button. CCS will upload your executable to the BB, load the main file in the debugger and stop at the first instruction.

Now play with it. You can check variables, expressions, memory.

You can step through the code.

The Console shows the output from the Linux console.

The Debugger Console (Window -> New -> Debugger Console) shows debug info (experts can type gdb commands here).

 

If all is OK, you should, after some stepping, find yourself here:

 

else if (cmd=="flash"){
    fs.open (LED0_PATH "/trigger", std::fstream::out);
    fs << "timer";
    fs.close();
    fs.open (LED0_PATH "/delay_on", std::fstream::out);
    fs << "50";
    fs.close();
    fs.open (LED0_PATH "/delay_off", std::fstream::out);
    fs << "50";
    fs.close();
}

 

It's the blink code. Watch the green user LED (fun fact: on the BB Green the green LED is blue). It will blink.

 

Enjoy!

(also works for a Raspberry Pi)

 

Related Blog
BeagleBone - Cross Compile c++ on Windows
BeagleBone: Build and Debug a Linux C++ Program with Code Composer Studio
BeagleBone: Develop and Debug with Derek Molloy's GPIO Lib and Code Composer Studio
  • Sign in to reply

Top Comments

  • DAB
    DAB over 5 years ago +2
    Nice update Jan. I am amazed things worked out this well on a cross platform issue. DAB
  • Fred27
    Fred27 over 5 years ago +2
    Really useful - I'll have to give that a try. I wonder if the WSL (Windows Subsystem for Linux) on Windows 10 will work in place of MinGW.
  • balearicdynamics
    balearicdynamics over 5 years ago +2
    Jan it's a great and valuable post with a lot of information and references. The scenario is complete, so I bookmarked for the first time I should put my hands on the BB. Enrico
Parents
  • Fred27
    Fred27 over 5 years ago

    Great stuff. I ran through this guide with minimal issues. I didn't need MinGW even for "External builder", so I'll leave that out of the mix for now.

     

    The only things I found was that I got "Could not start gdbserver on the remote host" when debugging. This was easily solved by installing gdbserver on the BB (apt get install gdbserver). It's not installed by default but I assume you've used it for previous work.

     

    (There was something else - but that turned out to be me not reading things properly. image)

     

    These are the sort of things you only find when someone new runs through your steps, as you'll have done them without thinking as you sort the process out. (I'm sure there are similar missing pieces in my own PRU guides.)

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Fred27

    Fred27  wrote:

     

    ...

    The only things I found was that I got "Could not start gdbserver on the remote host" when debugging. This was easily solved by installing gdbserver on the BB (apt get install gdbserver). It's not installed by default but I assume you've used it for previous work.

    ...

    I seem to recall it was installed by default on the Debian Stretch Headless that I downloaded and deployed to test your PRU blog. There are some things different between headless Stretch IoT and non-headless Stretch LXQT.

    I will add your install instructions to the main post.

     

    I didn't need MinGW even for "External builder", so I'll leave that out of the mix for now.

    make on Windows is an enigma. There are so many variables that define whether you have it on your computer, whether it's in your path. Whether the right one is first in your path.

    Some development environments (even some Eclipse derivatives) install one and add it to your path. It's a mess image.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Fred27
    Fred27 over 5 years ago in reply to Jan Cumps

    Odd - I'm running the latest Debian Stretch headless too.

     

    I do have a fair few Eclipse-based IDEs installed. Who know what make setup I have! I don't suppose it's possible to write a guide that fits everyone's setup.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • Fred27
    Fred27 over 5 years ago in reply to Jan Cumps

    Odd - I'm running the latest Debian Stretch headless too.

     

    I do have a fair few Eclipse-based IDEs installed. Who know what make setup I have! I don't suppose it's possible to write a guide that fits everyone's setup.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube