Segment Swap utility

They go by many names, P01, P59, VPW, '0411 etc. Also covering E38 and newer here.
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

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.
User avatar
antus
Site Admin
Posts: 8237
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: Segment Swap utility

Post by antus »

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: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

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 ?
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

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
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

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
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

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.
Scott68B
Posts: 22
Joined: Sat Aug 29, 2009 9:52 pm
cars: MGB GM 5.3 GM LS1 ECU

Re: Segment Swap utility

Post by Scott68B »

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
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

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
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

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
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

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
Post Reply