LPC2000 flash writing improved

The LPC2000 flash driver is able to calculate the checksum that’s used by the bootloader to identify a valid flash image.

#flash bank lpc2000 base size 0 0 lpc_variant target # cclk calc_checksum
flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14765 calc_checksum

When ‘calc_checksum’ is specified in the LPC2000 flash bank configuration, the flash writing code inserts the correct checksum whenever a write to offset 0×0 of at least 32 byte (size of the exception vectors) occurs.

flash probe 0
Uses the IAP routines to check the erase state of all flash sectors
flash erase 0 x y
Erases flash blocks x to y using IAP calls
flash info 0
Prints information about the flash bank (block sizes, block starting offsets, erase state)
flash write 0 FILE OFFSET
Writes the binary FILE to the LPC2000 internal flash starting at OFFSET.

2 Responses to “LPC2000 flash writing improved”

  1. Thomas says:

    Hello,

    I just can accross this on Amontec web-side, as I just bought there JTAG interface. Now I wonder if it would be difficult to add FLASH programming support for other ARM7 devices (e.g. Atmel SAM7) to your software? Can you give some advice on that? What tools did you use to compile and debug your code? What would be the best way to start with that?

    Best regards,
    Thomas

  2. Administrator says:

    Adding support for different flash types is rather straight forward. The lpc2000 shows how flash programming using on-chip routines can be achieved, while the cfi flash uses either memory accesses (slow) or short hand-coded assembler routines that are copied to the target and executed there (fast).

    The code has been compiled and debugged using GNU/Linux, though GNU/Cygwin on Windows works as well. The GNU autotools are used to configure the source tree and generate make files, the GNU compiler collection (GCC) is used to compile the code, and the GNU Debugger (GDB) is used to debug problems.