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 gdb-arm-none-eabi
	sudo apt-get install stlink-gui
	sudo apt-get install gcc make git
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.

Building/Uploading

Download the template and you should be able to just do a "make" to build the file. Then to upload to your board do something like:
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

TODO: I have not tested this recently so it might not be working

Lab Template files


Back to the main ECE271 web page