Pages: 1 [2]
Author Topic: Damos address corrector (Python script)  (Read 26200 times)
Bitshifter
Full Member
***

Karma: +10/-7
Offline Offline

Posts: 94


« Reply #15 on: April 06, 2019, 01:34:36 AM »

copy/paste what you tried to do at the command line.

That was not the Problem. The Problem are missing "" Wink

@ Polo35580

Great tool. Tested with 3 versions (MED9) and all looks fine, save a lot of time.

Thank you for engineering, release and update. I vote: hero member  Smiley
Logged
IamwhoIam
Hero Member
*****

Karma: +43/-99
Offline Offline

Posts: 1030


« Reply #16 on: April 06, 2019, 04:56:35 AM »

If only it worked as decently with continental as it does with Bosch stuff... there's definitely LOADS of room for improvement there, just searching for byte strings isn't enough to make it a proper "corrector"... I've tested it on 2 similar Bosch MED17 files, in one of them LAMFA doesn't exist anymore, in the original one it exists. Guess what? the corrector found LAMFA in my file that doesn't have it Cheesy
Logged

I have no logs because I have a boost gauge (makes things easier)
Gilgamesh
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


« Reply #17 on: June 02, 2019, 04:10:56 AM »


Feel free to test it and report if it fit your needs.   Cheesy


Hello Polo! Very good idea and solution. Thanks a lot for your work!
I've test it and it's working good, but sometimes there is strange errors:

Quote

Address 0x04A170 not corrected in 16384 search !!! No matching pattern !!!
Correcting address 0x04A172
Address 0x04A172 not corrected in 16384 search !!! No matching pattern !!!
Correcting address 0x04A174
Bestmatch for address: 0x04A174, searchaddress: 0x04B7D2, offset: 165E, matchbefore: 0, matchafter: 20
Address 0x04A174 not corrected in 16384 search !!! Keeped Best match: 0x04B7D2 - Offset 165E matchbefore: 0 matchafter: 20 !!!
Correcting address 0x04A176
Bestmatch for address: 0x04A176, searchaddress: 0x04B7D4, offset: 165E, matchbefore: 4, matchafter: 16
Address 0x04A176 not corrected in 16384 search !!! Keeped Best match: 0x04B7D4 - Offset 165E matchbefore: 4 matchafter: 16 !!!
Correcting address 0x04A178
Bestmatch for address: 0x04A178, searchaddress: 0x04B7D6, offset: 165E, matchbefore: 8, matchafter: 12
Address 0x04A178 not corrected in 16384 search !!! Keeped Best match: 0x04B7D6 - Offset 165E matchbefore: 8 matchafter: 12 !!!
Correcting address 0x04A17A
Bestmatch for address: 0x04A17A, searchaddress: 0x04B7D8, offset: 165E, matchbefore: 12, matchafter: 8
Address 0x04A17A not corrected in 16384 search !!! Keeped Best match: 0x04B7D8 - Offset 165E matchbefore: 12 matchafter: 8 !!!
Correcting address 0x04A17C
Address 0x04A17C not corrected in 16384 search !!! No matching pattern !!!
Correcting address 0x04A180
Bestmatch for address: 0x04A180, searchaddress: 0x04B7DC, offset: 165C, matchbefore: 2, matchafter: 16
Bestmatch for address: 0x04A180, searchaddress: 0x04A224, offset: A4, matchbefore: 4, matchafter: 8
Bestmatch for address: 0x04A180, searchaddress: 0x049D34, offset: -44C, matchbefore: 2, matchafter: 8
Address 0x04A180 not corrected in 16384 search !!! Rejected Best match: 0x04B7DC - Offset 165C matchbefore: 2 matchafter: 16 !!!
Correcting address 0x04A184
Bestmatch for address: 0x04A184, searchaddress: 0x04B7E0, offset: 165C, matchbefore: 10, matchafter: 8

Address corrected from 0x04A170 to 0x04B7CE - 36% - 105420/286002 - offset 165E 
Address corrected from 0x04A171 to 0x04B7CF - 36% - 105421/286002 - offset 165E     
Address corrected from 0x04A172 to 0x04B7D0 - 36% - 105422/286002 - offset 165E     
Address corrected from 0x04A173 to 0x04B7D1 - 36% - 105423/286002 - offset 165E     
Address corrected from 0x04A174 to 0x04B7D2 - 36% - 105424/286002 - offset 165E     
Address corrected from 0x04A175 to 0x04B7D3 - 36% - 105425/286002 - offset 165E     
Address corrected from 0x04A176 to 0x04B7D4 - 36% - 105426/286002 - offset 165E     
Address corrected from 0x04A177 to 0x04B7D5 - 36% - 105427/286002 - offset 165E     
Address corrected from 0x04A178 to 0x04B7D6 - 36% - 105428/286002 - offset 165E     
Address corrected from 0x04A179 to 0x04B7D7 - 36% - 105429/286002 - offset 165E     
Address corrected from 0x04A17A to 0x04B7D8 - 36% - 105430/286002 - offset 165E     
Address corrected from 0x04A17B to 0x04B7D7 - 36% - 105431/286002 - offset 165C     
Address corrected from 0x04A17C to 0x04B7D8 - 36% - 105432/286002 - offset 165C     
Address corrected from 0x04A17D to 0x04B7D9 - 36% - 105433/286002 - offset 165C     
Address corrected from 0x04A17E to 0x04B7DA - 36% - 105434/286002 - offset 165C
Address corrected from 0x04A17F to 0x04B7DB - 36% - 105435/286002 - offset 165C     
Address corrected from 0x04A180 to 0x04B7DC - 36% - 105436/286002 - offset 165C     
Address corrected from 0x04A181 to 0x04B7DD - 36% - 105437/286002 - offset 165C     

Logged

Passat 1.4tsi Ecofuel Petrol/CNG 150hp Med17.1
Polo35580
Newbie
*

Karma: +9/-0
Offline Offline

Posts: 12


« Reply #18 on: July 15, 2019, 02:59:13 AM »

If only it worked as decently with continental as it does with Bosch stuff... there's definitely LOADS of room for improvement there, just searching for byte strings isn't enough to make it a proper "corrector"... I've tested it on 2 similar Bosch MED17 files, in one of them LAMFA doesn't exist anymore, in the original one it exists. Guess what? the corrector found LAMFA in my file that doesn't have it Cheesy
Hello
I can take a look to Simos support if you provide me some hex + damos couples  Smiley

Yes there is lot of things to improve as reorder the whole code with class and functions or rewrote the address linearization part which cause your LAMFA and Gilgamesh issues or add MEASUREMENT correction support ...
It's a hard work for each improvement and I don't have enough time for now...
Feel free to give help on any part

Best regards

Polo
« Last Edit: July 15, 2019, 06:26:19 AM by Polo35580 » Logged
nabsabs
Newbie
*

Karma: +0/-1
Offline Offline

Posts: 3


« Reply #19 on: October 16, 2019, 02:40:47 AM »

Hello
I am trying this for the first time on an MED9.1 file
I am getting the following errors and it is not being executed

c:\Users\nabih\Desktop\Test>python correct-damos-address.py DamosFile.A2L OriginalDump NewDump
  File "correct-damos-address.py", line 734
    print (('Address 0x%06X skipped because of unreconizable pattern - %d%% - %d/%d              ' % (damosaddress, (100/len(damosaddresslist)*damosaddresscount), damosaddressco
unt, len(damosaddresslist))), end="\r")

                                 ^
SyntaxError: invalid syntax


Image attached below



Can anyone help
Logged
pukacinio
Newbie
*

Karma: +0/-6
Offline Offline

Posts: 17


« Reply #20 on: January 17, 2021, 08:53:18 AM »

Hello
I am trying this for the first time on an MED9.1 file
I am getting the following errors and it is not being executed

c:\Users\nabih\Desktop\Test>python correct-damos-address.py DamosFile.A2L OriginalDump NewDump
  File "correct-damos-address.py", line 734
    print (('Address 0x%06X skipped because of unreconizable pattern - %d%% - %d/%d              ' % (damosaddress, (100/len(damosaddresslist)*damosaddresscount), damosaddressco
unt, len(damosaddresslist))), end="\r")

                                 ^
SyntaxError: invalid syntax


Image attached below



Can anyone help

Installing a newer version of python solved this problem for me.  Wink


Polo35580 it works for me, you're my hero  Grin
« Last Edit: January 17, 2021, 10:54:10 AM by pukacinio » Logged
gt-innovation
Sr. Member
****

Karma: +60/-89
Offline Offline

Posts: 442


« Reply #21 on: February 25, 2021, 09:24:54 AM »

There is a bug for binaries that are loading the module table in a different offset in ram.That means the reference point will be shifted so the parsing of the a2l will not match the actual binary file.

for example in Med17.1.62 you will need 0x809 instead of 0x803.

For those who do not know how to edit the code a quick workaround will be to replace all 0x809 occurrences with 0x803 and then feed the a2l to the script.
Remember to change back the offset in the generated a2l before usage in ols.

Other editors with direct address reference will work just fine without changing the offset.

Great work polo35580.

Logged
nyet
Administrator
Hero Member
*****

Karma: +604/-166
Online Online

Posts: 12232


WWW
« Reply #22 on: March 01, 2021, 01:12:39 AM »

for example in Med17.1.62 you will need 0x809 instead of 0x803.

For those who do not know how to edit the code a quick workaround will be to replace all 0x809 occurrences with 0x803 and then feed the a2l to the script.

If only there was a way for multiple people to work on a common set of source code
Logged

ME7.1 tuning guide (READ FIRST)
ECUx Plot
ME7Sum checksum checker/corrrector for ME7.x

Please do not ask me for tunes. I'm here to help people make their own.

Do not PM me technical questions! Please, ask all questions on the forums! Doing so will ensure the next person with the same issue gets the opportunity to learn from your experience.
OzzydaveO
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


« Reply #23 on: July 02, 2021, 06:09:23 PM »

Installing a newer version of python solved this problem for me.  Wink


Polo35580 it works for me, you're my hero  Grin


Perhaps a check to make sure the running version of python is ver 3.x  (preferably 3.7 or later)


Some thing like this:

import sys
if sys.version_info < (3, 7):
    print('Please upgrade your Python version to 3.7.0 or higher')
    sys.exit()




Logged
kirukisu
Jr. Member
**

Karma: +1/-3
Offline Offline

Posts: 25


« Reply #24 on: December 10, 2021, 05:46:18 PM »

What size should have .hex file? It doesnt like any of my ME7.5 .hex & .a2l pair . Will .dam be supported?

Code:
PS C:\Users\lukas\Desktop\test> python correct-damos-address-v1.4.py a24c203g.a2l a24c203g.hex NewDump.bin
Correcting Damos file: a24c203g.a2l
Output file: NewDump.A2L
Original Dump file: a24c203g.hex
New Dump file: NewDump.bin
Parsing the Damos file ...
Found S80166 Cpu type
Found ME7.5 Ecu type
Found 4760 address to correct
Done in 0.2122 seconds
Reading original dump of 2464kb in Intel hex format
Error !!! Original dump file of unsupported size !!! 18874368 0x1200000
PS C:\Users\lukas\Desktop\test>
Logged
xmifeng6
Newbie
*

Karma: +0/-2
Offline Offline

Posts: 4



« Reply #25 on: March 19, 2022, 06:47:58 PM »

NICE WORK bro ! thanks for share !
Logged
Fang
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


« Reply #26 on: February 09, 2024, 01:45:38 PM »

I wonder where is the script? Sorry I found them .  Grin
« Last Edit: February 09, 2024, 01:48:13 PM by Fang » Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.052 seconds with 18 queries. (Pretty URLs adds 0.001s, 0q)