Sunday, February 15, 2015

Development Tool Chain for LPC810 Microcomputer

Jeelabs has a series of articles on programming the LPC810 microprocessor, a very simple 8-lead 32-bit microprocessor.

I set up a VPS, ocean1.zouck.org with a cross compiler-linker to compile programs, and a raspberry pi to program the resulting binary file into the chip thru a usb-serial BUB.

VPS Development Host

Build Tool Chain

On ocean1.zouck.org:

sudo apt-get install build-essential gcc-arm-none-eabi
sudo apt-get install git
git config --global user.name "John Zouck"
git config --global user.email "jzouck@zouck.net"

Clone Test Code

From jeelabs git repository:

mkdir git
cd git
git clone https://github.com/jeelabs/embello.git

Build Binary (firmware.bin) for Downloading to LPC810

$ make firmware.bin
arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -I../minimal -Os -ggdb -fno-rtti -fno-exceptions   -c -o main.o main.cpp
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -I../minimal -Os -ggdb   -c -o gcc_startup_lpc8xx.o gcc_startup_lpc8xx.c
arm-none-eabi-gcc -o firmware.elf -mcpu=cortex-m0plus -mthumb -I../minimal -Os -ggdb -Wl,--script=../minimal/LPC810.ld -nostartfiles main.o gcc_startup_lpc8xx.o
arm-none-eabi-objcopy -O binary firmware.elf firmware.bin

On Raspberry Pi

Download and build programmer "lpc21isp":


pi@raspberrypi2 ~ $ wget http://iweb.dl.sourceforge.net/project/lpc21isp/lpc21isp/1.97/lpc21isp_197.zip
pi@raspberrypi2 ~ $ mkdir  arduino
pi@raspberrypi2 ~ $ cd arduino
pi@raspberrypi2 ~/arduino $ unzip ../lpc21isp_197.zip 
pi@raspberrypi2 ~/arduino $ cd lpc21isp_197
pi@raspberrypi2 ~/arduino/lpc21isp_197 $ make
gcc  -Wall -static -c -o adprog.o adprog.c
gcc  -Wall -static -c -o lpcprog.o lpcprog.c
gcc  -Wall -static -c -o lpcterm.o lpcterm.c
gcc  -Wall -static -o lpc21isp lpc21isp.c adprog.o lpcprog.o lpcterm.o
pi@raspberrypi2 ~/arduino/lpc21isp_197 $ 

Download firmware.bin from ocean1:


sftp henry@ocean1.zouck.org
sftp> cd /home/henry/git/embello/explore/1446-lpc810/minimal
sftp> get firmware.bin
Fetching /home/henry/git/embello/explore/1446-lpc810/minimal/firmware.bin to firmware.bin
/home/henry/git/embello/explore/1446-lpc810/minimal/firmware.bin  100%  396     0.4KB/s   00:00    
sftp> exit
pi@raspberrypi2 ~/arduino/lpc21isp_197 $ ls -l firmware.bin 
-rwxr-xr-x 1 pi pi 396 Feb 16 00:18 firmware.bin
pi@raspberrypi2 ~/arduino/lpc21isp_197 $ 

Program chip using lpc21isp:

Connect BUB and 810 to raspi usb port and run:

pi@raspberrypi2 ~/arduino/lpc21isp_197 $ ./lpc21isp

Portable command line ISP
for NXP LPC family and Analog Devices ADUC 70xx
Version 1.97 compiled for Linux: Feb 16 2015, 00:12:33
Copyright (c) by Martin Maurer, 2003-2013, Email: Martin.Maurer@clibb.de
Portions Copyright (c) by Aeolus Development 2004, www.aeolusdevelopment.com

Syntax:  lpc21isp [Options] file[ file[ ...]] comport baudrate Oscillator_in_kHz

Example: lpc21isp test.hex com1 115200 14746

Options: -bin         for uploading binary file
         -hex         for uploading file in intel hex format (default)
         -term        for starting terminal after upload
         -termonly    for starting terminal without an upload
         -localecho   for local echo in terminal
         -detectonly  detect only used LPC chiptype (NXPARM only)
         -debug0      for no debug
         -debug3      for progress info only
         -debug5      for full debug
         -donotstart  do not start MCU after download
         -try<n>      try n times to synchronise
         -wipe        Erase entire device before upload
         -control     for controlling RS232 lines for easier booting
                      (Reset = DTR, EnableBootLoader = RTS)
         -boothold    hold EnableBootLoader asserted throughout sequence
         -controlswap swap RS232 control lines
                      (Reset = RTS, EnableBootLoader = DTR)
         -controlinv  Invert state of RTS & DTR 
                      (0=true/assert/set, 1=false/deassert/clear).
         -verify      Verify the data in Flash after every writes to
                      sector. To detect errors in writing to Flash ROM
         -logfile     for enabling logging of terminal output to lpc21isp.log
         -halfduplex  use halfduplex serial communication (i.e. with K-Line)
         -writedelay  Add delay after serial port writes (for compatibility)
         -ADARM       for downloading to an Analog Devices
                      ARM microcontroller ADUC70xx
         -NXPARM      for downloading to a chip of NXP LPC family (default)
pi@raspberrypi2 ~/arduino/lpc21isp_197 $ 



No comments:

Post a Comment