Hello
I'd like to share a python script I wrote to convert a damos (A2L) to fit a new dump.
I wrote it in python to allow everybody to improve it. (and check there is no worm in it)
You can imagine that the damos need to be as close as possible of the new dump.
I mean same hardware but different software is ok but it's not applicable with different hardware.
The script use a valid damos/dump couple in entry and a new dump to produce a new damos file.
Supported ecus: ME7.5, MED91, EDC16U34, MED17 and SID208.
The format of the dumps can be Intel Hex, Motorola S19 or Binary.
The size must be 1024kb, 1504kb, 2048kb or 4096kb.
It's possible to add support to new ecus by adding a new ecu definition in the script.
For that the script contains a supportedeculist variable which hold ecu definition dictionaries.
Ex:
# MED17 - 0x80045320
"ecu" : "MED17",
"cpu" : "TriCore",
"addresslen" : 10,
"addressstart" : '0x80',
"addressformat": '0x80%06X\n'
Meanings:
# "ecu" : Ecu string found in A2L MOD_PAR entry (Ex: ECU "MED17")
# "cpu" : Cpu type string found in A2L MOD_PAR entry (Ex: CPU_TYPE "TriCore")
# "addresslen" : Length of address string in A2L CHARACTERISTIC records (Ex: 0x800574D8 -> 10)
# "addressstart" : Sub string to remove to obtain an hex address where data can be found in dump file (Ex: 0x800574D8 -> '0x80')
# "addressformat": Format use to rebuild an address line where 6 is the len of hex address without addressstart (Ex: 0x800574D8 -> '0x80%06X\n')
The script will ask for an ecu and cpu type if there is no MOD_PAR entry in the A2L.
Here is how the script process:
- Read the damos file and create an address table
- Read the original dump
- Read the new dump
- Correct the address table by searching best match pattern from original dump in new dump using dycothomic search method from original address
- Linearize the address table
- Create a new damos using the address table
And here the command line to execute it:
python correct-damos-address.py DamosFile.A2L OriginalDump NewDump
It take less than 10 minutes to correct most damos on my computer.
There may be some mistakes due to linearization but it work pretty well in most case.
Feel free to test it and report if it fit your needs.
Edit:Update script to version 1.1.
# ChangeLog : v1.0 - Original release
# - Add MED17 Ecus support
# - Add Intel Hex dump support
Edit2:Update script to version 1.2.
# ChangeLog : v1.2 - Add ME7.5 Ecus support
Edit3:# ChangeLog : v1.3 - Add MED9.1 Ecus support
# - Add EDC16U34 Ecus support
# - Add Motorola S19 dump support
# - Add supported ecu list to allow adding ecu type (See "Supported Ecu List")
Edit4:# ChangeLog : v1.4 - Rewrite Intel Hex and Motorola S19 support to handle address bases
# - Add SID208 Ecus support
Best regards
Polo
Hello mate.
I have modified the script to be able to make corrections in Ford's ME 9.0 ECU. in case you want to update the first post. I upload said script. greetings!!!