![]() |
Forum Index : Microcontroller and PC projects : Pic32Prog mmbasic+program into a file
![]() ![]() |
|||||
Author | Message | ||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2950 |
G’day Rob, Which version do you want? Also I have found that if the PK3 holds the reset then the files compare OK, but if reset is released the firmware runs and a subsequent compare fails so running mmbasic for the first time changes something. Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Any pickit3 read of the current MMBasic and a test program would be a GREAT starting point. THanks |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
We are making progress. Sadly I have no idea what Mick is talking about so he sounds like the bloke to do the job. I think Quazee would also like things like OPTIONS but I may be wrong. Go for it Mick, you're the man ![]() Peter |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
lets start off with a clean install, no test program. if it is possible to prevent the micromite from starting up between writing the firmware and reading it back, that would be good. cheers, rob :-) |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
I will stand to one side and watch you clever young blokes do your thing. Peter |
||||
led-bloon![]() Senior Member ![]() Joined: 21/12/2014 Location: AustraliaPosts: 207 |
Here tis... My Google Drive Links: https://drive.google.com/file/d/1Ql-GTP0XzvLXbBnCmY5Rqo_8KrSB07pP/view?usp=sharing https://drive.google.com/file/d/1l8kTqaR94igWezQcCvIaHG6fOipyumUC/view?usp=sharing Let me know if you have a problem led Miss you George |
||||
led-bloon![]() Senior Member ![]() Joined: 21/12/2014 Location: AustraliaPosts: 207 |
Link to zip of 3 individual bin files read using pic32prog.exe https://drive.google.com/file/d/1qsZmqD6eKtHhN-Vz-w7zlDVGhm5HSo9H/view?usp=sharing led ![]() Miss you George |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
excellent. to read the whole of MX170 memory use: pic32prog -d ascii:com4 -r prog.bin 0x1D000000 0x3FFFF and pic32prog -d ascii:com4 -r boot.bin 0x1FC00000 0x00BFF note that the first line reads 256k of program flash, and the second lines reads 3k of boot and configuration flash. you will then need to use the specifications here: https://en.wikipedia.org/wiki/Intel_HEX to turn this back into a .hex file. use 'extended linear addressing' (04h) for each of four 64k segments: :02 0000 04 1D00 DD :02 0000 04 1D01 DC :02 0000 04 1D02 DB :02 0000 04 1D03 DA and for the 3k boot and configuration segment: :02 0000 04 1FC0 1B data following should be 16-byte records of type 00h: :10 0000 00 2C1400A0C4C1029DE050039DBC51039D 6F :10 0010 00 45BB019D28AD019DE0A8019DF4AC019D 6B :10 0020 00 FCAF019D24B0019D44B0019D2001019D C4 .... :10 FFF0 00 1400B0AF2400BFAF2000B3AF1800B1AF 02 (the above represents a 64k block from 0000h to FFFFh) and finally the .hex file should end with an 01h marker: :00 0000 01 FF you'll need to calculate the chacksum to go at the end of each data line, as per the above link. for the 04h and 01h records this checksum is already shown. cheers, rob :-) |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
oops, forgot to mention - the spaces in the above lines are to make it easier to read. don't put spaces in the .hex file! cheers, rob :-) |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2950 |
Hi All, Sorry for the delay, I didnt get any notification that there were any replies. If not too late here are a bunch of test burns of a PIC32MX170F256B with ver 5.5.01 programmed and read with a PicKit3. PicKit3 Burns.zip The file contains: Micromite_V5.05.01.hex 'Geoffs Original Distro Held Reset.hex 'Read of clean burn but hold RESET (IPE Option) after burn Release Reset.hex 'Read of clean burn release RESET (allows MMBasic to run/init) With Short Program.hex 'Read of clean burn plus a short demo code. Kind Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Thanks Mick It will be a few day before I can make use of them. The project that got me looking into this is now in the assembly stage. Trying a new way to solder the SMD parts and It's not bad at all. My new best friend ![]() ![]() and a few pic's of the work we did today. ![]() there are two layers 20 sets of 3. ![]() ![]() This my 2nd best friend. ![]() And I needed to add a new test to the code with this cheat. ![]() ![]() Pic's are from my phone and it has a mind of its own on orientation. ![]() So glad I found this forum has make work FUN and a lot easier. Well back to work Thanks again Glenn is a GREAT job you've done and are doing. ![]() |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
here is something to create a .hex file from two .bin files: read pic32.zip 1. unzip into a directory, along with a copy of pic32prog.exe; 2. run ports.bat to identify the port that your micromite is attached to, and edit read.bat to match; 3. run read.bat and press the 'select' button on the 1455 adapter to enter programming mode (not needed with a nano-based programmer), then press the any key to read program flash. repeat for boot/config flash. bin2hex.exe will then run and combine the two binary files into a single 'intel.hex'; 4. program 'intel.hex' into a blank MX170. note that reading takes a LONG time, for me it was around 15 minutes. for the MX470, etc you'll need to edit the flash sizes specified in read.bat. cheers, rob :-) Edited 2019-08-05 00:33 by robert.rozee |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Thanks rob. I found a link you might find useful. Now more and more programs can be run in Widows and Linux. Delphi 10.2 Tokyo Edited 2019-08-10 11:42 by Quazee137 |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Rob can you give me a kinda sudo code for the pascal or links to the library's you used so I can see what they do? I'd like to give it a go in MMBasic. Also thinking of trying to use lazarus and fpc. Been years since I used Delphi on a 286/386 system and apx 20 years when I used Pascal MT+ on a CP/M system. |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
hi, the entire source to bin2hex is in the file bin2hex.dpr in the above archive. there are no other libraries used, aside from the standard ones that are part of delphi (i use delphi 5 professonal). the code essentially does the following: 1. open the file "intel.hex" as output 2. open the file "prog.bin" as input and sets the variable address to 0x1D000000 3. in a loop until eof: ...a. if the lowest 16-bits of address=0 then write an "Extended Linear Address" record, ...b. read 16 bytes from "prog.bin" (incrementing address as we go) and write a "data" record encoding those 16 bytes 4. open the file "boot.bin" as input and sets the variable address to 0x1FC00000 5. in a loop until eof: ...a. if the lowest 16-bits of address=0 then write an "Extended Linear Address" record, ...b. read 16 bytes from "boot.bin" (incrementing address as we go) and write a "data" record encoding those 16 bytes 6. write an "End Of File" record it should be relatively easy for someone to translate the pascal to python or C (or mmbasic for dos). once a couple of folks have verified that the solution in the above archive works, i'll create a version that is a tad more user-friendly. cheers, rob :-) Edited 2019-08-11 07:53 by robert.rozee |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |