Segment Swap utility

They go by many names, P01, P59, VPW, '0411 etc . Circa 1999 to 2006. All VPW OBD2 PCMs.
Posts: 294
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Postby kur4o » Mon Feb 03, 2020 7:36 am

And of course the same bug when reading segments :rant:


One more added. Now the extracted eeprom data is 1 byte longer. It doesn`t affect bin building even with 1 byte longer. I guess the first segment overwrites the extra byte.

Of course I tried building invalid bin on purpose. The good news I still haven`t managed to do it. But it is hard to tell what went wrong by the error message. Which segments is bad. Is it size, position or OS mismatched. If the mistake is made by chance you will have hard time identifying the exact reason. A little more detailed error log will help alot.

When I select load from file cal segments, the dialog always default to .bin files. Can you make it to default to all files.

On a future release,
It will be nice on the info button to show the checksums and mark them if they are good.
When we have a good solid base you can focus on the small details.

Site Admin
User avatar
Posts: 6397
Joined: Sat Feb 28, 2009 8:34 pm

Re: Segment Swap utility

Postby antus » Mon Feb 03, 2020 9:56 am

I went through this writing my tools. There is no right answer but you need to decide either address and length pairs, then address aka start + length gives you the start and end addresses. Or use the start and end addresses, and compensate for the length as you describe. I think start and length is better because you can feed the values straight in to block copy functions that take length but its your call.
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

User avatar
Posts: 292
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Tue Feb 04, 2020 6:24 am

New version uploaded (1.4)
Bug fixes, GUI improvements

Now using length, instead of end address in handling.
Segment-file reading & validation right after selection, not when saving.

Current version don't allow segment-file reading outside of "calibration" -folder, only segment reading from full binary. So: I think it is good to default "*.bin" in file browser ?

Posts: 294
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Postby kur4o » Tue Feb 04, 2020 8:19 am

Somehow the Main OS segment is filled with 4afc. I guess it didn`t get copied.
I also managed to build bad bin. I think that an extra protection can be inserted on selecting segments. It is absolutely critical that the selected segment matches its place and the size is the same as the defined in the OS $500 area.
For example upon selecting TransCal segments read the fourth byte of the segment and if it is not $04, ignore it and print an error message. Than read the size of the segment and compare it against the info stored at the selected OS $500 section, if the size differs print an error.
Now you are bullet proofed for some bad segment sneaking out.
An nice addition on the Modify bin tab will be to add correct cheksum button.

Another thought for improvement. With so many files floating around we need to identify if a segment is modified somehow or is completely virgin and intacked. It is very likely that a modified files can sneak in the database and wreck havoc.
The best way will be to compare the checksum or print it somewhere in the description for manual checks or A list can be made, stock segment vs checksum for automatic checks.

User avatar
Posts: 292
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Wed Feb 05, 2020 5:54 am

kur4o wrote:Somehow the Main OS segment is filled with 4afc. I guess it didn`t get copied.
I also managed to build bad bin. I think that an extra protection can be inserted on selecting segments. It is absolutely critical that the selected segment matches its place and the size is the same as the defined in the OS $500 area.
For example upon selecting TransCal segments read the fourth byte of the segment and if it is not $04, ignore it and print an error message. Than read the size of the segment and compare it against the info stored at the selected OS $500 section, if the size differs print an error.
Now you are bullet proofed for some bad segment sneaking out.
An nice addition on the Modify bin tab will be to add correct cheksum button.

Another thought for improvement. With so many files floating around we need to identify if a segment is modified somehow or is completely virgin and intacked. It is very likely that a modified files can sneak in the database and wreck havoc.
The best way will be to compare the checksum or print it somewhere in the description for manual checks or A list can be made, stock segment vs checksum for automatic checks.


Ver 1.5 uploaded.

Extra validation cheks added, bug fixes etc.
"Fix checksums" added to "Modify BIN", altough not needed, because checksums are automatically fixed when saving bin. Even without any other modifications.

It is good to add checks - to the point. But if someone want to do stupid things and create corrupted bin, it can be done with or without this app :D

Posts: 294
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Postby kur4o » Wed Feb 05, 2020 7:41 am

The extra protection can be too much for the advanced user, but for the average Joe it is good to have that.
Even one person that builds a bad bin and bricks the pcm is enough for the program to be considered unsafe. I will really hate bad reviews, because some dump ass tried to experiment and fried the pcm.

I tried the extra protection and a bad cal segment can`t be selected, which is great. It just defaults to 0. Now somehow I managed to save the bin and the missing segment was filled with 4afc. I also forget to select an eeprom region and 4000-8000 area also got filled with 4afc.
This is kind of a brick situation, so if these conditions are not fulfilled[All segments are valid and eeprom is selected], it will be good to disable the save button.

The program starts to get its final shape and I really like how it goes so far. I still haven`t checked thoroughly enough the patch section, but when the main features are all done I will focus on that area.

Posts: 21
Joined: Sat Aug 29, 2009 9:52 pm

Re: Segment Swap utility

Postby Scott68B » Wed Feb 05, 2020 10:54 am

I tried it for fun but didn't flash a PCM with the result. So it appears that you supply the bin that you want to segment swap to and then pick a bin that has a segment that you want to swap. Is that correct? It looks pretty neat. Thanks for spending the time on this!

User avatar
Posts: 292
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Thu Feb 06, 2020 3:29 am

kur4o wrote:The extra protection can be too much for the advanced user, but for the average Joe it is good to have that.
Even one person that builds a bad bin and bricks the pcm is enough for the program to be considered unsafe. I will really hate bad reviews, because some dump ass tried to experiment and fried the pcm.

I tried the extra protection and a bad cal segment can`t be selected, which is great. It just defaults to 0. Now somehow I managed to save the bin and the missing segment was filled with 4afc. I also forget to select an eeprom region and 4000-8000 area also got filled with 4afc.
This is kind of a brick situation, so if these conditions are not fulfilled[All segments are valid and eeprom is selected], it will be good to disable the save button.

The program starts to get its final shape and I really like how it goes so far. I still haven`t checked thoroughly enough the patch section, but when the main features are all done I will focus on that area.


Uploaded version 1.6

Yes, there was some bugs, and it was possible to save bin without eeprom_data, maybe other problems too.
Added checks:

* before collecting parts together:
- OS segments size
- All CAL segments: size, segment number
- Eeprom data must have VIN & version

* After collecting segments, patches etc:
- All CAL segments: segment number
- Eeprom data must have VIN & version
- OS segment 2, must begin: 4E 56 (Checked several files, all have this. To be confirmed)

==> Allready found some P01 files without Eeprom_data. OR data is in different location??

Also made some modifications: less reading from disk, more handling in memory.

User avatar
Posts: 292
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Thu Feb 06, 2020 4:05 am

Scott68B wrote:I So it appears that you supply the bin that you want to segment swap to and then pick a bin that has a segment that you want to swap. Is that correct?


Yes, you can start from full binary file (Modify bin) and add segments from other bin files. (or from collection)
Or you can "start from scratch" (Build new BIN): select all segments from collection of previously extracted segments (or from full bin files)

Instructions will be added later. It's not ready for "average user" yet.

User avatar
Posts: 292
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Thu Feb 06, 2020 9:35 pm

joukoy wrote:found some P01 files without Eeprom_data. OR data is in different location??


Fixed bug, Eeprom_data reading is now ok.
Version 1.6.1 uploaded, with several GUI fixes

PreviousNext

Return to GM LS1 512Kbyte and 1Mbyte

Who is online

Users browsing this forum: No registered users and 6 guests