PCM Hammer P01 and P59 flash tool v015

They go by many names, P01, P59, VPW, '0411 etc. Also covering E38 and newer here.
User avatar
Tazzi
Posts: 3431
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: PCM Hammer - new ls1 flash tool

Post by Tazzi »

NSFW wrote:I will also add some configuration settings so people can choose how the app handles PCMs that have unknown operating systems, and we can use OSID and PcmInfo to distinguish between different types of PCMs.
Popup box that requests selecting what the ECU is on initial connection if its OSID doesnt match one entered?
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
NSFW
Posts: 680
Joined: Fri Feb 02, 2018 3:13 pm

Re: PCM Hammer - new ls1 flash tool

Post by NSFW »

Check out the nsfw/P04 branch. I haven't tested it, so there might be some surprises, but I think it'll work.

You'll need to add to the code PcmInfo... the existing code will give you some examples to follow when you add the P04 operating systems. Note that you'll need to set the KernelFileName and KernelBaseAddress properties in addition to the properties that are being set for other OSIDs. I also added a ValidationMethod property, and you might as well set that too. Nothing is using that yet but we can use it to do checksum validation differently for P01, P04, and P59.
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
Vampyre
Posts: 261
Joined: Wed Dec 06, 2017 1:02 pm
cars: grand am, trans am

Re: PCM Hammer - new ls1 flash tool

Post by Vampyre »

thanks NSFW, yeah I found the pcm info section when i first started tinkering with it and have been using it to do things like kernel address and key algo.
case 12201465:
case 12201463:
this.KeyAlgorithm = 2;
this.Description = "P04 FWD V6";
this.KernelBaseAddress = 0xFF9000;
this.ImageBaseAddress = 0x0;
this.ImageSize = 512 * 1024;
break;
and hardcoded key since I dont know the algo or how to add darkhorizons file.

Darkhorizon sent me the attached key algorithm file to replace the current one to help with seed/key issue.
Attachments
KeyAlgorithm.txt
(26.04 KiB) Downloaded 252 times
Vampyre
Posts: 261
Joined: Wed Dec 06, 2017 1:02 pm
cars: grand am, trans am

Re: PCM Hammer - new ls1 flash tool

Post by Vampyre »

tried to rebuild read_kernel and now i get this but all files are in the folder

C:\>C:\Users\vampy\Documents\PcmHacks-2019.01.16.02\PcmHacks-2019.01.16.02\Kernels\build.bat
m68k-elf-gcc.exe: error: main.c: No such file or directory
m68k-elf-gcc.exe: error: micro-kernel.c: No such file or directory
m68k-elf-gcc.exe: fatal error: no input files
compilation terminated.
c:\SysGCC\m68k-elf\bin\m68k-elf-ld.exe: cannot open linker script file micro-kernel.ld: No such file or directory
c:\SysGCC\m68k-elf\bin\m68k-elf-objcopy.exe: 'micro-kernel.elf': No such file
Access is denied.
m68k-elf-gcc.exe: error: main.c: No such file or directory
m68k-elf-gcc.exe: error: read-kernel.c: No such file or directory
m68k-elf-gcc.exe: error: common.c: No such file or directory
m68k-elf-gcc.exe: fatal error: no input files
compilation terminated.
c:\SysGCC\m68k-elf\bin\m68k-elf-ld.exe: cannot open linker script file read-kernel.ld: No such file or directory
c:\SysGCC\m68k-elf\bin\m68k-elf-objcopy.exe: 'read-kernel.elf': No such file
Access is denied.
*-kernel.bin
The system cannot find the file specified.
0 file(s) copied.
Volume in drive C has no label.
Volume Serial Number is 6872-1878
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

Vampyre wrote:tried to rebuild read_kernel and now i get this but all files are in the folder

C:\>C:\Users\vampy\Documents\PcmHacks-2019.01.16.02\PcmHacks-2019.01.16.02\Kernels\build.bat
m68k-elf-gcc.exe: error: main.c: No such file or directory
m68k-elf-gcc.exe: error: micro-kernel.c: No such file or directory
m68k-elf-gcc.exe: fatal error: no input files
compilation terminated.
c:\SysGCC\m68k-elf\bin\m68k-elf-ld.exe: cannot open linker script file micro-kernel.ld: No such file or directory
c:\SysGCC\m68k-elf\bin\m68k-elf-objcopy.exe: 'micro-kernel.elf': No such file
Access is denied.
m68k-elf-gcc.exe: error: main.c: No such file or directory
m68k-elf-gcc.exe: error: read-kernel.c: No such file or directory
m68k-elf-gcc.exe: error: common.c: No such file or directory
m68k-elf-gcc.exe: fatal error: no input files
compilation terminated.
c:\SysGCC\m68k-elf\bin\m68k-elf-ld.exe: cannot open linker script file read-kernel.ld: No such file or directory
c:\SysGCC\m68k-elf\bin\m68k-elf-objcopy.exe: 'read-kernel.elf': No such file
Access is denied.
*-kernel.bin
The system cannot find the file specified.
0 file(s) copied.
Volume in drive C has no label.
Volume Serial Number is 6872-1878
Either the GNU M68k toolchain is not installed or not installed where the hard coded build.bat expects it to be, you either need to put things exactly where the batch file expects things to be or you need to modify the batch file.

It appears you are using an old build.bat, and the .ld files for micro-kernel.c and read-kernel.c are missing.
I would venture to guess a mash of particulate from different versions.

As a tip, create a directory one level below PcmHacks (I use 'Lib') and add it to your LOCAL path only, not the system path!
Example:
I create my directory structure something like:

Code: Select all

[drive:\...]\Automotive\PcmHacks\PcmHacks
[drive:\...]\Automotive\PcmHacks\Lib
Where PcmHacking Suite source code (local Git repo) is.
[drive:\...]\Automotive\PcmHacks\PcmHacks
Common directory for PcmHacking Suite.
[drive:\...]\Automotive\PcmHacks\Lib
Then in that common directory create a batch file called: envset.cmd, like,

Code: Select all

@echo off
set path=%path%;[drive:\...]\Automotive\PcmHacks\lib
(One could also add the path to the GNU M68k \bin directory here and remove the hard coded path in the local build batch file)

Obviously this is Windows, you need to adjust the [drive:\...] to match your system.

Then you can open a command prompt from Explorer by browsing to and selecting the Kernels directory then,
Hold: Shift Key
Right-Click: Kernels
Select: Open Command Window Here

Then run '..\..\lib\envset' from the Kernels directory.

This allow the use of your own 'bld.cmd' batch file like the following that is placed in the common directory ... It also gives a location that is in the path specifically for PcmHacking Suite for other tools one might want when working on the PcmHacking Suite without polluting the system path.
(It would be helpful if the PcmHacks build.bat was renamed to build.cmd, .bat executes before .cmd, this would allow people to use their own build.bat and have it execute before PcmHacks build.cmd, without editing their environment)

Code: Select all

@setlocal
@echo off

REM * Set option defaults here ...
set GCC_LOCATION=C:\SysGCC\m68k-elf\bin\

goto beginning
* Create a non executed area for our header, notes and routines/procedures.
*********************************************************************
*
* Name         :
* Description  :
* Author       :
* Authored Date:
* Revision Date:
*
* Notes
*   : -fomit-frame-pointer = remove the boilerplate linkw/unlk instructions 
*   : -c    = compile but do not link
*   : -O1   = optimization level
*   : -g    = include debug information - not using this because the
*   :         disassembly is either corrupt or just incomprehensible
*
*
*************************************** Routines/Procedures
* Here we'll collect our routines/procedures ...
*
* Removes trailing slash if it exists
:Detrailslash in out
  set A=%~1
  if %A:~-1%==\ (
    set %2=%A:~0,-1%
  ) else (
    set %2=%A%
  )
  goto :EOF
*
*
*************************************** Beginning
* Let us get to it!
:beginning

REM * Ensure we have no trailing slash.
call :Detrailslash "%GCC_LOCATION%" GCC_LOCATION

REM *** write-kernel
"%GCC_LOCATION%\m68k-elf-gcc.exe" -c -fomit-frame-pointer -std=gnu99 -mcpu=68332 -O0 main.c write-kernel.c crc.c common.c common-readwrite.c flash.c flash-intel.c flash-amd.c
if %errorlevel% neq 0 goto :eof

"%GCC_LOCATION%\m68k-elf-ld.exe" -T kernel.ld main.o write-kernel.o crc.o common.o common-readwrite.o -o kernel.elf flash.o flash-intel.o flash-amd.o
if %errorlevel% neq 0 goto :eof

"%GCC_LOCATION%\m68k-elf-objcopy.exe" -O binary --only-section=.kernel_code --only-section=.rodata kernel.elf kernel.bin
if %errorlevel% neq 0 goto :eof

"%GCC_LOCATION%\m68k-elf-objdump.exe" -d -S kernel.elf > kernel.disassembly
if %errorlevel% neq 0 goto :eof

if not exist ..\Apps\PcmHammer\bin\debug (
  mkdir ..\Apps\PcmHammer\bin
  mkdir ..\Apps\PcmHammer\bin\Debug
)

echo kernel.bin
copy kernel.bin ..\Apps\PcmHammer\bin\debug\kernel.bin
This can be expanded on by creating a shortcut that opens a command prompt that runs 'envset.cmd' and leaves you at the 'Kernels' prompt ready to type bld (or build). I choose not to.

Hopefully this is brain food for someone ...

-Enjoy
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

Vampyre wrote:thanks NSFW, yeah I found the pcm info section when i first started tinkering with it and have been using it to do things like kernel address and key algo.
case 12201465:
case 12201463:
this.KeyAlgorithm = 2;
this.Description = "P04 FWD V6";
this.KernelBaseAddress = 0xFF9000;
this.ImageBaseAddress = 0x0;
this.ImageSize = 512 * 1024;
break;
and hardcoded key since I dont know the algo or how to add darkhorizons file.

Darkhorizon sent me the attached key algorithm file to replace the current one to help with seed/key issue.
From the looks of @darkhorizons KeyAlgorithm.txt, I would venture to guess that it gets renamed to KeyAlgorithm.cs and replaces the current KeyAlgorithm.cs.

So what are the algo codes you are hard coding, what are you generating the key with??
(If I'm speaking the correct terms)
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
Vampyre
Posts: 261
Joined: Wed Dec 06, 2017 1:02 pm
cars: grand am, trans am

Re: PCM Hammer - new ls1 flash tool

Post by Vampyre »

yes gampy you are correct, was originally a cs file but can only upload txt on here.

im not hard coding the algo, I know the key so I just hard coded it
// Algorithm 2 (not implemented)
public static UInt16 GetKey_02(UInt16 seed)
{
UInt16 key = 0x8259;

return key;
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

How did you come up with your key??
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
Vampyre
Posts: 261
Joined: Wed Dec 06, 2017 1:02 pm
cars: grand am, trans am

Re: PCM Hammer - new ls1 flash tool

Post by Vampyre »

everything is installed to default location, works on desktop but not laptop. I dled hammer4 to rebuild its read kernel for testing left ever thing in default directories.

used serial monitor program while reading it with my other software to catch the seed/key.
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

Vampyre wrote:used serial monitor program while reading it with my other software to catch the seed/key.
I see said the blind man ...

Thank you

So, for All y'all lucky with math brains, what is needed to figure out the algo, what does it take??
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
Post Reply