Hello!
As promissed in last post, I'll show you how to setup eclipse to work with the our STM32F0 discovery board + open source toolchain.
1) Open eclipse. First of all we need to install (if not already installed) two new software. So go to menu Help/Install New Software. In work with, type "http://download.eclipse.org/tools/cdt/releases/juno" and in the list below choose CDT Optional Features/ C/C++ GDB Hardware Debugging". Next in http://gnuarmeclipse.sourceforge.net/updates, select "GNU ARM C/C++ Development Support".
2) Create a new C Project. Go to menu File/New Project and select C/C++ - C Project. Click next.
3) In next window Choose under ARM Cross Target Application - Empty project. Select your toolchain (Sourcery G++ Lite) or (GNUARM).
4) Go to menu Project/Properties. In C/C++ Build / Settings select Tool settings. In Target Processor change "Processor" to cortex-m0.
5) Now in the same Tool Settings tab go to ARM Sourcery Linux GCC C Compiler / Preprocessor and add the following values:
USE_STDPERIPH_DRIVER
USE_STM32F0_DISCOVERY
STM32F0XX
6) Still in Tool Settings tab go to ARM Sourcery Linux GCC C Linker / General and uncheck "Do not use standard start file (-nostartfiles) and check "Remove unused sections (-Xlinker --gc-sections). In Script file (-T) set path: /home/stm32/workspace/Template/src/stm32f0.ld
7) In C/C++ General, select Path and Symbols and add the following paths (in both Assembly and GNU C):
/Template/Libraries/CMSIS/ST/STM32F0xx/Include
/Template/Libraries/
/Template/src
/Template/Libraries/STM32F0xx_StdPeriph_Driver/inc
/Template/Libraries/CMSIS/Include
8) Configure GDB by clicking in the small arrow in the right of the bug. Select "Debug Configurations... ". Select "GDB Hardware Debugging" right click and select new. Change name to GDB-OpenOCD and in the bottom of the window click in "Select other..." and select "GDB (DSF) Hardware Debugging Launcher".
9) Under tab Debugger, uncheck everything and set the path of your gdb from your toolchain: /home/user/stm32/gcc-arm-none-eabi/bin/arm-none-eabi-gdb
10) Under tab Start Up, uncheck everything and in "Run commands" add:
target remote localhost:3333
monitor reset init
monitor stm_flash /home/user/stm32/workspace/Template/Debug/Template.elf
load /home/user/stm32/workspace/Template/Debug/Template.elf
symbol-file /home/user/stm32/workspace/Template/Debug/Template.elf
cont
11) Now configure OpenOCD by clicking in the small arrow in the right of the play with toolbox (external tools). Select "External Tool Configurations... ". Select "Program" right click and select new. Change name to OpenOCD. Set openocd path: /usr/bin/openocd and working directory: /home/user/stm32/openocd-0.6.0-rc1/tcl
In "Arguments" write: -f /home/user/stm32/workspace/Template/extra/stm32f0discovery.cfg -f /home/user/stm32/workspace/Template/extra/stm32f0-openocd.cfg
If everything is OK, compile your hello world program. Go to "External Tools" and select "OpenOCD". It should show de following message in Console:
Open On-Chip Debugger 0.6.0-rc1 (2012-09-03-20:37)
Licensed under GNU GPL v2
[...]
Now, the great moment, put a breakpoint in your main and select the bug icon "GDB - OpenOCD". It should stop your code like this:
That's all for today!
Marcelo