Category Archives: HowTo

Installing and configuring Eclipse and a toolchain for STM32 (Part 3)

Last time we installed all the necessary programs and tools. Now we are ready to start Eclipse for the first time and install the remaining plugins.

We start ‘c:\STM32Eclipse\eclipse\eclipse.exe’.Eclipse_Run_1After the Splashscreen is shown Eclipse asks where the Workspace is located. We enter ‘c:\STM32Eclipse\workspace’ and press “OK”.Eclipse_Run_2Now Eclipse opens with a “Welcome”-Screen. Eclipse_Run_3

We close this Tab:

Eclipse_Run_4

We start installing additional tools/plugins.

To install software in eclipse you normaly open Help->Install New Software:

Eclipse_Install_New_Software

A new window opens. Here you can either search the existing repositories or add additional ones.
Eclipse_Available_Software_Add

Eclipse_Add_Repository

To add a new repository you have to know where it is located and assign it a name.

For now we have to add three repositories:
CDT 8.4 – http://download.eclipse.org/tools/cdt/releases/8.4
GNU ARM – http://gnuarmeclipse.sourceforge.net/updates
EmbSysRegView –  http://embsysregview.sourceforge.net/update

Now we choose alle the features we want to install:
+ CDT Main Features
-+ C/C++ Development Tools
+ CDT Optional Features
-+ C/C++ GCC Cross Compiler Support
-+ C/C++ GDB Hardware Debugging
+ embsysregview
-+ Embedde Systems Register View (SFR)
-+ EmbSysRegView Data
+ GNU ARM C/C++ Cross Development Tools
-+ GNU ARM C/C++ Cross Compiler Support
-+ GNU ARM OpenOCD Debugging Support
-+ GDB Hardware Debugging
+ Mobile and Device Development
-+ C/C++ GCC Cross Compiler Support
-+ C/C++ GDB Hardware Debugging

After selecting all the features you can click next.
Eclipse_Install_Details
Here you see a list of all the features you want to install. Click next.
Eclipse_Review_Licenses
Read through all the licenses and accept them. Now you can click Finish.

Eclipse now starts to download the necessary files.Eclipse_Installing_Software At some point it tells you that some of the features are not signed. We can ignore this and click OK to proceed.Eclipse_Installing_Security_Warning Finally you are asked to restart Eclipse to finish the installation process. Eclipse_Installing_Restart

After restarting Eclipse we are finished installing the IDE. Next time we create our first project and create a simple program.

Advertisements

Installing and configuring Eclipse and a toolchain for STM32 (Part 2)

Last time I listed and tried to explain all the things we need to get started.

First things first. We need a base directory where we install everything. I will use “C:\STM32Eclipse\” as my base directory. But it does not really matter what you choose as yours. Just keep in mind: Using Spaces in file or directory names is in general a bad idea and should be avoided.

Next we download Java 8u5 from http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html:
Download JRE 8u5
There are multiple versions available. One Online Version and two 32bit and two 64bit versions respectively. One of these versions is self running installers and the other packed version. You should take the self running installer. Before you can download the JRE you have to accept the License Agreement. After the download is finished start the installer and follow the instructions.

Now we can install Eclipse Standard 4.4. We go to http://www.eclipse.org/downloads/ and either choose the 32bit or the 64bit version.
Eclipse_Download_1
The webserver presents you a mirror where you can download Eclipse.
Eclipse_Download_2The downloaded ZIP-file should contain a folder ‘eclipse’ as base.
We can now extract the downloaded ZIP-file into ‘c:\STM32Eclipse’.
This should create a subfolder ‘c:\STM32Eclipse\eclipse’ which contains all the necessary files. Just like you can see in the image.
Eclipse_Install

Now we download the Cross Build Tools from http://sourceforge.net/projects/gnuarmeclipse/files/Miscellaneous/Cross%20Build%20Tools.zip/download. The download should start within several seconds.

The downloaded ZIP-file contains a folder ‘Cross Build Tools’ as base. In this folder are several files. Amongst others ‘cs-make.exe’, ‘cs-rm.exe’ and ‘echo.exe’.
We extract these three files into ‘c:\STM32Eclipse\eclipse’. After that we remove the ‘cs-‘ prefix like pictured below.
Cross Build Tools_Install
The next step is to download the GCC ARM Toolchain from https://launchpad.net/gcc-arm-embedded/+download. We choose the Windows ZIP-file.gccarm_Download

Now we install the toolchain. First we create a subfolder ‘c:\STM32Eclipse\toolchain’. We extract the ZIP-file into this created folder.
gccarm_Install
We now download the latest OpenOCD version from: http://www.freddiechopin.info/download/category/4-openocd.
OpenOCD_Download
We have another ZIP-file. Like the Eclipse ZIP-file there is a folder at the base. The folder’s name is ‘openocd-0.8.0’. And just like the Eclipse installation we extract the file into ‘c:\STM32Eclipse’.
OpenOCD_InstallTo get OpenOCD to work with ST-LinkV2 we need some drivers for it: Wither Windows XP/Vista/7: http://www.st.com/web/en/catalog/tools/PF258167 (STSW-LINK003) or Windows 8: http://www.st.com/web/en/catalog/tools/PF258168 (STSW-LINK004)

STLink_Drivers

The downloaded ZIP-file contains an EXE-file. Start the EXE-file and follow the instructions to install the drivers.

As a last step we head over to http://www.st.com/stm32cube and download STM32CubeMX. After the download is complete we open the ZIP-file and execute the contained EXE-file. We read and agree the license. We change the installation folder to ‘C:\STM32Eclipse\STM32CubeMX’ and continue to install the software.

This concludes this part of this HowTo. Next time we install and configure Eclipse.

 

Installing and configuring Eclipse and a toolchain for STM32 (Part 1)

In this HowTo series I want to explain how to set up all software to write, compile and debug code for STM32 microcontrollers on Windows 7. I have a 32bit Windows 7 system. There are some differences when using a 64bit Windows which I try to address when needed.

The STM32 is a family of 32bit ARM microcontrollers. STM has created a wide range of different versions for different needs. The L0 and L1 series for example are for low power applications. As a rule of thumb for the Fx series: The higher the number the higher is the performance and the more peripherals are present.

The HowTo should work, more or less, for all STM32 microcontrollers. For the moment I will use a STM32F4Discovery. But I will note when something is different for other STM32 microcontrollers. The STM32F4Discovery is a small kit to explore the capabilities of the controller. A ST-Link V2 is present too.  When some of the jumpers are removed this ST-Link V2 can be used to program and debug other STM32 microcontrollers. The kit is available for less than $20.

For the first part of the series I will show which tools/programs are necessary and try to explain them a little bit.

Java Runtime Environment 7 or 8
http://www.java.com (either 32bit or 64bit)
To run Java programs like Eclipse or STM32CubeMX the installation of JRE is necessary.

Eclipse Standard 4.4 Luna
http://www.eclipse.org/downloads/ (either 32bit or 64bit)
Eclipse was designed as IDE to develop Java programs. But because Eclipse can be extended with plugins. It can be used for many different programming languages. The CDT – C/C++ Development Tooling plugin allows one to program C/C++ programs. For the moment we only install the standard version without any additional tools.

GCC ARM 4.8-2014-q2
https://launchpad.net/gcc-arm-embedded/+download (latest zip file)
This is the real toolchain. It contains, among other things, the compiler and linker for ARM microcontrollers.

Make and rm
http://sourceforge.net/projects/gnuarmeclipse/files/Miscellaneous/Cross%20Build%20Tools.zip/download
These two tools are not found within the GCC ARM Tools but are necessary to compile the source code.

OpenOCD 0.8.0
http://www.freddiechopin.info/download/category/4-openocd
OpenOCD is an open On Chip Debugger and in system programmer. It is used to upload the firmware into the STM32 and debug it.

STM32 CubeMX
http://www.st.com/stm32cube (Standalone Version)
CubeMX is – more or less – replacing the Standard Peripheral Library. It also helps to configure the pin out and clock system of a microcontroller. For most STM32 series (at the moment STM32F1x and STM32L1x are not supported) the tool can generate source code for the peripherals and some middleware. There are still SPLs  available for the not supported series:
SPL STM32F1x (STSW-STM32054): http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF257890
SPL STM32L1x (STSW-STM32077): http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF257913
The Eclipse plugin integrates the CubeMX into Eclipse. At the moment the code generation does not support Eclipse and GCCARM directly. But it is quite easy to adopt the generated code for this setup.

Note: There is an Eclipse plugin for STM32CubeMX. But I was unable to get it working.

Driver ST-Link V2
Windows XP/Vista/7: http://www.st.com/web/en/catalog/tools/PF258167 (STSW-LINK003)
Windows 8: http://www.st.com/web/en/catalog/tools/PF258168 (STSW-LINK004)
USB Driver to communicate with the ST-Link V2 programmer/debugger. There is a small tool which allows one to program and verify the STM32: http://www.st.com/web/en/catalog/tools/PF258194# (STSW-LINK005)

There are some other components to get this setup running. All of them are plugins for Eclipse. The download and installation are handled by Eclipse.

Eclipse CDT
As mentioned above this plugin extends Eclipse to handle C/C++ projects.

Eclipse ARM Plugin
This plugin extends CDT to build and debug ARM projects.

EmbSysRegView
When debugging a microcontroller it is often necessary to look into the microcontroller registers and sometimes to alter their content.

These are all the tools/programs needed for developing software for a STM32 microcontroller. In the next part of the series I will show how to install Eclipse and the plugins.