STM32 dev: Difference between revisions
(Created page with "STM32 eval microcontroller, mcu, arm, stm32") |
No edit summary |
||
| Line 1: | Line 1: | ||
== Description == | |||
Notes on STM32 microcontrollers and on how to get them working in DIY projects. | |||
''/// this is a work in progress draft ///'' | |||
== Software Tools == | |||
All about software tools for STM32 dev. Development environments, compilers, debuggers, IDEs etc. | |||
=== STM32CubeMX on Linux === | |||
STM32CubeMX is a code generator for STM32 micros that can come in handy when you start a new project. It generates all the necessary init and HAL code, library and custom pin mux code etc for that specific MCU. | |||
Unfortunately, it comes as a Windows EXE and ST doesn't mention that it is a Java application. Luckily it can be installed on Linux by hand (thanks to Joe's great note [http://fivevolt.blogspot.ch/2014/07/installing-stm32cubemx-on-linux.html there]): | |||
* Download [http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF259242?icmp=stm32cubemx_pron_prcube_feb2014&sc=stm32cube-pr STM32CubeMX]. | |||
* Install the application (tested in January 2016): | |||
<pre> | |||
$ unzip SetupSTM32CubeMX-4.12.0.exe -d stm32cube | |||
$ cd stm32cube | |||
$ java -cp . com.izforge.izpack.installer.bootstrap.Installer | |||
</pre> | |||
* Run: | |||
<pre> | |||
$ cd <install_dir> | |||
$ java -cp . java -cp . com.st.microxplorer.maingui.STM32CubeMX | |||
</pre> | |||
=== Convert STM32CubeMX generated project to GCC/Makefile === | |||
For whatever reason, STM32CubeMX does not export plain GCC/Makefiles along with the initialization code. Instead, it supports an unpopular IDE called [http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1533/PF261797 SW4STM32], which is based on free GNU tools. So after installin STM32CubeMX, these are the steps to get the GCC/Makefile project running: | |||
* Install arm-gnu-none-eabi- toolchain for your OS. On Arch Linux: | |||
<pre> | |||
$ sudo pacman -S arm-none-eabi-gcc arm-none-eabi-gdb arm-none-eabi-binutils | |||
</pre> | |||
* Get this nice Python script to generate the Makefile for an exported SW4STM32 project. | |||
<pre> | |||
$ git clone https://github.com/baoshi/CubeMX2Makefile | |||
$ cd CubeMX2Makefile | |||
$ python2 CubeMX2Makefile.py <your_sw4stm32_prject_dir> | |||
$ cd <your_sw4stm32_prject_dir> | |||
</pre> | |||
* Modify the Makefile (tested in January 2016). Look for __weak and remove the backslashes (needed, at least in Bash). More can read [http://www.ba0sh1.com/stm32cubemx-gcc-makefile/ here]. | |||
<pre> | |||
$ grep Makefile __weak | |||
,,,,,,,,,,, | |||
,,,,,,,,,,, | |||
,,,,,,,,,,, | |||
$ nano Makefile | |||
$ grep Makefile __weak | |||
$ make | |||
</pre> | |||
=== Flash === | |||
Install OpenOCD and STLINK. On Arch Linux. | |||
<pre> | |||
sudo pacman -S stlink openocd | |||
</pre> | |||
Now [http://openocd.org/ openocd] and (arm-none-eabi-)gdb can be used to program and debug the MCU! | |||
=== Debugging === | |||
/todo | |||
The power of raw (arm-none-eabi-)gdb -tui | |||
DDD | |||
IDE? | |||
== Hardware == | |||
/todo | |||
Minimal STM32 | |||
JTAG | |||
Serial | |||
..... | |||
== Projects == | |||
/todo | |||
bare metal hello blink | |||
I2C peripherals | |||
I2S peripherals | |||
SPI peripherals | |||
touch | |||
usb | |||
..... | |||
Revision as of 19:47, 21 January 2016
Description
Notes on STM32 microcontrollers and on how to get them working in DIY projects.
/// this is a work in progress draft ///
Software Tools
All about software tools for STM32 dev. Development environments, compilers, debuggers, IDEs etc.
STM32CubeMX on Linux
STM32CubeMX is a code generator for STM32 micros that can come in handy when you start a new project. It generates all the necessary init and HAL code, library and custom pin mux code etc for that specific MCU.
Unfortunately, it comes as a Windows EXE and ST doesn't mention that it is a Java application. Luckily it can be installed on Linux by hand (thanks to Joe's great note there):
- Download STM32CubeMX.
- Install the application (tested in January 2016):
$ unzip SetupSTM32CubeMX-4.12.0.exe -d stm32cube $ cd stm32cube $ java -cp . com.izforge.izpack.installer.bootstrap.Installer
- Run:
$ cd <install_dir> $ java -cp . java -cp . com.st.microxplorer.maingui.STM32CubeMX
Convert STM32CubeMX generated project to GCC/Makefile
For whatever reason, STM32CubeMX does not export plain GCC/Makefiles along with the initialization code. Instead, it supports an unpopular IDE called SW4STM32, which is based on free GNU tools. So after installin STM32CubeMX, these are the steps to get the GCC/Makefile project running:
- Install arm-gnu-none-eabi- toolchain for your OS. On Arch Linux:
$ sudo pacman -S arm-none-eabi-gcc arm-none-eabi-gdb arm-none-eabi-binutils
- Get this nice Python script to generate the Makefile for an exported SW4STM32 project.
$ git clone https://github.com/baoshi/CubeMX2Makefile $ cd CubeMX2Makefile $ python2 CubeMX2Makefile.py <your_sw4stm32_prject_dir> $ cd <your_sw4stm32_prject_dir>
- Modify the Makefile (tested in January 2016). Look for __weak and remove the backslashes (needed, at least in Bash). More can read here.
$ grep Makefile __weak ,,,,,,,,,,, ,,,,,,,,,,, ,,,,,,,,,,, $ nano Makefile $ grep Makefile __weak $ make
Flash
Install OpenOCD and STLINK. On Arch Linux.
sudo pacman -S stlink openocd
Now openocd and (arm-none-eabi-)gdb can be used to program and debug the MCU!
Debugging
/todo
The power of raw (arm-none-eabi-)gdb -tui DDD IDE?
Hardware
/todo
Minimal STM32 JTAG Serial .....
Projects
/todo
bare metal hello blink I2C peripherals I2S peripherals SPI peripherals touch usb .....