ECE271 STM32L4 Discovery Using Linux

This page has resources if you're interested in doing the ECE271 Labs using Linux/gcc/openocd rather than Windows/Keil.

Setting things up

You'll need to install some packages. This is how to do it if you are running Debian Linux.
	sudo apt-get install openocd
	sudo apt-get install gcc-arm-none-eabi
	sudo apt-get install stlink-gui
	sudo apt-get install gcc make git
You will want to install gdb as well. On recent versions of Linux you will want to:
	sudo apt-get install gdb-multiarch
On old machines you would install a different (now discontinued) package:
	sudo apt-get install gdb-arm-none-eabi
On Fedora if you get an error message about stdint.h being missing, installing the arm-none-eabi-newlib package seems to help.

If you want to develop on a Raspberry-Pi, you don't need to cross-compile as you are compiling on another ARM machine. Edit the Makefile to remove the arm-none-eabi- prefixes and things should work.


Download the template and you should be able to just do a "make" to build the file.

The Makefile contains a "make flash" target you can run that will automatically run openocd for you to upload things. It runs something like this:
openocd -f board/stm32l4discovery.cfg \
                        -c "program lab1.elf verify" \
                        -c "reset run"
If it's the first time you are programming your board you might need to use the stlink-gui program to clear out the RAM, as the demo program interferes with flashing.

Debugging using gdb/openocd

Lab Template files

Back to the main ECE271 web page