Skip to content

Instantly share code, notes, and snippets.

@DKrepsky
Created July 12, 2017 11:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DKrepsky/ea1693a7a1477cf875d90f3372bebbf1 to your computer and use it in GitHub Desktop.
Save DKrepsky/ea1693a7a1477cf875d90f3372bebbf1 to your computer and use it in GitHub Desktop.
STM32F UNDER WINDOWS WITH ECLIPSE AND GCC
1- Install the latest Java JDK (http://www.oracle.com/technetwork/pt/java/javase/downloads/index.html);
2- Download and install Eclipse CDT Neon 3:
2.1- Go to http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/neon3 and download Eclipse Neon 3;
2.2- Extract the .zip archive to the installation directory;
2.3- Double click eclipse.exe;
2.4- Check for update by clicking in Help > Check for updates, do any pending updates and restart eclipse;
2.5- Go to Help > Install New Software and click in the Add button;
2.6- Type GNU MCU ECLIPSE in the name field and http://gnu-mcu-eclipse.netlify.com/v4-neon-updates/ as the Location, then click Ok;
2.7- Install the GNU MCU pluggin;
2.8- Close Eclipse;
3- Download and install ARM GCC:
3.1- Go to https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads;
3.2- Download file gcc-arm-none-eabi-6-2017-q2-update-win32-sha2.exe (Windows 32-bit);
3.3- Install with default setting but, before clicking finish, make sure options "Launch gccvar.bat" and "Add path to environment variable" are not checked;
4- Download and install the Windows Build Tools:
4.1- Go to https://github.com/gnu-mcu-eclipse/windows-build-tools/releases and download the latest stable installer (.exe);
4.2- Install with default settings;
5- Download and install GNU MCU Eclipse OpenOCD:
5.1- Go to https://github.com/gnu-mcu-eclipse/openocd/releases and download the latest stable installer;
5.2- Install with default settings;
6- Create a test project:
6.1- File > New > C++ Project;
6.2- Give it a name and select a STM32 template;
6.3- Let everithing else as default;
6.4- In the Project Explorer, right click the project name and select Properties;
6.5- Expand the MCU tab;
6.5- Configure the installed tools path: ARM Toolchain Path, Build Tools Path, OpenOCD path;
6.6- Click Ok and try to compile the project;
6.7- If the project compiles but there are some errors in the Problems tab, right click the project name > Index > Rebuild;
7- Debuggin:
7.1- Create a new file on the project root folder (right click project name > New > File);
7.2- Set the file name as stm32f4discovery.cfg and copy the contents of the stm32f4discovery.cfg to this new file;
7.3- Right click the project name > Debug As > Debug Configurations;
7.4- Double click GDB OpenOCD Debuggin to create a new debug configuration;
7.5- Select the new configuration and go to the tab Debugger;
7.6- In the Config options type: -f stm32f4discovery.cfg;
7.8- Make sure the discovery board is connected to the USB and press debug;
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
# http://www.st.com/internet/evalboard/product/252419.jsp
source [find interface/stlink-v2.cfg]
source [find target/stm32f4x_stlink.cfg]
# use hardware reset, connect under reset
reset_config srst_only srst_nogate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment