I’ve been looking for a while for a template project to use with my STM32-P103 board.
In the STM32 Standard Peripheral Library there is a template project for most IDEs used in embedded dev. However I was looking for a project to use with CodeSourcery ARM-GCC toolchain.
You can find the repository here:
hg clone http://bitbucket.org/corfr/stm32template
- Just clone it, and you will have the “base”
- Then edit the Makefile to specify your PROJECT_NAME
- Eventually change TC_PREFIX to specity the path of your toolchain
maketo make the project, then
make programto program the target.
To debug the project, you can run
make debug to launch openocd. Then you will have to connect to the openocd server on port localhost:3333 .
Without GUI for gdb, just do:
arm-none-eabi-gdb --eval-command="target remote localhost:3333"
It should run gdb in command line and connect to the target (you must have openocd running along).
I’m used to Eclipse, so I use Zylin CDT plugin with Galileo. Make a new debug configuration using “Zylin embedded debug (Native)” base, and in the “Commands” tab, put “target remote localhost:3333” in Initialize. In “C/C++ Application”, select the .axf file.
The project is configured to work with the Amontec JTAGkey and is just setting up USART2 (on board serial port) and blinking Status LED.
I’m opened to any suggestion for that template, feel free to comment.
You can also find other templates, like that one from outroot STM32 Project template for HD devices.