-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathecu_definitions.py
154 lines (146 loc) · 5.19 KB
/
ecu_definitions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
from enum import Enum
ECU_IDENTIFICATION_TABLE = [
{
'offset': 0x82014, # RSW zone
'expected': [[54, 54, 50, 49]], #6621
'ecu': {
'name': 'SIMK43 8mbit',
'eeprom_size_bytes': 1048576, # (1024 KiB)
'memory_offset': 0,
'bin_offset': 0,
'memory_write_offset': -0x7000,
'calibration_size_bytes': 0x10000, # 65536 bytes (64 KiB)
'calibration_size_bytes_flash': 0xFEFE, #rounded down to nearest 254 bytes was 0xFFF0
'program_section_offset': 0xA0000,
'program_section_size': 0x60000,
'program_section_flash_size': 0x5FFE8, #rounded down to nearest 254 bytes was 0x5FFF0
'program_section_flash_bin_offset': 0xA0010,
'program_section_flash_memory_offset': 0x10
}
},
{
'offset': 0x90040,
'expected': [[99, 97, 54, 54]], #CA66
'ecu': {
'name': 'SIMK43 2.0 4mbit',
'eeprom_size_bytes': 524288, # (512 KiB)
'memory_offset': 0,
'bin_offset': -0x80000,
'memory_write_offset': -0x7000,
'calibration_size_bytes': 0x10000, # 65536 bytes (64 KiB)
'calibration_size_bytes_flash': 0xFEFE, #rounded down to nearest 254 bytes was 0xFFF0
'program_section_offset': 0xA0000,
'program_section_size': 0x60000,
'program_section_flash_size': 0x5FFE8, #rounded down to nearest 254 bytes was 0x5FFF0
'program_section_flash_bin_offset': 0x20010,
'program_section_flash_memory_offset': 0x10
},
},
{
'offset': 0x88040,
'expected': [[99, 97, 54, 53, 52, 48, 49]], #CA65401 (5WY17)
'ecu': {
'name': 'SIMK43 V6 4mbit (5WY17)',
'eeprom_size_bytes': 524288, # (512 KiB)
'memory_offset': -0x8000,
'bin_offset': -0x88000,
'memory_write_offset': -0x7800,
'calibration_size_bytes': 0x8000, # 32,768 bytes (32 KiB)
'calibration_size_bytes_flash': 0x5F40, #rounded upto nearest 254 was 0x5F00
'program_section_offset': 0x98000,
'program_section_size': 0x70000,
'program_section_flash_size': 0x6FFE4, #rounded down to nearest 254 bytes was 0x6FFF0
'program_section_flash_bin_offset': 0x10010,
'program_section_flash_memory_offset': -0x7FF0 # write to 0x90010
}
},
{
'offset': 0x88040,
'expected': [[99, 97, 54, 53, 52], [99, 97, 54, 53, 53]], #CA654, CA655 (5WY18+)
'ecu': {
'name': 'SIMK43 V6 4mbit (5WY18+)',
'eeprom_size_bytes': 524288, # (512 KiB)
'memory_offset': -0x8000,
'bin_offset': -0x88000,
'memory_write_offset': -0x7800,
'calibration_size_bytes': 0x8000, # 32,768 bytes (32 KiB)
'calibration_size_bytes_flash': 0x6F20, #rounded upto nearest 254 was 0x6F00
'program_section_offset': 0x98000,
'program_section_size': 0x70000,
'program_section_flash_size': 0x6FFE4, #rounded down to nearest 254 bytes was 0x6FFF0
'program_section_flash_bin_offset': 0x10010,
'program_section_flash_memory_offset': -0x7FF0 # write to 0x90010
}
},
{
'offset': 0x48040,
'expected': [[99, 97, 54, 54, 48], [99, 97, 54, 53, 50], [99, 97, 54, 53, 48]], #CA660, CA652, CA650
'ecu': {
'name': 'SIMK41 / V6 2mbit',
'eeprom_size_bytes': 262144, # (256 KiB)
'memory_offset': -0x48000,
'bin_offset': -0x88000,
'memory_write_offset': -0xB800, # write at 0x84800
'calibration_size_bytes': 0x8000, # 32,768 bytes (32 KiB)
'calibration_size_bytes_flash': 0x7F00, #already rounded to 254!
'program_section_offset': 0x98000, #0xA0000 - 0x8000
'program_section_size': 0x30000,
'program_section_flash_size': 0x2FFF0, #196,592 bytes | zone size: 0x30000 - 196,608 bytes (192 KiB)
'program_section_flash_bin_offset': 0x10010,
'program_section_flash_memory_offset': -0x47FF0 #write at 0x50010
}
},
{
'offset': 0x88040,
'expected': [[99, 97, 54, 54, 49]], #CA661 (Sonata)
'ecu': {
'name': 'SIMK43 2.0 4mbit (Sonata)',
'eeprom_size_bytes': 524288, # (512 KiB)
'memory_offset': -0x8000,
'bin_offset': -0x88000,
'memory_write_offset': -0x7800,
'calibration_size_bytes': 0x8000, # 32,768 bytes (32 KiB)
'calibration_size_bytes_flash': 0x5F40, #rounded upto nearest 254 was 0x5F00
'program_section_offset': 0x98000,
'program_section_size': 0x70000,
'program_section_flash_size': 0x6FFE4, #rounded down to nearest 254 bytes was 0x6FFF0
'program_section_flash_bin_offset': 0x10010,
'program_section_flash_memory_offset': -0x7FF0 # write to 0x90010
}
},
]
BAUDRATES = {
0x01: 10400,
0x02: 20000,
0x03: 40000,
0x04: 60000,
0x05: 120000
}
class Routine (Enum):
ERASE_PROGRAM = 0x00
ERASE_CALIBRATION = 0x01
VERIFY_BLOCKS = 0x02
QUERY_IMMO_INFO = 0x12
BEFORE_LIMP_HOME = 0x16 # what does this actually do?
ACTIVATE_LIMP_HOME = 0x18 # user 4 pin code password as parameters
BEFORE_LIMP_HOME_TEACHING = 0x13
LIMP_HOME_INPUT_NEW_PASSWORD = 0x17
LIMP_HOME_CONFIRM_NEW_PASSWORD = 0x19
BEFORE_IMMO_RESET = 0x15 # what does this actually do?
IMMO_INPUT_PASSWORD = 0x1A # 6 digit pin code as parameter
IMMO_RESET_CONFIRM = 0x20
BEFORE_IMMO_KEY_TEACHING = 0x14 # what does this actually do?
# these enums below are not actually used, just serve as documentation
IMMO_TEACH_KEY_1 = 0x1B
IMMO_TEACH_KEY_2 = 0x1C
IMMO_TEACH_KEY_3 = 0x1D
IMMO_TEACH_KEY_4 = 0x1E
BEFORE_SMARTRA_NEUTRALIZE = 0x25
SMARTRA_NEUTRALIZE = 0x26
class IOIdentifier (Enum):
CHECK_ENGINE_LIGHT = 0x10
COOLING_FAN_RELAY_HIGH = 0x1A
COOLING_FAN_RELAY_LOW = 0x1B
IDLE_SPEED_ACTUATOR = 0x23
CVVT_VALVE = 0x24
ADAPTIVE_VALUES = 0x50