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
RoadTests & Reviews
  • Products
  • More
RoadTests & Reviews
Blog HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 3: Eclipse Configuration on Windows
  • Blog
  • RoadTest Forum
  • Documents
  • RoadTests
  • Reviews
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join RoadTests & Reviews to participate - click to join for free!
  • Share
  • More
  • Cancel
  • Author Author: Jan Cumps
  • Date Created: 26 Apr 2019 10:18 PM Date Created
  • Views 673 views
  • Likes 7 likes
  • Comments 1 comment
Related
Recommended
  • iiot
  • industrial
  • cross-compiling
  • mica
  • harting
  • iiot4
  • arm

HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 3: Eclipse Configuration on Windows

Jan Cumps
Jan Cumps
26 Apr 2019

I'm road testing the Harting MICA Complete IIoT Starter Kit.

In the previous post, I reviewed the setup of a development Linux container on the MICA.

In this post, I'll show how to set up and configure Eclipse on a Windows 10 computer and how you can build and debug an application.

image

I'll start with a simple C++ "Hello, world!" example. When that works, we can concentrate on the last step and talk to a hardware I/O pin.

 

 

Install ARM Eclipse DS-5 Community Edition

 

ARM offers a free community edition of their Eclipse variant, DS-5.

This is an impressive environment (together with Silicon Labs IDE and TI's CCS one of the best Eclipse ports I've worked with).

It comes without a C tool chain, but we'll install that in the next section.

 

To install, press the Download button on the page linked above and enter your contact details.

You will receive a mail with the download link.

Once downloaded, execute the installer. If that's successful, start DS-5 and check for updates.

 

One of the nice bonuses is that when you finish this setup, you have an environment that also works for the BeagleBone and Raspberry PI.

 

Install a C Cross-Platform Toolchain for ARM Linux

 

The second part is also easy, but you have to be a bit careful.

Download one of Linaro's cross-compile toolchains. HARTING proposes to use the same version as used to compile their Linux containers.

 

image

 

Place this file on your computer. We'll have to unzip it.

It's best to place it in a permanent location where you want to keep the tool chain on your computer.

The easiest way is to use 7-ZIP. You have to start 7-ZIP as ADMINISTRATOR. Failing to do so will give you a non-working tool chain.

7-ZIP has to make symbolic links during the extract and that requires administrator rights.

 

in 7-ZIP, navigate to the .tar.xz file and open it.

Then select the .tar file that's shown in the list. Press the Extract button. Don't exit 7-ZIP.

 

When this is finished, navigate to where you extracted the .tar file in 7-ZIP and open it.

Select the line in the list (it starts with gcc-linaro...). Press the Extract button.

When you get a prompt for existing files, select Replace All.

Done! You can exit 7-ZIP now.

If you accidentally extracted without elevated Admin rights, you'll get error messages. In that case, delete everything that's extracted, run 7-ZIP as admin and start over.

 

 

Next action is to register the tool chain in Eclipse.

Go to  the menu Windows -> Preferences, and add the tool chain you just installed.

image

You have to navigate to the bin path under the install folder.

You now have a cross-platform build environment.

 

 

Configure a Remote System for the MICA

 

We have to register the MICA system as a remote system.

Eclipse will use this to deploy our binary to the MICA , start the remote debug server on the MICA and communicate with it when we're ready to test.

It's neat that all of this is done for us by the development environment.

 

Open the Remote Systems view via Windows -> Show Window -> Other -> Remote Systems -> Remote Systems

In that new window, click on the Define a Connection button.

image

Select SSH Only.

In the Host Name field, enter the network name of your container.

This is exactly the same name you used in the previous post to connect with PuTTY (for me: DebianStretchRoadtest-mica-grvnb).

You can use the same name as connection name. That will be displayed in the Remote Systems window later on.

Your user is root. If you listened well to Gough Lui, you have changed the password of the container. Enter that password. (if you didn't listen to him, use the password root).

Keep on clicking Next until the Finish button is active. Keep all suggested settings. Then click Finish.

You can now right-click on the Remote System and select Connect.

If you click the "Save Password" checkbox, you will not be prompted for logon info later on. Up to you.

 

Build an ARM Linux "Hello, world!" C++ Executable

 

It's time to create and build our first C++ program.

Go to File -> New -> C++ Project.

Name it mica_hello_world.

Select Hello World C++ Project. In the tool chains box, select the one you just registered.

image

Click Next, (you can change the settings on the next page if you want), then Finish.

Your new project is created.

Open the src folder and double-click on mica_hello_world.cpp.

You will see the code in the editor. No need to change it.

 

Select your project. Then right click on it and select Build Project.

If all is OK, you should see something like this in the Console window:

 

23:55:54 **** Build of configuration Debug for project mica_hello_world ****
make all 
'Building file: ../src/mica_hello_world.cpp'
'Invoking: GCC C++ Compiler 4.9.3 [arm-linux-gnueabihf]'
arm-linux-gnueabihf-g++.exe -O0 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"src/mica_hello_world.d" -MT"src/mica_hello_world.o" -o "src/mica_hello_world.o" "../src/mica_hello_world.cpp"
'Finished building: ../src/mica_hello_world.cpp'
' '
'Building target: mica_hello_world'
'Invoking: GCC C++ Linker 4.9.3 [arm-linux-gnueabihf]'
arm-linux-gnueabihf-g++.exe  -o "mica_hello_world"  ./src/mica_hello_world.o   
'Finished building target: mica_hello_world'
' '

23:56:04 Build Finished (took 9s.806ms)

 

 

Congratulations! Your first cross-built binary can be seen here:

image

 

We're ready for the big step now. Deploy to the MICA and step through the code.

 

 

Deploy and Debug

 

We'll now tell Eclipse how to deploy the binary and how to start the debugger on the MICA.

 

Go to Run -> Debug Configurations.

Select the DS-5 Debugger entry and click the New button.

image

In the first dialog we get, enter the following info on the Connection tab.:

Name: DebianStretchRoadtest_mica_hello_world

(because a debug configuration contains the connection to our device, I prefer to put the target container in the debug name).

 

Select the Linux Application debugger shown below:

image

Click on the Files tab and enter these values:

image

Target download directory and working directory: /root/bin (we created that in the previous post while configuring the Debian Stretch container).

image

 

Click Apply.

Click Debug (It's happening !!!)

 

If all is OK, you will end up with a situation like below:

image

 

Eclipse opens the Debug perspective.

Your binary is uploaded to the MICA, the debug server on the MICA is started and the Eclipse debugger halts execution on the main() function.

 

You can now step through the code and look at the various consoles and debug windows.

When you step over the line that starts with cout, you will see the message logged in the App console window.

The debugger does that for you. It routes the standard output to Eclipse so that you can see it while debugging.

 

Major achievement unlocked.

When this works, the complete tool chain is ready for the real thing: program the hardware.

The next post handles getting the necessary libraries on your Windows PC and finally making that I/O example.

 

Related Blog
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 1: User Experience
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 2: MICA Debian Stretch Setup
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 3: Eclipse Configuration on Windows
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 4: Build and Debug the GPIO Example
HARTING MICA: Make a Safe(r) MQTT Container with Certificate and TLS/SSL
HARTING MICA: Manage Access to USB and other Devices
HARTING MICA: SD Card as Shared Storage
HARTING MICA: Alpine Linux and another MQTT Container with Certificate and TLS/SSL
HARTING MICA: Connect to Amazon Web Services
HARTING MICA: Install Java 8 VM in a Debian Stretch Container
HARTING MICA: Read BOSCH CISS Sensor with Java - part 1: USB Connect and Listen
  • Sign in to reply

Top Comments

  • DAB
    DAB over 6 years ago +1
    Good update Jan. DAB
  • DAB
    DAB over 6 years ago

    Good update Jan.

     

    DAB

    • 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