STM32F3DISCOVERY-board-image

STM32F3Discovery: ARM GCC Environment on Windows – Part-1

STM32F3DISCOVERY-board-image

After trying and trying and spending more than double the original price I finally got hold of a couple of STM32F3Discovery (Dev) Boards.

These Boards pack a bit too much power from the perspective of a hobbyist like me who has used only 8-bit stuff till now and though I don’t have any specific plans for using the extra processing power, I wanted these boards cause of the 9-Axis IMU that comes on it all ready to be used.

To avoid repetition of explaining the board and what it has and what not, am just going to put in a  couple of links.

A few links which introduce the board better:

I found out after getting the board that ST does not provide ready support for free-tools and the official supported IDEs/Debuggers are expensive and out of range for hobby work,  so I set out to find open-source and free solutions. I found quite a few but most were either Linux based or targeted some other STM32 Board and not this specific one. I have gathered bits from here and there and in this post will try to provide short and clear pathway to be able to build and burn projects for the STM32F3Discovery Board.

First Steps

Checking if the board works or not, these come with a pre-flashed firmware which demos the use of the IMU and the on-board LEDs, plug the USB port in the USB-ST-Link Port and see if it works, pressing the user button advances the demo. You may need to install the driver for the on-board ST-Link. Windows 8 has an additional step to restart in Device Signature Enforcement Disabled [Win8 Advanced Startup steps, for Arduino but same process].

Download and install the STM32 ST-Link Utility [and driver if needed] from ST site: http://www.st.com/internet/evalboard/product/251168.jsp

Run the STM32 ST-Link utility and click on the Connect to Target Icon (3rd from the left)  or click Connect in the Target menu and see if it detects the board and connects to it if NOT, there is some problem somewhere.

Installing the GCC ARM Toolchain and GNU make

After verifying that the board is working and is detectable, the next step is to download and install the GCC ARM Toolchain, which is basically C/C++ compiler suited for the ARM processors.

Download Link: GNU Tools for ARM Embedded Processors

The installation is simple as it can be, just REMEMBER to check the 3rd checkbox at the final install screen, “add path to environment variable“, this is a very essential step.

Test to see if GCC ARM Toolchain is installed

Open Command Prompt and type in:

arm-none-eabi-gcc

If it says Fatal error, then you are doing GOOD and the installation was successful  else you probably forgot to check the 3rd checkbox or you need to restart your PC.

arm-none-eabi-gcc  [ENTER]
RESULT
arm-none-eabi-gcc: fatal error: no input files
 compilation terminated.

Once that is done, now you need the GNU make binaries and dependencies, these may already be installed in your system if you have worked with AVR (have AVR Toolchain installed).  Enter make in command prompt, it should say

make  [ENTER]
RESULT
make: *** No targets specified and no makefile found. Stop.

If this is not the case and you get the error not recognized command, then follow these steps

We will need gnu make to be able to run makefiles. Makefiles are scripts that allow us to invoke the gcc compiler efficiently. It is very handy for building multiple source projects.

Download the “GNU make for windows”  binaries and the dependencies zip files from http://gnuwin32.sourceforge.net/packages/make.htm.

We unzip them and locate the “make.exe” file from the binaries zip file; which should be in the bin directory of that zip file, and the “libiconv2.dll” and “libintl3.dll” files from the dependencies zip file which you will also find under the bin directory in that zipped file. Once you locate “make.exe”, “libiconv2.dll” and “libintl3.dll”, copy them into the same directory containing the compiler binaries.

Which should be look something like: “C:\Program Files (x86)\GNU Tools ARM Embedded\4.6 2012q2\bin”  This way the make command can also be invoked from anywhere on your C drive.

—– steps directly copied from http://hertaville.com/2012/05/28/gcc-arm-toolchain-stm32f0discovery/

More NEXT TIME

Now that we have ARM GCC, GNU make and the STM32 ST-Link Utility installed, the foundations have been laid and the last remaining task is to setup a workspace/development folder and start coding from a template project which has the relevant bare-bones source files and the MakeFile.

I am working on the template project and until I do, I will write-up the remainder of the procedure in the second part.

Reference Pages [from where I copied MOST things]:

I am not very good with these MakeFiles etc and all that I am doing is simply copy-paste and changing a few settings here and a couple things there and all of the above and the rest coming is a summary from these and other pages found via Google.

Published by

Zaid Pirwani

Co-Founder and Design Engineer at EjaadTech + MS Student (Applied Power and Control) + Graduate Teaching Fellow at PAF KIET + Teaching C/C++ at PAF KIET + Industrial Electronics Engineer from IIEE-PCSIR + all round Computer/Electronics Geek