gcc-Port of the LPC2000 Example-Code-Bundle for LPC213x/LPC214x (Philips LPC2000 ARM7TDMI-S controller series)

by Martin THOMAS

Philips provides example-code for various LPC2000 functions on this page ("Sample Code Bundle for LPC213x/LPC214x Peripherals"). The examples have been made for the LPC213x and LPC214x targets using the Keil or the ARM RealView compiler.

This is a port of the examples for the GNU-toolchain (as in WinARM and gnuarm). It is based on the code-bundle Version 1.0 "preliminary" for the Keil compiler. Various modifications have been made in the startup-code to minimize the modifications in the C-code. I have added an assembler interrupt-"wrapper" in the startup-code to avoid problems of the GNU-compiler with interrupt-handling in thumb/thumb-interwork and activated optimization. The software-interupts handling has been modified and extended too. An additional software-interrupt example (SWI) has been added to demonstrate enabling and disabling interrupts from applications running in user-mode (USR). Another additional example demonstrates the use of a "reduced" printf-routine (rprintf), stdio-(i)printf and software-interrupts.

The Philips-developer forgot some volatiles in his code. Maybe the other compilers do not need it but it is clearly a bad style to access non-volatile variables in ISRs and the "main-loop". But the orignal code of the examples marks them as preliminary, so this might be fixed in future releases. In the ported code this has already been fixed by additional volatiles.

Some integrated peripherals inside other members of the LPC2000-family are very similar to the ones in the LPC213x (like LPC2132, LPC2134, LPC2136, LPC2138) or in the LPC214x (LPC2146, LPC2148). So you might find useful information in this examples for other LPC2000 like LPC2106 or LPC2129, but I have only tested with an LPC2138 and at least some changes in the linker-scripts would be needed for other targets. No modification should be needed for a LPC2148 which is basicly a LPC2138 with USB.

I have put "some" effort to extend the code for the handling of IRQ-interrupts and SWI-interrupts with the gcc/GNU-toolchain. These parts of the code are not very (LPC2000-)target-specific and could be used as templates in developments for other ARM7, ARM7TDMI or ARM7TDMI-S-controllers like i.e. the AT91SAM7-series from Atmel or the STR7-series from ST.

The way the code for the target gets built can be configured in the makefiles. Supported modes are:

Credits to the Philips-developer(s) for the original code. Thanks to the various authors of examples for ADI, Atmel, Philips, OKI, Sharp and ST ARM7-microcontrollers and the authors of the documents available at arm.com. I have learned much from the examples and documents.



Download

The ported demo-applications and additional examples made by me have been tested with a Philips LPC2138 ARM7DTMI-S controller on a Keil MCB2130-board using my WinARM-collection (Version 6/06). Other arm-elf-gcc-based toolchains like gnuarm should work too. All source-codes, startup-code, linker-script and makefiles are included. For further information on the gnu-port please refer to the readme_WinARM.txt included in the archive. Download the ported examples [here] (timestamp 20061205).

History:

To my ARM-Projects page (WinARM, other ARM projects)

To my Atmel AVR-Projects page


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


30273 hits since April 28, 2006
Last mod.: Thursday, 25-Jan-2007 13:55:56 CET