Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add P08 Read Only support. #300

Merged
merged 2 commits into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CheckBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# 2: Kernel Base Address
# 3: Loader Base Address or NOLOADER if a loader is not used.
#
for p in "P04 FF9090 FF9890" "E54 FF8F50 NOLOADER"; do
for p in "P04 FF9090 FF9890" "P08 FFA800 FFB000" "E54 FF8F50 NOLOADER"; do
pcm="${p%% *}";
p="${p#* }"
address="${p%% *}"
Expand Down
2 changes: 1 addition & 1 deletion Apps/PcmHammer/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ private async void readPropertiesButton_Click(object sender, EventArgs e)
}

// Disable BCC lookup for the P04
if (pcmInfo != null && pcmInfo.HardwareType != PcmType.P04)
if (pcmInfo != null && pcmInfo.HardwareType != PcmType.P04 && pcmInfo.HardwareType != PcmType.P08)
{
var bccResponse = await this.Vehicle.QueryBCC();
if (bccResponse.Status == ResponseStatus.Success)
Expand Down
15 changes: 15 additions & 0 deletions Apps/PcmLibrary/Misc/FileValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ public uint GetOsidFromImage()
}
break;

case PcmType.P08:
osid += image[0x8000] << 24;
osid += image[0x8001] << 16;
osid += image[0x8002] << 8;
osid += image[0x8003] << 0;
break;

case PcmType.P10:
osid += image[0x52E] << 24;
osid += image[0x52F] << 16;
Expand Down Expand Up @@ -364,6 +371,14 @@ private PcmType ValidateSignatures()
}
}

// P08 512Kb
// Must be before P04, P08 can pass as a P04, P04 cannot pass as a P08
this.logger.AddDebugMessage("Trying P08 512Kb");
if ((image[0x7FFFC] == 0xA5) && (image[0x7FFFD] == 0x5A) && (image[0x7FFFE] == 0xA5) && (image[0x7FFFF] == 0xA5))
{
return PcmType.P08;
}

// P04 512Kb
this.logger.AddDebugMessage("Trying P04 512Kb");
if (((image[0x7FFFE] == 0xA5) && (image[0x7FFFF] == 0x5A)) || // most
Expand Down
24 changes: 24 additions & 0 deletions Apps/PcmLibrary/Misc/PcmInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum PcmType
Undefined = 0, // required for failed osid test on binary file
P01_P59,
P04,
P08,
P10,
P12,
E54,
Expand Down Expand Up @@ -2091,6 +2092,29 @@ public PcmInfo(uint osid)
//this.KernelMaxBlockSize = 4096;
break;

// P08
case 9364970:
case 12206029:
this.Description = "P08";
this.IsSupported = false;
this.LoaderRequired = true;
this.ValidationMethod = PcmType.P08;
this.HardwareType = PcmType.P08;
this.KernelFileName = "Kernel-P08.bin";
this.KernelBaseAddress = 0xFFA800;
this.LoaderFileName = "Loader-P08.bin";
this.LoaderBaseAddress = 0xFFB000;
this.ImageBaseAddress = 0x0;
this.ImageSize = 512 * 1024;
//this.RAMSize = 0x4DFF;
this.KeyAlgorithm = 13;
this.ChecksumSupport = false;
this.FlashCRCSupport = true;
this.FlashIDSupport = true;
this.KernelVersionSupport = true;
//this.KernelMaxBlockSize = 4096;
break;

// P10
case 12213305:
case 12571911:
Expand Down
3 changes: 2 additions & 1 deletion Kernels/BuildAll.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ rem * They would need to be changed below.

for %%A in (
"-pP01 -aFF8000",
"-pP04 -aFF9090 -lFF9890 -x"
"-pP04 -aFF9090 -lFF9890 -x",
"-pP08 -aFFA800 -lFFB000 -x",
"-pP10 -aFFB800",
"-pP12 -aFF2000",
"-pE54 -aFF8F50 -x"
Expand Down
7 changes: 5 additions & 2 deletions Kernels/Common-Assembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
|

| J1850 registers
#if defined P01 || defined P10 || defined P12 || defined E54
#if defined P01 || defined P08 || defined P10 || defined P12 || defined E54
.equ J1850_Config, 0xFFF600
.equ J1850_Command, 0xFFF60C
.equ J1850_TX_FIFO, 0xFFF60D
.equ J1850_Status, 0xFFF60E
.equ J1850_RX_FIFO, 0xFFF60F
#if defined P10
#if defined P08
.equ COP1, 0xFFFA27
.equ COP2, 0xFFC006
#elif defined P10
.equ COP1, 0xFFFA27
.equ COP2, 0x800806
#elif defined P12
Expand Down
3 changes: 2 additions & 1 deletion Kernels/Loader.S
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ ProcessMode36NextSum:
lsl.l #8, %d3 | Logical Shift Left
or.b (%a3)+, %d3 | Second byte
cmp.l %d3, %d4 | Is the sum OK?
beq.s ProcessMode36MemCopy | Do it
|beq.s ProcessMode36MemCopy | Do it
bra.s ProcessMode36MemCopy | Temp hack to ignore Checksums, they work for P04, not P08

| Process Mode36 Response Fail
movea.l #Mode36Reply, %a0 | Mode 36 reply
Expand Down