Getting started with LPC2138.

Hey,

I have quite a few years of experience with 8 and 16bit microcontrollers and very little expereince with assembly for ARM, however this is the first time I am setting up an opensource development environment for ARM. I have already ordered the LPC2138 and Olimex JTAG/USB/OCD programmer, see links below for more information.

http://www.sparkfun.com/commerce/produc … cts_id=272

http://www.sparkfun.com/commerce/produc … ts_id=7834

I initially began with the guide “ARM_Cross_Development_With_Eclipse_Components_Revision3_March_17_2006” by James Lynch however I have recently decided to use OpenOCD and as a result I have switched to using the guide “Using Open Source Tools for AT91SAM7S Cross Development revision C” by James Lynch. All software is the latest version availible from the respective links within the document + I have installed the LPC2000 flash utility.

Now I am still waiting on my hardware to be delivered but in the meantime I have some questions.

I want to initially start off with the LPC board described above. However I cannot seem to find a specific configuration file for the LPC2138. Is there a generic LPC configuration file or can I somehow modify the at91sam7s256-armusbocd.cfg so I can use it with the LPC? After perusing this forum I came across lpc2148_armusbocd.cfg however when I compare the contents to the at91sam7s256 file there seem to be significant differences. Can someone provide me with a tested .cfg file for the LPC2138 and additionally point me towards some documentation that further describes how to write the configuration file for other devices.

at91sam7s256-armusbocd.cfg

#define our ports
telnet_port 4444
gdb_port 3333

#commands specific to the Amontec JTAGKey
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 2
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#reset_config <signals> [combination] [trst_type] [srst_type]
reset_config srst_only srst_pulls_trst

#jtag_device <IR length> <IR capture> <IR mask> <IDCODE instruction>
jtag_device 4 0x1 0xf 0xe

#daemon_startup <'attach'|'reset'>
daemon_startup reset

#target <type> <endianess> <reset_mode> <jtag#> [variant]
target arm7tdmi little run_and_init 0 arm7tdmi_r4

#run_and_halt_time <target#> <time_in_ms>
run_and_halt_time 0 30

lpc2148_armusbocd.cfg

# daemon configuration
telnet_port 4444
gdb_port 3333

# tell gdb our flash memory map
# and enable flash programming
gdb_memory_map enable
gdb_flash_program enable

# interface
script interface/arm-usb-ocd.cfg

# jtag speed
# start slow, speed up after reset
jtag_khz 10 1500

# target
script target/lpc2148.cfg

# For more information about the configuration files, take a 
# look at the "Open On-Chip Debugger (openocd)" documentation.

Cheers,

Deltabox

Hello Deltabox,

if you need some examples for the cfg files, take a look here:

http://www.yagarto.de/howto/yagarto1/index.html#htu

Even you will find a lpc2148 example here.

Regards,

Michael

Hey Michael,

Thanks for the link but I already had a look through the page. I also had a look at http://openfacts.berlios.de/index-en.ph … figuration and it explained whats happening in the file. It also seems like I can’t use run_and_init in the config file for the LPC2000 series chips. What should I be using here?

I still need a proper .cfg file written and tested for LPC2138 though. Can anyone help with this?

Hello,

I do not have a file for the LPC2138, but here you can use the lpc2148.

OpenOCD now supports the “target library” which is based on 3 directories:

  • interface

  • event

  • target

If you use OpenOCD r657 from the YAGARTO page, you will get these

directories installed too. For a lpc2148 the cfg file will look like:

(http://www.yagarto.de/download/openocd/ … usbocd.cfg)

# daemon configuration
telnet_port 4444
gdb_port 3333

# tell gdb our flash memory map
# and enable flash programming
gdb_memory_map enable
gdb_flash_program enable

# interface
script interface/arm-usb-ocd.cfg

# jtag speed
# start slow, speed up after reset
jtag_khz 10 1500

# target
script target/lpc2148.cfg

# For more information about the configuration files, take a 
# look at the "Open On-Chip Debugger (openocd)" documentation.

You can use this file for the lpc2138 too.

I also had a look at http://openfacts.berlios.de/index-en.ph … figuration

Take a look in the OpenOCD.pdf which comes with the OpenOCD too, if you load it from my page.

Regards,

Michael

Hey,

I did get the latest (r657) OpenOCD from your page. I didn’t see the PDF earlier but I have it now and I’ll read it in a few minutes.

I have been following the document “Using Open Source Tools for AT91SAM7S Cross Development revision C” and it seems to now be out of date since the version of Eclipse and OpenOCD have come a long way since it was written. There are a few things that might throw people setting up the toolchain for the first time.

For instance the instructions on Page 76 for the section titled “Creating an eclipse project” are hard to follow since Eclipse menus have changed and there is no “Standard Make C Project” listed any longer.

I also had to enter the compiler root path into eclipse “C:\Program Files\yagarto\arm-elf”.

It now appears that I have eclipse fixed up so it compiles the example code for the AT91 however I will change the required files and try to compile for the LPC in a while and let you know how that goes.

I had a read through the LPC2148 files that I found in the three folders you mentioned. I’ll try to use the same thing for the LPC2138 and see how that goes. Do you know off hand if I have to make any changes with regard to addresses etc for flash programming?