STM32F4 Development Environment
Follow this link to download the bash file for Linux and install the latest version of CMake. Example of bash file for Ubuntu cmake-3.12.2-Linux-x86_64.sh
. To install cmake from .sh
file downloaded run the commands similar to the following:
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake
Answer Y
for license and answer N
for including subdirectory. Then, add your binary link for Cmake.
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
Test your Cmake by typing in cmake --version
A detailed instructions and troubleshooting can be followed in this link to install GNU MCU Eclipse ARM Embedded GCC. The official webpage of gnu instructs installing the compiler in the /opt
folder but is not necessary. In the CMakeList.txt
, the path to the compiler is pointed to the folder of this repository. A quick installation instruction can be followed below:
-
The GNU/Linux versions of GNU MCU Eclipse ARM Embedded GCC are packed as .tgz archives. Download the latest version from this link named like
gnu-mcu-eclipse-arm-none-eabi-gcc-7.3.1-1.1-20180724-0637-centos64.tgz
. -
To install the toolchain, unpack the archive and copy it to
/${HOME}/path-to-this-repo/gnu-mcu-eclipse/arm-none-eabi-gcc/
: -
$ cd <this repo>
-
$ mkdir gnu-mcu-eclipse
and$ cd gnu-mcu-eclipse
-
$ mkdir arm-none-eabi-gcc
andcd arm-none-eabi-gcc
-
$ tar xf ~/Downloads/gnu-mcu-eclipse-arm-none-eabi-gcc-7.3.1-1.1-20180724-0637-centos64.tgz
-
$ chmod -R -w "${HOME}"/path-to-this-repo/gnu-mcu-eclipse/arm-none-eabi-gcc/7.3.1-1.1-20180724-0637
Follow the instructions in this link to install OpenOCD
. Example instructions:
- Download the latest version from this link named like
gnu-mcu-eclipse-openocd-0.10.0-8-20180512-1921-centos64.tgz
- To install the toolchain, unpack the archive and copy it to
/${HOME}/path-to-this-repo/gnu-mcu-eclipse/openocd/
: $ cd <this repo>/gnu-mcu-eclipse
$ mkdir openocd
andcd openocd
$ tar xf ~/Downloads/gnu-mcu-eclipse-openocd-0.10.0-8-20180512-1921-centos64.tgz
$ chmod -R -w "${HOME}"/path-to-this-repo/gnu-mcu-eclipse/openocd/0.10.0-8-20180512-1921
- Mount the network drive
Sandbox (\\fsvs01)
to your Ubuntu partition. Instructions are available here. - Copy
en.stm32cubef4.zip
fromSandbox (\\fsvs01)
to your local direction somewhere. - Unzip the folder in the directory of this repository.
The order of commands are described in instructions_to_load.txt
in this repository
- Open
OpenOCD
by running your edited bash file withbash openocd.sh
- Open
GDB
by running your edited bash file withbash gdb.sh
- In the
GDB
terminal, connect to the chip, select the binary file you compile, and enablesemihosting
(so that you can useprintf
) by runningsource gdb_src
- Enter
load
to load the program onto the STM32 chip. - Enter
c
to allow the chip to go ahead witht the program. You can find more detailed OpenOCD commands here.
This makes a good and economical programmer when you don't have a dev board with ST-Link.