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
RoadTests & Reviews
  • Products
  • More
RoadTests & Reviews
Blog HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 2: MICA Debian Stretch Setup
  • 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 3:41 PM Date Created
  • Views 915 views
  • Likes 6 likes
  • Comments 2 comments
Related
Recommended
  • iiot
  • cross-compiling
  • mica
  • harting
  • eclipse

HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 2: MICA Debian Stretch Setup

Jan Cumps
Jan Cumps
26 Apr 2019

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

In this post, I continue the work to cross-develop a MICA C application on a Windows computer with Eclipse.

This time: prepare a MICA Debian Stretch Container that will run our C executable and talks to I/O pins.

image

I'm using the Linux Debian Stretch Container here - a reasonable lightweight yet complete MICA options to deploy Linux solutions.

 

 

In the previous post, I set the goals and expectations of this project: How to set up an interactive environment where you can write code, deploy, test and debug.

 

Choose a Container

 

In the MICA world, you don't work with a single Linux operating system. All functionality is expected to be modular.

You don't have access to the main Linux OS. Even though its kernel is shared with all containers (the MICA lingo for a module), you never talk to it, except when deploying a firmwware upgrade.

 

MICA offers a number of development containers that allow you to build a functional module that you can deploy and execute on the device.

Four of those are pure Linux containers, each with their own attributes and specialisation (and resource requirements)

  • Debian Jessie: a full fledged Linux environment. It's the largest one, and is best suited for developers. It's not intended to be the basis of a production Container.
  • Debian Stretch: a way slimmer Linux. It is the bare basics but can be adapted to include the Linux options and packages that you require for your functionality. I use that one in this post.
  • Busybox: the smallest Linux option, with a limited toolset - following the Busybox paradigm. If you have a program that runs on Linux but but has a limited set of dependencies and doesn't rely on a broad Linux command set, this one is great. I will cover that later in the blog series.
  • Alpine Linux: a general puropose Linux container that I haven't reviewed yet.

 

image

image: deployed size of the three Linux containers I reviewed

 

Set up the Debian Stretch Container

 

HARTING published a set of Linux containers that are ready to deploy.

 

 

image

image: the types of containers provided by HARTING. Source: MICA Container Website

 

Many of these are blocks that allow you to integrate with applications and protocols that are common in industrial settings.

The Linux Development containers are available in the Development group.

image

image: Linux and a subset of other development containers provided by HARTING. Source: MICA Container Website

 

Because I want ti use the MICA GPIO library - that relies on a Debian container, but I don't plan to develop my application on the MICA - I choose the Debian Stretch container.

It's the smallest full-linux one.

(as promised, I will show an example that runs on the even smaller Busybox container in a follow up post)

 

To get that container on the MICA, you have to download it, then deploy via the MICA Install page.

I will not describe that activity here. It's explained in the Programming Guide.

I named my container DebianStretchRoadtest.

 

In my network - that is not fully IPv6 compliant - I have to enable IPv4 after installation. I do that by right -clicking on the container, then select Options -> Settings.

image

I then enable IPv4:

image

 

Once that's done, I start the container and I have a fresh Linux environment at my disposal.

To be able to use it with Eclipse, I have two dependencies:

  • an sFTP server so that Eclipse can deploy the binary that's been built on the Windows development PC.
  • GNU Debug Server, in order to be able to debug the binary from the Eclipse environment, while our process is running on the MICA.

You log on to the container via SSH (e.g.: PuTTY). The server name is <container>-<MICAname>. In mu case:DebianStretchRoadtest-mica-grvnb.

Set Up sFTP

 

I'm using the openSSH server (note: the HARTING doc says to use openSSH client, but I think that's incorrect).

 

apt-get update
apt install openssh-server
service ssh restart

 

Set up GDBSERVER

 

apt-get install gdbserver

 

Create a Directory for your Binary Executables

 

mkdir ~/bin

 

That's it. We now have a Linux version deployed that can fully integrate with a remote Eclipse from Windows (or an Eclipse from another OS).

From now on, if you use standard Linux libraries, you can start developing and debugging.

But or goal is to work with MICA's GPIO library ...

image

 

Install the GPIO Library

 

You download the LIB from the same location where you got the Linux container.

But you don't deploy it via the MICA's install option. You deploy it into the Linux Debian Stretch container.

 

For that, use a sFTP client (such as WinSCP) to move the file to your container (see above for the servername).

Then follow the instructions from the GPIO library documentation.

image

image: GPIO lib installation instructions. Source: http://mica-container.com/container/libmica-gpio/MICA_GPIO_Library.pdf

 

 

The Linux container is now ready to run C executables that talk to the MICA I/O pins. In the next post I'll show how to set up the Eclipse part on your Windows PC.

You'll have to set up the ARM Eclipse version (DS-5 Community Edition) and a C/C++ toolset (Linaro's Windows-hosted cross-compiler for ARM Linux).

You will also have to download the libraries we've installed in the Linux environment in the above step (mica-gpio and it's dependencies on 2 other libraries).

 

The image below shows what it looks like when everything is finished and you have built and deployed the C executable to the container (the next two blog posts will bring you there):

 

image

What you don't see is that this switches I/O pin 1 between 0 and 24 V, but believe me, it works.

Before we get to this point, we'll first write the C program that talks to the pins, and debug it from your Eclipse environment. Hang on ...

 

 

image

 

 

Resources:

 

All documentation: https://harting.sharefile.eu/share/view/f44fb84a17fa44d4/foa04599-9bd6-41cb-8a4b-937365183354

Containers: MICA Container Website

 

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

  • Jan Cumps
    Jan Cumps over 6 years ago +1
    I accidentally posted this blog before it was finished. It's complete now.
  • DAB
    DAB over 6 years ago +1
    Nice update. DAB
  • DAB
    DAB over 6 years ago

    Nice update.

     

    DAB

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

    I accidentally posted this blog before it was finished. It's complete now.

    • 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