dwmw2 / mphidflash

Automatically exported from code.google.com/p/mphidflash
GNU General Public License v3.0
0 stars 1 forks source link

mphidflash breaks the HID bootloader under Linux #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When I try to write a program :

./mphidflash -w file.hex
USB HID device found
  Device family: PIC18
  Program memory: 20480 bytes free. 8 bytes free. 
Erasing...
Writing hex file 'USB Device - Libusb - Generic Driver - C18 - PICDEM 
FSUSB.hex':.....................................................................
..........................................
Verifying:.
./mphidflash Error: Verify failed

And breaks the bootloader.
I'm using the last svn version under Linux.

Original issue reported on code.google.com by rafad...@gmail.com on 7 Aug 2010 at 5:51

GoogleCodeExporter commented 8 years ago
I've solved the problem deleting some lines of hex file (I think configuration 
bit lines) because in debug mode I've seen it attempts to write in 
Addresses:0000 0008 and 0018, a bootloader area.
So my hex file starts:
:020000040000FA

:0600000022EF13F01200D4

:0600080004EF08F01200F5

:060018000CEF08F01200DD

:0610000022EF13F01200C4

:06100800BEEF10F0120023

:0610180009EF11F01200C7

:06102A0001006226000037
...

This 3 lines are trying to write in bootloader zone so I've deleted:
:06 0000 0022EF13F01200D4
:06 0008 0004EF08F01200F5
:06 0018 000CEF08F01200DD

And now works fine. Maybe mphidflash should check if it's trying to write data 
in bootloader zone, ignore that data and warn the user about it.

Original comment by rafad...@gmail.com on 7 Aug 2010 at 6:34

GoogleCodeExporter commented 8 years ago
I've done a fast&dirty fix; I've added a conditional in hex.c:152 which checks 
if addr is lower than bootloader size (0x1000 in my case) and if are the 
configuration bits (0x300000 in my case).

I attach the modified source hex.c

Original comment by rafad...@gmail.com on 7 Aug 2010 at 10:27

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you, Rafad... This is still a fix that works for EBF v215. 

Original comment by scot...@gmail.com on 24 Apr 2014 at 2:06

GoogleCodeExporter commented 8 years ago
Surely this is a bug in whatever generated the hex file, not mphidflash?

Unless boundaries for bootloader and config bits can be automatically 
determined, this cannot be addressed by the flashing utility and should be 
fixed at the source of the problem.

Marking this as "Invalid" until convinced otherwise!

Original comment by fnargwibble on 30 Jun 2014 at 6:25