Finally the right Eclipse project configuration!

I don't want a fully fledged Eclipse project or depend on heavy Eclipse for anything.~

I don't know if you have the same feeling, but it doesn't look like a good idea to depend on one heavy tool for anything in your electronic project. Having easy-to-understand scripts for building or debugging the project will make the life easier to newcomers (...or to yourself when you come back 3 years later and all the tools you used initially are now outdated).

Of course, from a former continuous integration engineer, I would also rise the obvious problem of automating your project in a CI environment. Yes, Eclipse can run headless, but this this is a dirty solution. Simple command-line tools are the way to go.

But, you still want a modern IDE where you can program and debug in the same tool. Proprietary debuggers such as Greenhills MULTI [1], Lauterbach Trace32 [2], iSystem WinIdea [3], PLS UDE [4]... are very well integrated for debugging, but not very much for programming. Also they are very expensive. Still have a look at iSystem WinIdea Open, which is free for ARM development and comes with a nice DIY hardware debugger board (see the do-it-yourself iTAG.ZERO and the 50€ iTAG.FIFTY at [5]). Unfortunately this last option only works with Microsoft Windows.

By the way, I discovered there is a standalone eclipse debugger [6].

I like Greenhills MULTI and it works under GNU/Linux as well, but there is no free/non-commercial version.

For the hardware debugger probe, don't forget to check the famous and always well-supported SEGGER J-Link [7]. Also see the "Why J-Link?" section of GNU ARM Eclipse project at [8] for explanations about the advantages of this probe (e.g., 15MHz JTAG). The education/non-commercial version named "SEGGER J-Link EDU" costs about 60€ (without VAT), see at Farnel [9].

There are Chinese copies of the J-Link easily found on eBay or Taobao for about 10€, but be careful that SEGGER invests a lot of efforts into fighting illegal Chinese copies. The official J-Link software [10] will brick your Chinese J-Link probe by flashing a new (brocken) firmware automatically.

How to architecture your embedded project?

If you want an all-in-eclipse project, I suggest to follow the 4-part tutorial from Akhmad Hendriawan at [13], [14], [15] and [16]. The problem is, as explained a the beginning of this post, that everything depends on eclipse, which is bad (R)

In addition, I am targetting a bare-metal solution, excluding any compiler start-up and standard C or C++ library (newlib).

Create a new empty project:

By disabling the default build command, all the GNU ARM Ecplise auto build is removed:

For example, the build script could be like this:

# Simple build script


$GCC_BIN_PATH/arm-none-eabi-g++ -g -std=gnu++0x -fno-exceptions -mcpu=cortex-m3 -mthumb --specs=nosys.specs -I inc/ -T myEmbeddedProject.ld \
myEmbeddedProject.cpp \
-o myEmbeddedProject.elf

# for debug purposes only
$GCC_BIN_PATH/arm-none-eabi-objdump -xmyEmbeddedProject.elf > objdump.log

# convert elf into hex for flashing
$GCC_BIN_PATH/arm-none-eabi-objcopy -O ihex myEmbeddedProject.elf myEmbeddedProject.hex

You can create External Tools Configurations to flash the target, or run the OpenOCD gdb server:

For example, the flash script could be like this:

# Simple flash script


$OPENOCD_BIN_PATH/openocd -f $OPENOCD_TCL_PATH/interface/stlink-v2.cfg -f $OPENOCD_TCL_PATH/target/stm32f1x_stlink.cfg -c init -c targets -c "halt" -c "flash write_image erase myEmbeddedProject.elf" -c "verify_image myEmbeddedProject.elf" -c "reset run" -c shutdown

The debug configuration for OpenOCD:

For example, the debug script could be like this:

# Simple script for gdb server


$OPENOCD_BIN_PATH/openocd -f $OPENOCD_TCL_PATH/interface/stlink-v2.cfg -f $OPENOCD_TCL_PATH/target/stm32f1x_stlink.cfg


If you install EmbSysRegister for eclipse, you can have a nice special functions registers (SFR) view matching your microcontroller.

Enjoy programming, flashing and debugging with eclipse, without relying on eclipse in your project!


[1]Greenhills MULTI,
[2]Lauterbach Trace32,
[3]iSystem WinIdea,
[5]iSystem, iTAG family,
[6]Eclipse, CDT/StandaloneDebugger,
[7]SEGGER J-Link base,
[9]GNU ARM Eclipse, "How to install the SEGGER J-Link?",
[10]SEGGER, J-Link software,
[11]ST, STM32F0 discovery board,
[12]Andy's Workshop,
[13]Waveshare Electronics, ST-Link/V2 mini,
[14]Akhmad Hendriawan, (part 1/4)
[15]Akhmad Hendriawan, (part 2/4)
[16]Akhmad Hendriawan, (part 3/4)
[17]Akhmad Hendriawan, (part 4/4)