Electronic – Program LPC1343 thru USB bootloader with the right FILE format

nxpprogrammingusb

I'm having a real hardtime programming my LPC1343 with the method mentioned in this question (Can an LPC1343 accept its initial program over USB?).

I am using a Linux machine and arm-none-eabi-gcc. I sucessfully compiled my code to blink a led, and then I get my .elf file and use arm-none-eabi-objcopy to convert it to the final format. Then I get that file in a USB stick and into a windows machine, and there I copy it to my LPC1343 thru the USB interface.

My problem is that after I turn off the chip and go into run mode it automatically goes again back into USB bootloader mode, meaning it didn't recognise the file. I have tried the following formats:

  • elf32-littlearm
  • elf32-bigarm
  • elf32-little
  • elf32-big
  • plugin
  • srec
  • symbolsrec
  • verilog
  • tekhex
  • binary
  • ihex.

Has anyone successfuly preogramed this chip thru USB? If so, what file format was used?

Best Answer

The file is a straight binary file. So, the first four bytes are the initial stack pointer value, the next four bytes are the initial program counter, and the interrupt vectors follow. As an example, here are the first 32 bytes of a known-good file:

00 08 00 10 99 3c 00 00 21 40 00 00 25 40 00 00
29 40 00 00 2d 40 00 00 31 40 00 00 9a 7a fe ef

The word stored at address 0x1C (seventh word) is a checksum of the first six words. See section 21.7 in the LPC13xx User's Manual for details. For the LPC1343 the file is exactly the same size as the flash: 32768 bytes.