Pages: [1] 2 3
Author Topic: Bosch ME7 IDA Plugin  (Read 64903 times)
Tony@NefMoto
Administrator
Hero Member
*****

Karma: +132/-4
Offline Offline

Posts: 1389


2001.5 Audi S4 Stage 3


« on: September 03, 2009, 11:25:20 AM »

Bosch ME7 IDA Plugin

This was written by Andy Whittaker to help with initial disassembly setup when dealing with the ME7.
« Last Edit: June 22, 2010, 05:25:47 PM by Tony@NefMoto » Logged

Remember you have to log in if you want to see the file attachments!
Info or questions, please add to the wiki: http://www.nefariousmotorsports.com/wiki
Follow NefMoto developments on Twitter: http://twitter.com/nefmoto
robin
Full Member
***

Karma: +20/-1
Offline Offline

Posts: 139


« Reply #1 on: December 21, 2009, 05:47:37 PM »

I get this error when IDA tries to load the plugin:


LoadLibrary(C:\Program Files\IDA Free\plugins\boschme7x.plw) => error code 127
C:\Program Files\IDA Free\plugins\boschme7x.plw: can't load file

Any clues?
Logged
Tony@NefMoto
Administrator
Hero Member
*****

Karma: +132/-4
Offline Offline

Posts: 1389


2001.5 Audi S4 Stage 3


« Reply #2 on: December 26, 2009, 01:28:03 PM »

Could be a version mismatch between the plugin and IDA.
Logged

Remember you have to log in if you want to see the file attachments!
Info or questions, please add to the wiki: http://www.nefariousmotorsports.com/wiki
Follow NefMoto developments on Twitter: http://twitter.com/nefmoto
20VT
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 3


« Reply #3 on: March 22, 2010, 03:15:46 PM »

Is this plugin specific for ME7.1 control unit ?
Logged
ArgDub
Full Member
***

Karma: +60/-1
Offline Offline

Posts: 202


« Reply #4 on: March 24, 2010, 04:04:34 AM »

Is this plugin specific for ME7.1 control unit ?

It's for M7.1 and M7.5, the guy who wrote the plugin also made a video tutorial with the basics to use it

http://www.andywhittaker.com/ECU/DisassemblingaBoschME755/tabid/96/language/en-GB/Default.aspx
Logged
phila_dot
Hero Member
*****

Karma: +173/-11
Offline Offline

Posts: 1709


« Reply #5 on: September 07, 2010, 12:14:25 AM »

Can anyone explain how to get from video one to video two? How do you seperate the bin? Is this required prior to running the plugin?
« Last Edit: September 07, 2010, 12:21:29 AM by phila_dot » Logged
lulu2003
Full Member
***

Karma: +11/-1
Offline Offline

Posts: 242



« Reply #6 on: September 07, 2010, 08:29:32 AM »

BTW: what happened to Andy? Long time he did not update his website! Is he already being hired by CMD etc. and had to sign a NDA? Wink
Logged
Tony@NefMoto
Administrator
Hero Member
*****

Karma: +132/-4
Offline Offline

Posts: 1389


2001.5 Audi S4 Stage 3


« Reply #7 on: September 07, 2010, 11:27:22 AM »

You use a hex editor to separate the file into two parts according to Andy.

I disagree with Andy on this, and I think he is completely wrong. In my opinion the entire flash memory image is mapped to address 0x800000, and you don't split it at all. I don't think he sets up the DPP registers correctly, and he never maps in the internal ROM on the processor.

If you ask me, you should load the entire flash memory image to address 0x800000 and set DPP0 to 0x204, DPP1 to 0x205, DPP2 to 0x0E0, and DPP3 to 0x003. Then RAM is located at 0x380000, with size 0x8000.

Andy has always been hard to get a hold of, and I am not sure if he still works on ME7 projects.
Logged

Remember you have to log in if you want to see the file attachments!
Info or questions, please add to the wiki: http://www.nefariousmotorsports.com/wiki
Follow NefMoto developments on Twitter: http://twitter.com/nefmoto
spen
Full Member
***

Karma: +43/-0
Offline Offline

Posts: 112


« Reply #8 on: September 21, 2010, 03:54:46 PM »

Hello all - here goes my first post. As a quick intro I have been into reverse engineering uC firmwares for a few years, usually with a plan to add new functions rather than alter some data.  My daily drive is stage 3 S4, d box.

Returning to the topic at hand Wink I agree with the DPP settings noted above.

Andy's plugin is unfinished, and there are only a few functions labelled.  Some are correct, many are not.  In particular Andy started calling various routines LookupA, through LookupZ and beyond.  Then he tried to isolate what each Lookup did, here was a mistake.

ME7x uses the Lookup routines by data structure, not by motronic function.  Ie there is a Lookup which reads 8byte signed integers, with independent external axes.  It is not LookupIgnition for example as Andy hints.  

I have reversed his plugin  Smiley  It is a dead end, fortunately it only took a few minutes to figure out what it was doing and how it was doing it.


All in all, the excitement of the old plugin should fade quickly.  

Now, where you load the binary.  It is interesting as motronic is broken in to three areas by design. The ERCOS real time OS, a library area, and a user code area.  What people upload on to the internet is usually the library and user area, starting at 0x800000 code , 0x810000 data and 0x820000 code.  ERCOS resides much lower.

When you load ERCOS into the CPU internal rom you can see all those calls suchas calls 0, 754e etc line up perfectly.  ERCOS *seems* byte compatible across the family.  You can also see how the interrupts are routed through a gateway, some are handled by ERCOS, some are passed to routines in higher memory.


I have been trying to automate some of the donkey work with the reverse engineering.  I have created some code which creates output like



With it if you give me an address of some ME7 data and a binary, I can more than likely locate it in another binary if it exists.

Spen    
« Last Edit: September 21, 2010, 04:30:23 PM by spen » Logged
Tony@NefMoto
Administrator
Hero Member
*****

Karma: +132/-4
Offline Offline

Posts: 1389


2001.5 Audi S4 Stage 3


« Reply #9 on: September 21, 2010, 06:34:55 PM »

Welcome to the forum, glad you found us. I will confirm for other people reading that everything you posted is correct.

Glad to see you are working on ME7 tools. How are you detecting the relocated tables between different ME7 versions? Are you using function signatures, or data signatures?
Logged

Remember you have to log in if you want to see the file attachments!
Info or questions, please add to the wiki: http://www.nefariousmotorsports.com/wiki
Follow NefMoto developments on Twitter: http://twitter.com/nefmoto
spen
Full Member
***

Karma: +43/-0
Offline Offline

Posts: 112


« Reply #10 on: September 22, 2010, 08:12:20 AM »

The code seeks the entry point to any address I specify, as there are finite ways ME7 does that. Once I have that I can build a fingerprint for the function which I can locate in other ME7 roms.

Once my program finds the fingerprint it locates the register which is loaded with the target address and converts it to an absolute address.  The program counter, the DPR, the page offset and data absolute address are then thrown in to a data grid.  The code also notes if there are any bytes of axes in front of the data, as some structures contain internal axes.

To be honest how I handle the axes needs to change, it's not accurate enough.

Once I have that data grid I can export to csv, text, ida idc script and I am 90% through to xdf.  On the agenda are damos, maybe mappack.

In short I want to be able to regenerate a damos for any ME7 binary automatically.  I'm not looking at pure rom addresses, I really want to understand the structures in ram also.



Logged
Asassini
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


« Reply #11 on: September 23, 2010, 04:24:26 PM »

Great work Spen, Wink
Logged
robin
Full Member
***

Karma: +20/-1
Offline Offline

Posts: 139


« Reply #12 on: October 14, 2010, 02:37:55 PM »

Wow, great work.
Logged
360trev
Full Member
***

Karma: +68/-2
Offline Offline

Posts: 235


« Reply #13 on: January 08, 2011, 02:31:38 PM »

Hi all,
My first post on here. I'm very interested in doing some more work on advanced automated IDA plugin work on the ME7 firmware. Basically walking through and automatically rename all signatures for common functions found and then comment all the trouble codes, etc.

Did Andy ever release his C++ IDA plugin source-code? If not is there any ongoing projects by anyone to re-do this work properly and in more depth?

Are there any well comment ida IDB files to help me with this? I'm willing to re-write the Andy Whittaker plug-in to make it work on any ME7 fw.

My interest is reverse engineering the 512kbyte ME7 firmware for a Ferrari 360 (all variants, 360, CS, Spider). I want to be able to add new functions to the firmware and fully understand what is going on in both the Bosch Montronic ME7.1 ecu's (2 ecu's, 1 per bank). I have full access to all the wiring schematics and can post the relevant ecu pin-outs.

I have managed to get the pair of working ECU's to dump and now need to create a bench flashing lead using a wiring harness and ob2 to first dump the firmware using the bootmode technique.

Q. Has anyone on here's has already dumped these models before?

Will the NefMoto flashing s/w likely work on this model? I'm guessing yes...

 
Logged
360trev
Full Member
***

Karma: +68/-2
Offline Offline

Posts: 235


« Reply #14 on: January 08, 2011, 02:34:14 PM »

The code seeks the entry point to any address I specify, as there are finite ways ME7 does that. Once I have that I can build a fingerprint for the function which I can locate in other ME7 roms.

Once my program finds the fingerprint it locates the register which is loaded with the target address and converts it to an absolute address.  The program counter, the DPR, the page offset and data absolute address are then thrown in to a data grid.  The code also notes if there are any bytes of axes in front of the data, as some structures contain internal axes.

To be honest how I handle the axes needs to change, it's not accurate enough.

Once I have that data grid I can export to csv, text, ida idc script and I am 90% through to xdf.  On the agenda are damos, maybe mappack.

In short I want to be able to regenerate a damos for any ME7 binary automatically.  I'm not looking at pure rom addresses, I really want to understand the structures in ram also.





Have you posted these apps up yet? or are they private?

i'm planning to release all my work on here.
Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

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