Does LPCXpresso create broken .bin files?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does LPCXpresso create broken .bin files?

392 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Thu Jan 24 07:15:25 MST 2013
Hello!

I have written my own bootloader for the LPC1788 which is able to overwrite the program flash. Normally the bootloader will just jump to the program's target address, unless the user program writes some EEPROM-Value and soft-resets with the watchdog to enter it programming mode. So:
I have one bootloader-project which is written to address 0x0 (in the MCU settings screen).
I also have one actual project which is written to address 0x6000 (same screen).

So far, this worked like a charm. Now I programmed a .bin file that was created by LPCXpresso (4.3) and I noticed that the user program doesn't work anymore. I am sure that this bootloader worked in another project just fine, so I am a bit confused about what changed.
Reprogramming with LPCXpresso's .axf file still yields a working user program, so does using the .hex file with Flash Magic. Just the .bin file with my bootloader fails. Then I tried to program the .bin file with LPCXpresso's programmer dialog, since I wanted to see if the user program would work (also the dialog seemed to support it). The user program doesn't work and I got some (sorry...) error message right after programming. After that, whenever trying to use LPCXpresso for programming it tells me that "the target is not debuggable" [1]. Flash Magic still works, but I don't want to use that.

What is going on here?!




[1]
<code>
LPCXpresso Debug Driver v4.0 (Sep 19 2012 09:03:19)
Found chip XML file in C:/Blah/Project_name/Debug/LPC1788.xml
02: Failed on connect: Ep(01). Target marked as not debuggable.
Emu(0): Connected. Was: None. DpID:     EDB6. Info: HID32FS12
</code>
Labels (1)
0 Kudos
2 Replies

328 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Fri Jan 25 07:07:33 MST 2013
Problem solved!

Out software guys have decided to reimplement my C# programmer for the bootloader in C++. They also decided to add tons of bugs. One of them was that the file wasn't correctly read so the end of the transmitted .bin file differed from the original one.

Good thing this wasted just one day...
0 Kudos

328 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Fri Jan 25 02:47:38 MST 2013
Well, I can confirm that the .bin file is perfectly fine. I just didn't realize yesterday that LPCXpresso doesn't automatically write it to the right location (0x6000 in my case). So since the vector table was wrong it obviously couldn't work decently at all.

Yet I am still wondering what's going on.
When I program the .bin file with LPCXpresso the program is working perfectly fine. But when I program it with my bootloader it won't. I started debugging in the bootloader project and followed the disassembly to see that it gets into the HardFault Handler at some point, even before entering my own main function, possibly from somewhere inside &lt;malloc&gt;.

I thought it was the project settings, but then why does it work when programming the .bin file with LPCXpresso?
Any ideas?


Regards,
Tim


Edit: Is there some convenient way in LPCXpresso (or in general) to dump the whole content of the device's flash memory into a file for easy comparison?
0 Kudos