Top Internet of Things Daily & Weekly

Breathing With Oxygen: DIY Arm Cortex-M C/C++ IDE and Toolchain

Breathing With Oxygen: DIY Arm Cortex-M C/C++ IDE and Toolchain  #IoT #Cloud #BigData

  • Installing a custom DIY Eclipse-based IDE for C/C++ development for any ARM Cortex-M devices is pretty simple and requires about 20-30 minutes, including download time.
  • So I select the ‘Download Packages‘ link and use the “Eclipse IDE for C/C++ Developers” (around 200 MByte):

    The package is an archive/ZIP file.

  • Download the latest version install the plugins in Eclipse, use the menu Help > Install New Software and use the archive file from the previous step:

    A restart of Eclipse is asked at the end of the installation process.

  • The setting for the Global Build Tools Path is in Eclipse (menu Window > Preferences):

    I’m using the ${eclipse_home} variable to keep things relative to my Eclipse IDE:

    Same for the setting pointing to the ARM toolchain:

    This step is only needed if you plan to use the SEGGER J-Link debug probe.

  • zip file, which I can extract into the Eclipse IDE folder).

As useful as IDEs are, they often come with restrictions. Here’s how to make an unlimited Eclipse-based IDE and toolchain for ARM Cortex-M development.

@craigbrownphd: Breathing With Oxygen: DIY Arm Cortex-M C/C++ IDE and Toolchain #IoT #Cloud #BigData

In June, the latest version of Eclipse Oxygen was released, and I have successfully used it in several embedded projects. Time to write a tutorial how to use it to build a custom do-it-yourself IDE for ARM Cortex-M development: simple, easy, unlimited, and free of charge. While the DIY approach takes a few minutes more to install, it brings the advantage of me having full control and I actually know what I have.

Eclipse Oxygen (4.7) is the latest and most advanced version of Eclipse as of today. It comes with many new and useful features, see https://www.eclipse.org/eclipse/news/4.7/. This article describes how to build a custom DIY IDE for development for any ARM Cortex-M based device.

Vendor-provided Eclipse IDEs are maybe easier to install for a newbie and can have great extension features. But on the other hand, the licensing terms put some usage limits (e.g. I can use the IDE only for devices from that vendor, or other kinds of limitations). As, at the university, we are building up a new curriculum with a course that uses microcontrollers from multiple vendors, we are going to use a custom DIY Eclipse version that we can have installed on every student’s machine without any strings attached.

Installing a custom DIY Eclipse-based IDE for C/C++ development for any ARM Cortex-M devices is pretty simple and requires about 20-30 minutes, including download time. I need:

My screenshots show things for a Windows 10 64-bit machine, but everything applies to Linux or Mac machines as well.

In the installation instructions below, I prefer to download the ZIP/archive packages: That way, I can build up an Eclipse installation with no need for an installer: everything is included in a directory tree I can easily ZIP for a backup or pass to someone else. The only exception is the debug probe support files, as they run an installer to install the necessary USB device drivers.

This step includes the core of everything: the Eclipse IDE and framework.

Go to http://www.eclipse.org/downloads/ and choose your package to download and install. The default is to download a small installer, which then downloads the other files while installing. I prefer the ‘Download Packages’ method, as with this, I get everything on my disk as a ZIP file which then I can pass to students or install on multiple machines without downloading things multiple times.

So I select the ‘Download Packages‘ link and use the “Eclipse IDE for C/C++ Developers” (around 200 MByte):

The package is an archive/ZIP file. Extract the files to a folder, e.g. C:\Eclipse\Oxygen:

Here, again, I prefer the local archive way. Download the latest version from: https://github.com/gnu-mcu-eclipse/eclipse-plugins/releases

To install the plugins in Eclipse, use the menu Help > Install New Software and use the archive file from the previous step:

A restart of Eclipse is asked at the end of the installation process.

This step installs the needed compiler and build tools to develop for ARM Cortex.

Go to https://developer.arm.com/open-source/gnu-toolchain/gnu-rm and go to the downloads (https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads). I prefer the ZIP file (not the installer), as I don’t want the installer to make any environment or path changes.

Then, I unpacked the toolchain files into my Eclipse directory (c:\eclipse\oxygen\toolchain):

To run the build tools (echo, make, mkdir, rm), I need extra utilities on Windows.

Go to https://github.com/gnu-mcu-eclipse/windows-build-tools/releases and download the latest build tools ZIP file:

Place the folder inside the Eclipse Oxygen folder:

We need to tell Eclipse where to find the tools. I do not prefer using environment variables (see https://gnu-mcu-eclipse.github.io/toolchain/path/ for a detailed discussion), and instead, I like to point to the tools bundled with the IDE (that’s why I have installed it inside the IDE folder). The setting for the Global Build Tools Path is in Eclipse (menu Window > Preferences):

I’m using the ${eclipse_home} variable to keep things relative to my Eclipse IDE:

Same for the setting pointing to the ARM toolchain:

This step is only needed if you plan to use the SEGGER J-Link debug probe. The Segger probes are, of course, not free of charge, but many vendor boards (NXP Freedom/Tower boards, STM Nucleo boards, …) can be loaded with Segger firmware.

The J-Link software is available for download from https://www.segger.com/downloads/jlink/. Because it installs USB drivers, it is a setup executable that installs the drivers.

In the settings (Window > Preferences > MCU > Workspace), specify the file and path to the Segger GDB Executable:

With this, I can use the Segger J-Link debug connection.

If you have an STM board with the ST-Link on it, you can convert it into a Segger J-Link probe, see https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/

If you have the popular NXP LPC-Link2 debug probe, the same is described here: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/lpc-link-2/

This step is only needed if working with the P&E debug probes. Similar to the one from Segger, many boards can be loaded with a P&E debug firmware to debug it.

The P&E drivers can be downloaded from http://www.pemicro.com/opensda/ (user account/login required):

Download and run the setup to have the USB drivers installed. The Eclipse plugins are available from the Eclipse update site.

With this, I can use the P&E Multilink debug connection.

The easiest way for me to use any ST-Link2 is to convert it into a Segger J-Link (see https://www.segger.com/products/debug-probes/j-link/models/other-j-links/lpc-link-2/).

The other option is to use OpenOCD (if you insist), but OpenOCD always has been problematic for me and not very stable. The best option is to use the hassle free distribution of OpenOCD by GNU MCU Eclipse: https://gnu-mcu-eclipse.github.io/openocd/install/. Download the latest version from https://github.com/gnu-mcu-eclipse/openocd/releases (I, again, prefer the .zip file, which I can extract into the Eclipse IDE folder).

But Wait, There’s More…

The cool thing with Eclipse is that there are thousands of plugins. Here are a few pointers on what to add:

There are many more plugins you can use.

It does not take much to have a custom DIY IDE and toolchain around Eclipse Oxygen. Of course, it requires me to download and install several packages, but in the end, I have a fully featured IDE: simple to use, unlimited, and free of charge.

Happy Oxygening!

Breathing With Oxygen: DIY Arm Cortex-M C/C++ IDE and Toolchain