element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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: Develop and Debug with Derek Molloy's GPIO Lib and Code Composer Studio
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join BeagleBoard to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 7 Jun 2019 5:28 PM Date Created
  • Views 1814 views
  • Likes 7 likes
  • Comments 1 comment
  • bbb
  • BeagleBone
  • beaglebonegreen
  • derek molloy
Related
Recommended

BeagleBone: Develop and Debug with Derek Molloy's GPIO Lib and Code Composer Studio

Jan Cumps
Jan Cumps
7 Jun 2019

How to develop a Linux binary for the BeagleBone (any colour) on Windows in CCS, using BB guru Derek Molloy's GPIO lib.

image

This blog has a history. I was working with my very good friend martinvalencia to get this working. This blog shows the end result: how we got it working. Not shown: all our failures when discussing this over Hangouts.

 

Derek Molloy is arguably the best source for BB tutorials. His libraries are well designed too. Here's an instruciblo on how to use his GPIO lib with CCS.

The goal - in the theme of my previous BB blogs: build a linux executable for the BB on your laptop in CCS and debug it from there.

I will not build the library from source - that's another interesting exercise, maybe for another blog. I'll reuse the shared library that Derek hosts on github.

That library, in binary form, can be downloaded from here: https://github.com/derekmolloy/exploringBB/blob/version2/library/libEBBLibrary.so?raw=true.

You will need it on your development PC and on the BB.

 

Download it to your PC first and move it to a directory of preference. We'll link to it later in CCS.

Also download the GPIO header file, and copy it on your development PC, where you downloaded the .so file, in a subdirectory GPIO.

 

Then copy the .so file to the BB, to the /usr/lib folder. You'll need root rights for that, so easiest is to copy it to your home (e.g.: with winSCP), then move it in Linux.

 

cd /usr/lib
sudo mv ~/libEBBLibrary.so .
ldconfig -n -v /usr/lib

 

 

Your BeagleBone is now ready to run the library and you have the dependency on your development PC. Let's start CCS and create a new project.

File -> New - > Project -> C++ Project

image

Name it GPIOTest. Select Empty Project, Cross GCC (we use the Linaro GCC cross-platform compiler).

image

Make a new folder, called src

image

In that folder, create a new C++ file called main.cpp

image

 

Copy the following source (I got it from martinvalencia - It's the source he uses to test the library, I don't know where it is coming from)

 

#include<iostream>
#include<unistd.h> // required for usleep - microsecond sleep
#include"GPIO.h" // using user-include syntax


using namespace exploringBB;
// bring in everything from this namespace
using namespace std;
// bring in standard namespace


int main() {
    GPIO outGPIO(49), inGPIO(115); //P9_23 and P9_27 respectively
// Basic Output - Flash the LED 10 times, once per second
    outGPIO.setDirection(GPIO::OUTPUT);
    for (int i = 0; i < 10; i++)     {
        outGPIO.setValue(GPIO::HIGH); // LED on
        usleep(500000); // sleep 0.5 seconds
        outGPIO.setValue(GPIO::LOW); // LED off
        usleep(500000);
    }


// Basic Input example
    inGPIO.setDirection(GPIO::INPUT); // is the button pressed?
    cout << "The value of the input is: " << inGPIO.getValue() << endl;
// Fast write to the GPIO 1 million times
    outGPIO.streamOpen();
    for (int i = 0; i < 1000000; i++)     {
        outGPIO.streamWrite(GPIO::HIGH); // no sleep. As fast as possible.
        outGPIO.streamWrite(GPIO::LOW);
    }
    outGPIO.streamClose(); // close the stream and exit
    return 0;
}

 

Then start configuring the project.

Set the builder to Internal:

image

Got to the Build settings, and add the GPIO header file directory:

image

 

On my PC: "D:\users\jancu\Documents\elektronica\Texas Instruments\bbb\exploringBB\GPIO".

Then tell the linker where the shared library is.

 

image

 

On my PC: "D:\users\jancu\Documents\elektronica\Texas Instruments\bbb\exploringBB"

That's it. Build it.

image

 

Now it's time to debug. Copy one of your working debug configurations and adapt it for this project.

image

If you don't get something like this, you may want to re-read this blog: BeagleBone: Build and Debug a Linux C++ Program with Code Composer Studio

image

Good luck!

 

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
Attachments:
GPIOTest.zip
  • Sign in to reply

Top Comments

  • martinvalencia
    martinvalencia over 6 years ago +1
    Hey, gracias por compartirlo, esto es genial!
  • martinvalencia
    martinvalencia over 6 years ago

    Hey, gracias por compartirlo, esto es genial!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
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