Forums

Open Source Project: Replacement for the Philips LPC2000 flash utility

Started by Jason Morgan December 3, 2006
Hi,

I am in the process of writing a replacement for the Philips LPC2000
Flash Utility.

Being a Python fan I'm naturally writing it in Python. Hopefully the
upside of this will be complete portability.

At the moment the functionality is very limited. But in the long
term, as well as the standard features, I plan to add features that
are not supported by the existing flash tools; e.g. programming
external memory and some test functions, in fact this is my main
reason for writing it.

Obviously, there is a lot to do and I could do with a hand. If
there are any other people out there with an interest in helping
develop this project I will set up a project at sourceforge. You
don't even have to know much Python, this would be a good change to
learn!!

The project will be open source under the GPL license.

regs,
Jason.

An Engineer's Guide to the LPC2100 Series

> I am in the process of writing a replacement for the Philips LPC2000
> Flash Utility.
>
> Being a Python fan I'm naturally writing it in Python. Hopefully the
> upside of this will be complete portability.

Are you aware of the lpc2isp tool?
It's an open-source replacement for the Philips flash utility
(command-line only). It's written in C, not python.

In my opinion I would not be a bad thing to redesign lpc2isp.

> At the moment the functionality is very limited. But in the long
> term, as well as the standard features, I plan to add features that
> are not supported by the existing flash tools; e.g. programming
> external memory and some test functions, in fact this is my main
> reason for writing it.

As far as I understand, both the official flash utility and lpc2isp
talk to the built-in bootloader to do the flashing. I'm not sure if
the bootloader also supports the other things you mention (programming
external memory). I can imagine that this is possible with JTAG
(through the boundary scan).

Regards,
Bertrik
Hi,

Yes, I am aware of this project, infact, its source code has been
very useful in reverse engineering the Philips ISP CLI, which
differs somewhat from their own documentation.

As I said, I need to take this much furthur than internal Flash only
and also add some more useful debugging tools.

Not to mention making it platform agnostic.....

Would you be interested in contributing?

regards,
jason.
Hi,

I could help out testing on the Mac OS X platform if you like. I also have some experience in Python.

Arthur
Hi Arthur,

Thanks for the offer, I will be in touch when the project is more complete.
There is still a lot more to do, but the foundations are in place.
At the moment I can boot and upload hex files into RAM, I am working on
programming external Flash, then I will add programming internal Flash.

Tell me, does pySerial work on the mac?

Cheers,
Jason.
Hi,

taken from sourceforge:

>pySerial 1.21 is compatible with Python 2.0 on Windows, Linux and several un*x like systems, MacOSX and Jython.

So it probably will, all serial ports on Mac OS X systems, USB to serial converters, register themselves as a device in /dev, so wouldn't expect problems.

Arthur
Hi,

A version of this is now ready, at least in an alpha form. I'm
getting ready to put it on Sourceforge as a release, but want to do
a bit more testing first. It is still a bit clunky, and many of the
features it really should have are incomplete, but is anybody up for
giving it a go?

Distribution:
Python 2.5 script + some assembly language as an Eclipse project
using GCC (the latter is not required unless you want to change the
functionality big time)

Platform:
Anything that will run Python+pySerial and has a spare RS232 serial
port. Although I have only tested it on WindowsXP, it should
certainly work on Cygwin, Linux and Macintosh as well.
It should work with virtual serial ports as well.

Dependencies - Runtime (script form):
Python > 2.4
pySerial
wxPython (for the UI, later)

Dependencies - Runtime (Win32 .EXE form)
none

Dependencies - Build:
Runtime+
Eclipse + WinARM (or any other GNU toolchain, but you will have to
work it out yourself)
py2exe if you want to make a Win32 .exe distribution

Done:
Boot into ISP mode
Load data into internal RAM
Read/Write internal memory
Program external flash (AMD 29LVxxx)
Configure external bus
Reboot with or without ISP

TODO:
Speed it up - currently relies on timeouts too much
Read/Write memory that is outside of the chip
Load data into external RAM
Individual sector erase
Program/erase internal Flash
Internal and external Flash sector protection
Handle differences between LPC family members
User interfaces (GUI and command line)
Support other arrangements and types of external flash
Lots and lots of testing
MSWindows runtime & installer - probably when the UI is done
I am also thinking of some integration with OpenOCD?????
Jason Morgan wrote:
> A version of this is now ready, at least in an alpha form. I'm
> getting ready to put it on Sourceforge as a release, but want to do
> a bit more testing first. It is still a bit clunky, and many of the
> features it really should have are incomplete, but is anybody up for
> giving it a go?
>
> Distribution:
> Python 2.5 script + some assembly language as an Eclipse project
> using GCC (the latter is not required unless you want to change the
> functionality big time)
>
> Platform:
> Anything that will run Python+pySerial and has a spare RS232 serial
> port. Although I have only tested it on WindowsXP, it should
> certainly work on Cygwin, Linux and Macintosh as well.
> It should work with virtual serial ports as well.
>
> Dependencies - Runtime (script form):
> Python > 2.4
> pySerial
> wxPython (for the UI, later)
>
> Dependencies - Runtime (Win32 .EXE form)
> none
>
> Dependencies - Build:
> Runtime+
> Eclipse + WinARM (or any other GNU toolchain, but you will have to
> work it out yourself)
> py2exe if you want to make a Win32 .exe distribution
>
> Done:
> Boot into ISP mode
> Load data into internal RAM
> Read/Write internal memory
> Program external flash (AMD 29LVxxx)
> Configure external bus
> Reboot with or without ISP
>
> TODO:
> Speed it up - currently relies on timeouts too much
> Read/Write memory that is outside of the chip
> Load data into external RAM

How are you planning to do those last two things?

> Individual sector erase
> Program/erase internal Flash
> Internal and external Flash sector protection

And this?

> Handle differences between LPC family members
> User interfaces (GUI and command line)
> Support other arrangements and types of external flash
> Lots and lots of testing
> MSWindows runtime & installer - probably when the UI is done
> I am also thinking of some integration with OpenOCD?????

Kind regards,
Bertrik
Hi Bertrik,

RE: The last two; The ISP does not support these directly, indeed
neither does it support programming external flash. I have
developed a very small downloadable program that is loaded
automatically by Python. This expands the functionality of ISP, e.g.
for programming external flash and will handle these functions
too. In fact, both these are really the same function, just with a
different byte/word count.

> >
> > TODO:
> > Speed it up - currently relies on timeouts too much
> > Read/Write memory that is outside of the chip
> > Load data into external RAM
>
> How are you planning to do those last two things?
>

I'm not sure which 'this' you mean:
Flash sector write protection is just a function of the external
flash chips. Internally, the entire chip can be protected from
external reading (but not sector by sector) I don't think there is
any write protection though - is there?

If you mean handle the differences, then this is probably the most
daunting task. I only have experience of a couple of the family
members and there are many subtle differences with others. I expect
this will happen in time, especially if others find this tool useful
and want to expand it. Luckily Python is excellent at representing
really complicated and abstract data structures in a flexible way.
> A version of this is now ready, at least in an alpha form. I'm
> getting ready to put it on Sourceforge as a release, but want to do
> a bit more testing first. It is still a bit clunky, and many of the
> features it really should have are incomplete, but is anybody up for
> giving it a go?
>
> Distribution:
> Python 2.5 script + some assembly language as an Eclipse project
> using GCC (the latter is not required unless you want to change the
> functionality big time)

Jason -

We will be very interested in this project, as we now have a Python
2.4+ based console application for controlling an LPC2106-based robot,
and we currently have to launch lpc21isp for firmware updates. When
available, let us know where the code can be found.

Thanks, Howard