Installing Eclipse + gcc for ARM

21 Nov 2013

Installing and running GNU gcc compiler for ARM

The tools referenced here will still not give an environment that is as slick as some of the better tools (like Atollic Pro). However, they don’t cost $5K - they are free.

I wrote these notes in the spring of 2013 for the rest of the team I was working with. I originally used the free version of Atollic, but quickly ran into the executable size limit. I have a project that I need to sanitize and post that will help clarify some of these steps.

There are many sites that tell how to do this - I referenced all of the ones I used at the end. However, I had the most luck with these steps:

Collect the software on your local machine:

The following should be installed on your machine

  1. Java. This should be in the path. You can verify this by opening up a command window and typing ‘java -version’. Check that version against what is listed at Oracle. Unless you are developing using a specific version of the JRE/JDK, you should use the latest. See this if you need any convincing. If you are not developing Java software, you will only need the JRE:

https://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html

  1. Eclipse, CDT version (the current version is Juno):

https://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr2

  1. GNU ARM toolchain: https://launchpad.net/gcc-arm-embedded. I used 4.6 q4

https://launchpad.net/gcc-arm-embedded/+milestone/4.6-2012-q4-update on the project I was on. (I had problems with the first 4.7 version. GDB kept crashing)

  1. OpenOCD (I used 0.6.1): There is a pre-compiled windows version at

https://www.freddiechopin.pl/en/download/category/4-openocd.

  1. YAGARTO tools and utilities (make, etc.):

https://www.emb4fun.de/download/arm/yagarto/yagarto-tools-20121018-setup.exe

Install Java/Eclipse

  1. Run the Java installation if needed
  2. Unzip the eclipse zip into a directory like c:\apps\eclipse_cpp. Avoid paths that include spaces.
  3. Make sure the latest updates are downloaded for Eclipse

Install Toolchain

  1. Install the toolchain to a directory path without spaces, something like c:\apps\gnuarm
  2. Add the directory to the system path
  3. Install the YAGARTO tools to the same directory so they are in the path also

Install Eclipse Plugins

  1. GNU ARM Eclipse plugin (toolchain configuration): https://gnuarmeclipse.sourceforge.net/updates
  2. Zylin Eclipse plugin (debugging additions): https://opensource.zylin.com/zylincdt
  3. EmbSysRegView Eclipse plugin (view peripheral registers): https://embsysregview.sourceforge.net/update

Caveats

https://launchpad.net/gcc-arm-embedded are more recent than those shipped with Atollic. You can overcome some of the slowness by using make -j’‘n’’ all, where ‘‘n’’ is the number of processors on your machine (assuming you have more than one). These are the versions used:

  1. gnuarm: gcc version 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision 192487] (GNU Tools for ARM Embedded Processors)

  2. Atollic: gcc version 4.6.2 20110921 (release) [ARM/embedded-4_6-branch revision 182083] (GNU Tools for ARM Embedded Processors (Build 12.01 Lite Lambda))

Debugging Setup

  1. Create a directory for openocd, and unzip the Windows zip file there. Add the appropriate bin directory to the path.

Debugging

  1. The debug configuration is stored on disk (the ‘Shared’ option in the dialog), so you should be able to see the same settings.

  2. openocd must be running before you can start debugging. I run mine in a separate command window. The following is from my shell script, but a batch file would look similar:

    OPENOCD32=”/Apps/openocd-0.6.1/bin/openocd-0.6.1.exe” OPENOCD64=”/Apps/openocd-0.6.1/bin-x64/openocd-x64-0.6.1.exe” OPENOCD=”${OPENOCD64}” INTERFACE=”openocd/interface/stlink-v2.cfg” TARGET=”openocd/target/stm32f4x_stlink.cfg” ${OPENOCD} -f ${INTERFACE} -f ${TARGET}

  3. After openocd is running, start up the debugger in Eclipse, with the appropriate .elf file. The debugging process will flash the new binary, start the program, and run to main().

More Notes

Most of what is here was taken or adapted from the following pages: