1

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?

  • Not intended as an "answer" to your question, but while the process you describe could make sense for final deployment, surely there is a more efficient scheme for development - such as doing it natively from linux, using SWD or a UART bootloader, or even running windows in a virtual machine with shared folders? – Chris Stratton Mar 26 '14 at 14:35
  • I was too annoyed by that USB dance (it worked, but was rather unreliable), so I added a serial interface to mine (https://www.olimex.com/Products/ARM/NXP/LPC-P1343/). – starblue Mar 27 '14 at 21:10
  • Muito Obrigado @Ricardo . – Electropepper Mar 29 '14 at 10:42
  • @Electropepper - For the editing? Not a problem! I see that you got your answer. Cool! – Ricardo Mar 29 '14 at 12:13
  • @starblue we defenitly need to talk, but serial interface doesnt let program the ROM of chip anyway, or does it ? – Electropepper Mar 29 '14 at 12:39

1 Answers1

5

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.

Joe Hass
  • 8,447
  • 1
  • 29
  • 41
  • 1
    [Shameless plug] I have written a trivial C program for this: https://bitbucket.org/jpc/nxpsum . You may find it useful. – jpc Mar 27 '14 at 00:55
  • I bought this board from olimex, and i have only USB bootloader or SWD, but according to what i have read i cant program it with SWD. So what is after all, the format i need to convert the file to be able to dump it into the USB folder ? Is maybe not the format but rather my code that is not working ? P.s - I am using a virtual machine with share folders to move the file to windows system. – Electropepper Mar 27 '14 at 08:00
  • @Electropepper I don't understand your follow-up question about the format. The format is _plain binary_ and jpc has offered a program to generate it. I don't believe that you can't use SWD, but it is true that you can't use JTAG with an LPC1343. What board are you using? – Joe Hass Mar 27 '14 at 10:39
  • Thank you very much jpc and Joe Hass this checksum was indeed all i was missing, i can now finally star working with this device, even thought i know understand so much what was @starblue was talking about the USB dance. – Electropepper Mar 31 '14 at 08:13