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 , Lauterbach Trace32 , iSystem WinIdea , PLS UDE ... 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 ). Unfortunately this last option only works with Microsoft Windows.
By the way, I discovered there is a standalone eclipse debugger .
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 . Also see the "Why J-Link?" section of GNU ARM Eclipse project at 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 .
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 will brick your Chinese J-Link probe by flashing a new (brocken) firmware automatically.
The ST-Link/OpenOCD way
If you stick with ST microcontrollers, the ST-Link is cheap and well supported by open source tools. The ST-Link is embedded on ST discovery boards, which are so cheap that you can afford a board only for the debugger part. The STM32F0 discovery board comes with a ST-Link/v2 for less than 10$. The ST-Link can be used to debug another ST microcontroller using the SWD connector. A long discussion from Andy Brown about the advantage of the ST-Link can be found there .
By the way, there are also illegal Chinese copies of the ST-Link (this one does not look very much ST for example), but I can't see the point of supporting Chinese illegal copies when the original is just a few € more.
Example with a STM32F4 discovery board:
How to connect to the standard JTAG connector:
===== === ======
SWD <-> JTAG
===== === ======
VDD <-> Vref
SWDIO <-> TMS
SWCLK <-> TCK
NRST <-> nTRST
GND <-> GND
===== === ======
According to a quick probe on the SWCLK (common with JTAG's TCK) clock signal, the adapter appears to run at 1.5MHz.
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 , , and . 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 \
# 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!