ARMv7 Cortex-M3 and Cortex-M4 Projects

by Martin THOMAS

This is a sub-page of my ARM-Projects-Page where you can find the WinARM toolset (gcc-cross-compiler/arm-elf-GNU-toolchain for ARM and tools), general ARM examples implemented using the GNU cross-toolchain (gcc et al) and various NXP LPC2000, Atmel AT91, Analog Devices ADuC and STmicro STR7 projects and examples.

You may like to visit my AVR-Projects page too.

Available Projects and Information (Content)

"Last updated" may be just additional information not always a new version of a software-package. All presented projects should work with minimal modifications in the linker-scripts and source-code with other controllers from the same controller-family.

If you think that I could help you with your projects: just send an e-mail. I'm looking for "freelance"-jobs.

If you send me an e-mail: Please use your full name (your _real_ full name). And it's always nice to get some kind of feedback if an answer to a question did help or did not help. I often spend a lot of time answering e-mails and would at least like to know if my suggestions did or did not help solving a problem.

Questions or suggestions? Please use the support-forum for WinARM/arm-elf-gcc and the example-projects. or send an e-mail to mthomas (at) rhrk (dot) uni-kl (dot) de

LM3S811 examples (ARMv7/Cortex M3 core)

The examples demonstrate the usage of the GNU toolchain with ARMv7 Cortex-M3 controllers. They are made for the LM3S811 from LMI on a EKK-LM3s811 evaluation board.

Since the current version (20060606) of WinARM does not support the ARMv7 architecture and Cortex-M3 CPUs (the needed modifications are not integrated in the GNU gcc sources version 4.1.1) the GNU-toolchain from Codesourcery (version 2006q3-26) has been used to build the examples.

The evaluation board has an intergrated JTAG-interface to flash the on-board controller's memory and for in-system-debugging with OpenOCD/gdb and the Keil software. OpenOCD's support for Cortex-M3 is in beta-stage but rather usable (see links further down on this page).The board can also be used as JTAG-interface for external targets. Since the JTAG-circuit is based on the FTDI FT2232-IC it is even possible to use it as JTAG-hardware to debug/program targets supported by OpenOCD (i.e. controllers with an ARM7TDMI core, tested with AT91SAM7S256).

The examples are prepared to upload code to the controller's flash-memory with lmiflash, OpenOCD or uVision from Keil/ARM (see configuration-options in the makefiles and details in the readme.txt). A beta-version of OpenOCD and lmiflash are included in the package. When uVision should be used it must be installed on the system too. I got Keil's MDK-ARM version 3.03beta from the "software and examples CD" version 1.01 which can be downloaded from the Luminary-website after registration. lmiflash is available from the LMI web-site too.

Most of the code is from the driver-library available from LMI and from the examples which have been included in the driver-library package. Only small modifications have been done in the code but I have included extra makefiles and linkerscripts, so creating the driver-library and the examples should be rather easy. The source-archive includes a small readme-file with further information.

[Download] (timestamp 20061111, makefile, headers, linker-scripts and startup-code included).

Version history:

FreeRTOS demo-application for LM3S811 using GNU-Tools/gcc

This is just a port of the FreeRTOS demo-application for the LMI LM3S811 on a EV-LM3S811 evaluation-board. The code is based one the example for Keil/RVDK which is included in Keil MDK-ARM V3.03 and the FreeRTOS 4.1.1 package.

[Download] (timestamp 20061114).

Needed parts from FreeRTOS and the LMI driver-library are included. Please read the readme_mthomas.txt-file included in the package for further information. Tested with Codesourcery's 2006q3-26-release of the GNU-toolchain for ARM.

Version Histroy

Port of the ArmExe RTOS for LMI cortex-M3 to the GNU toolchain

ArmExe is a small RTOS created by Naubert Aparicio. The project received a "honorable mention" in the Design Stellaris 2006 contest. More information is available from the Cicruit Celler Web-Site. I have been asked for help to port the ArmExe RTOS from Realview to gcc and this is a the result. Even if you are not interested in ArmExe itself the code may provide some useful information how to port from Realview-tools to GNU-tools/newlib.

Build has been tested with the GNU tools package Codesourcery G++ lite arm-non-eabi Q1/2008. The evaluation-version of the Keil/ARM uVision has been used as IDE and Debugger. There is also a makefile included (use cs-make all to build, cs-make is just a GNU make with another filename and gets installed by G++ lite).

[Download] (timestamp 20070727).

Version Histroy

Porting source from GNU-Toolchain to Realview-Toolchain

For those who want to submit a project to the LMI design-contest: I have written a small "Howto" how code created for GNU/gcc can be converted for the RealView-tools. The contest-rules demand that "the project software must be developed using Keil's RealView Microcontroller Development Kit". With the method described in my text you can develop using the GNU-Toolchain (without any size-restrictions) and convert the code to Keil/Review before submission.

So far the information in the text is preliminary. Feedback is welcome.

Using OpenOCD with ARMv7/Cortex-M3/LMI Stellaris

An introduction how to use Dominic Rath's OpenOCD with the ARMv7/CM3/LMI-Stellaris-extensions created by Magnus Lundin can be found on this page.

Small Digital Picture Frame (DPF) with STM32F103 and 2.8" Color-LCD

The application reads picture-files in standard Windows BMP-format from a SD-Card and shows them on a 2.8" color-LCD-module (320*240 px). The following hard- and software has been used:

It might be difficult to buy the STM32 Mini board with the LCD-module for people who can not read chinese (I can't either). I got it from someone who ordered the devices directly from China. You may try to write an e-mail to the contact given on the taobao-page: just type STM32 in the search field and browse through the items until you find a device as shown in the above pictures. While the base-board is nothing special the TFT-Module is equipped with a Sitronix ST7783 LCD-controller which is similar to various other LCD-Controllers for smaller TFTs but there are small differences compared to i.e. Ilitek's ILI9320. Probably minor modifications in the LCD-driver-code will be necessary when using another TFT-module.

The interface between STM32 and the ST7783 is a simple "bit-bang" parallel bus accessed with GPIO-registers since the STM32 on the base-board does not offer a memory-bus and the TFT-Module does not offer a SPI-connection. Bitbanging ist not as slow as one would expect. In this DPF project most of the processing-time is needed to read the BMP-files from the SD-Card and to process the contents. For a quick-start: install the GNU toolchain from Codesourcery, type make all and transfer the generated hex-file into the STM32's internal flash-memory using the internal bootloader or a JTAG/SWD-interface (i.e. OpenOCD with Amontec JTAGkey). Then convert a few pictures into Windows BMP-format (24bit and 8bit color-depth are supported but RLE compression is not supported) and scale them to a width<=320px and height<=240px. I have used XnView for conversion and scaling. Copy the BMP-files on a SD-Card, place the memory-card into the socket which is located in the TFT-board (not on the base board) and power-up the device. The firmware will search for BMP-files on the SD-Card and show them on the display.

The code has been ripped from another project which I created for a device with similar hardware, so there might be "dead-code" in the archive which can be ignored (the compiler will remove it anyway). Feel free to write me an e-mail if there are questions.

[Download] (timestamp 20091129, complete source-code with Eclipse-workspace)

STM32F4 (Discovery) Examples

These examples demonstrate the use of the STM32F4 Cortex-M4 controllers using a GNU-Toolchain, free and/or no-cost tools and the STM32F4 Discovery board. The packages include all needed tools beside of the GNU toolchain itself and an IDE or Editor. Included are: Because of all this the packages are rather large (around 14 MBytes). Further information can be found in comments and readme-files.

[Download] of the STM32F4 Discovery demo application-source as on a new STM32F4-Discovery Board (timestamp 20120422)
[Download] of LED-Blink and Interrupt example with a lot of GNU-"specials" like use of stdio timestamp 20120624)

Version history:

STM32F4 USB Virtual COM port Example

This demonstrates the implementation of an USB virtual COM-port device on a STM32F4 microcontroller. Tested with the STM32F4-Discovery-Board. Based on libraries and code from ST-Microelectronics. The packages includes source, libraries, makefile, linkerscript, drivers, Eclipse-workspace and tools. Sorry for the size of the zip-archive, the relevant source-code is just a few kilobytes. I will reduce the size in the next version.

[Download] (timestamp 20121201, ca. 27MB zip-archive)

STM32 with Memory-Cards (SD/MMC/SDHC)

The project "Memory-Card interface including FAT-filesystem for STM32F103 SPI" available from my ARM+Memorycard page includes a lot of "GCC-specials". Even if you are not interested in interface memory-cards and FAT-drivers you may find useful information for your STM32 developments in this project (linker-script, startup-code, vector-location, use of OpenOCD for programming and debugging, Eclipse-workspace and more).

Download available from ARM+Memorycard page

C++ with Cortex-M3, the GNU ARM cross-toolchain and newlib - Example for STM32

An example-application which demonstrates C++ on STM32 with the GNU cross-toolchain can be found here.

LED Blink Example for STM32F103

The application lets a LED connected to an STM32F103 port-pin blink. The basic code is a mixture of code published by Lanchon (don't remember where I've found it and his real name is not given in the source), Raissonance (linker-scripts) and STmicro (STM32-library). I have only done a few small modifications to get started with STM32 devices. Codesourcery's arm-eabi GNU-toolchain has been used (q3-2007) to build the STM32 library and the example-code.

I have tested the code with a Manley EK-STM32F evaluation-board (STM32F103VBH6 Rev Z). The embedded bootloader has been used to transfer the application to the STM32 flash. The package includes the complete source-code, linker-script and makefile. The original readme-file from Lanchon has been extended with instructions how to use the STM32 bootloader with the STmicro "Flash loader demonstrator".

[Download] (timestamp 20080210)

Lanchon's latest updates can be found in the STmicro STM32 forum

LPC17xx with Memory-Cards (SD/MMC/SDHC) and USB Mass-Storage Devices

The project "Memory-Card/USB-Mass-Storage interface including FAT-filesystem for LPC17xx SPI/LPC17xx USB-Host" available from my ARM+Memorycard page includes a "Framework" to develop applications for LPC1766, LPC1768 and other LPC Cortex-M3 devices. Even if you are not interested in interface memory-cards and other FAT-formated drivers you may find useful information for your LPC17xx developments in this project.

Download available from ARM+Memorycard page

To my ARM-Projects page (WinARM, NXP/Philips LPC2000, Atmel AT91 and other ARM projects)

To my Atmel AVR-Projects page

Martin Thomas
mail-adress: mthomas /at/ rhrk /dot/ uni-kl /dot/ de

Last mod.: