LPC2124 from Scratch

From CryptoLUX
Jump to: navigation, search
LPC-H2124 development board with a passive EM probe over the uC

This is a tutorial on how to start working with Olimex LPC-H2124 development board. It describes a simple pure assembly "bare-metal" project using open-source tools, with the focus on the following things:

  • startup sequence;
  • linker script;
  • uploading the program to the device.

The tools should work both on Linux and Windows. The project is developed by Ilya Kizhvatov.

Source Code

Download project code: lpc2124fromscratch.zip‎‎

Project structure:

  • test.s - this is the main and the only program source file containing the startup sequence and some simple code executed in a loop
  • link_16k_256k_rom.ld - this is the linker script
  • makefile

The files are somehow commented.

Quick start (Windows)

1. Get and install the recent CodeSourcery G++ Lite for ARM EABI, and the NXP LPC200 flash utility (see links below).

2. In the console, go to the project directory (test) and execute 'cs-make'. This will build the project and, among others, provide a .hex file for uploading to the device.

3. Connect the board to a PC with an RS232 cable (direct female-male), close the BSL and JRST jumpers on the board.

4. Launch the NXP LPC200 flash utility, select the test.hex file and upload it to the device.

5. Open the BSL and JRST jumpers and press RESET button on the board.

6. Observe the GPIO pin 12 (P0.12) toggling with the DSO. :)


  • initialize USART in the startup sequence
  • move the startup sequence into a separate file
  • move all the hw-related definitions into a separate header file (in fact, use one of the already available for LPC2124 from various projects)
  • proceed to C code (this will probably require to modify the linker script)
  • crypto algorithm implementations (AES, RSA)



Flash memory programming tools

Datasheets and manuals

Tutorials and books

Misc web pages

  • [1] - a very simple example of an assembly app for LPC 21XX