Pages

Friday, November 29, 2013

Hello World tutorial for STM32 Discovery boards using CooCox CoIDE and GCC ARM

ST Microelectronics has been supporting their Discovery line of ARM demonstration and development boards for a while now. It was first introduced to the STM32 Value line discovery (STM32-F1),
getting a free one at one of the embedded development conferences in
San Jose or Santa Clara. It had tucked it away for safe keeping (or
hoarding), and over the years also acquired a STM32-F0, STM32-F4, and STM32-F3.
These are low cost (most $8-$11, with one at $15 US), and some of the
more advanced boards include an accelerometer, gyroscope, or compass and
multiple LEDs.

It recently stumbled across the CooCox CoIDE for working with the Simplecortex (I'll
blog more about NXP chips and boards another time), and while starting
to play with it, discovered that this IDE also supported the STM32
boards. Which is great, Discovering the STM32 Microcontroller by Geoffrey Brown of Indiana University ,developing for ARM in C.

As stated in their tagline, CooCox
is a set of "Free and Open ARM Cortex MCU Development Tools." CoIDE is
an Eclipse based integrated development enviroment supporting the
standard GCC ARM tool set: compiler, assembler, linker, and debugger.
The STM32 discovery boards include an embedded ST-LINK or ST-LINK/V2
which is supported by CoIDE for flashing and debugging. The real value
add by CoIDE is point and click choice of MCU library modules for
various peripherals, with hypertext library references and examples.
CooCox supports a variety of ARM Cortex MCUs from various
manufacturers. ST is just one of the manufacturers.

Here I will show you how to install CoIDE and essential dependencies to
develop a simple Hello World program for the STM32 Value line discovery
board. The steps are very similar for the other boards (except STM32-F3
is not directly supported at this time). The program will display
debug output from printf() through the ST-LINK to the IDE's console
window. This is the essential first program to see results from a
program running on an embedded board. And it's not just a blinking LED,
though we'll do that too.