Narzędzia użytkownika

Narzędzia witryny


elektronika:blueboard-arm-lpc2148

ARM7 (LPC2148) blueboard on Linux

This page will describe how to start with BlueBoard-LPC214x using NGX USB JTAG under Linux operating system.

It's still work in progress.

ARM toolchain

I'm using Ubuntu distribution which doesn't have precompiled GNU ARM toolchain, here's how to do it.

Follow instructions on Uwe Herman website. I've tested the script on Ubuntu 10.04 (one of the comments states that you need to install libncurses-dev for gdb to build successfully). I modified prefix so that tools will be installed in „/usr/local/arm”, you can also choose „/opt/arm”. Note: GCC needs to be compiled in two stages, the first stage is to build compiler to make c library, and the second stage is to build whole gcc with c library support. Please note that the script is optimised for minimal space usage, it will remove all downloaded archives as well as intermediate build objects.

As for c library you can choose between: glibc, newlib (used in above script), uClibc, |EGLIBC and diet libc. For embedded systems newlib and uClibc are preferred (I haven't heard much about EGLIBC and diet libc). You must modify scripts accordingly.

On AMD Phenom™ II X4 810 with „-j 4” make option build process took something like 10 minutes.

Last thing I did was to add „/usr/local/arm/bin” to my path, I modified ~/.bashrc file and added this code at the end:

PATH=$PATH:/usr/local/arm/bin
export PATH

JTAG configuration

I'm using OpenOCD version 4.0. I compiled it from source because Ubuntu repositories didn't have the newest version. I used this build command:

./configure --enable-parport --enable-ft2232_libftdi --enable-ioutil --enable-usbprog --enable-oocd_trace --enable-jlink
make

I had to raise openocd privileges or else it wouldn't detect JTAG device (perhaps there's a proper and safer way to do it):

sudo chmod a+s openocd

Save this configuration file for openocd:

ngxbb_lpc2148.cfg
#
# Configuration file for NGX Blueboard (LPC2148 CPU)
# using NGX USB JTAG (0403:6010 USB id)
#
# Used with openocd 4.0 version
# Created by Lukasz Goralczyk
# Last change: 2010-06-12
#
 
# openocd configurations
telnet_port 4444
 
# gdb configuration
gdb_port 3333
#gdb_flash_program enable # ensure default, doesn't work due to bug in 4.0
#gdb_memory_map enable # ensure default, doesn't work due to bug in 4.0
 
# cpu configuration
source [find target/lpc2148.cfg]
 
# interface configuration
source [find interface/openocd-usb.cfg]
 
# change device description or else device will not be found
ft2232_device_desc "NGX JTAG"
 
# this will speed up data upload speed
arm7_9 dcc_downloads enable
# fast memory access (potentially less safer, see help)
arm7_9 fast_memory_access enable

I'm assuming that you have everything connected properly. Start openocd with given parameters:

openocd -f ngxbb_lpc2148.cfg

You should see output like this (error messages are only the first time and I think are caused that target is not yet prepared for debugging):

Open On-Chip Debugger 0.4.0 (2010-05-09-16:26)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.berlios.de/doc/doxygen/bugs.html
RCLK - adaptive
jtag_nsrst_delay: 200
jtag_ntrst_delay: 200
trst_and_srst srst_pulls_trst srst_gates_jtag trst_push_pull srst_open_drain
Info : RCLK (adaptive clock speed) not supported - fallback to 500 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Info : JTAG tap: lpc2148.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
Info : Embedded ICE version 4
Info : lpc2148.cpu: hardware has 2 breakpoint/watchpoint units

Now you can test if things work:

telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> flash list
{name lpc2000 base 0 size 512000 bus_width 0 chip_width 0}
> halt
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x00000013 pc: 0x00012870
> reg 0
r0 (/32): 0x00000000
> reg 1
r1 (/32): 0x01AC2A2F
> reg 2
r2 (/32): 0x40002EE8
> resume
>

Test GCC

Now time to test if GCC works. For start I'll use modified BlueBoard test source code (650 kB), I had to make small changes because code wouldn't compile due to inconsistencies in filename letter casing. Also I've changed string „SD card” to „MemCard” so you could see the difference on LCD screen.

Unpack code and build it:

unzip ngxbb_sources_mod.zip
cd Sources/GCC
make

You should have „App.bin” file in Sources/GCC/OBJ directory. Now we can upload it to LPC2148, start openocd in Sources/GCC/OBJ directory and telnet to it (as in previous part):

telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> arm7_9 dcc_downloads enable
dcc downloads are enabled
> halt
> poll
background polling: on
TAP: lpc2148.cpu (enabled)
target state: halted
target halted in ARM state due to breakpoint, current mode: Supervisor
cpsr: 0x60000013 pc: 0x40000070
> flash write_image erase unlock App.bin
auto erase enabled
auto unlock enabled
wrote 131072 bytes from file App.bin in 5.781595s (22.139 kb/s)
> reset
> 

After this you should see normal boot and finally LCD screen looks a bit different than a default:

Modified BlueBoard software

elektronika/blueboard-arm-lpc2148.txt · ostatnio zmienione: 2014-02-27 02:02 (edycja zewnętrzna)