RomRaider Logo

RomRaider

Open Source ECU Tools
 FAQ •  Register •  Login 

RomRaider

Documentation

Community

Developers

It is currently Sat Feb 21, 2026 4:02 pm

All times are UTC




Post new topic Reply to topic  [ 189 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13  Next
Author Message
 Post subject: Re: Hacking with HEW
PostPosted: Sun Nov 10, 2013 6:19 pm 
Offline
Moderator

Joined: Thu Nov 23, 2006 2:23 am
Posts: 2565
The last thing I do before flashing my changes is open a patched ROM in the HEW debugger, and start debugging from a couple instructions prior to where it jumps into my code. Then step through my code and confirm that it returns to the original code and keeps executing. I do this for each place where I've hooked into the original code.

If that works, I flash my ECU and hope for the best. :) I haven't bricked an ECU yet.

_________________
2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG
Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Sun Nov 10, 2013 9:06 pm 
Offline
RomRaider Donator

Joined: Thu Dec 29, 2011 2:04 am
Posts: 181
Thanks for the idea,

I did that, works great for the WGDC hook, I can't however verify the initializer function fully with that approach. I see the code calling my function which then call the system function but that one never returns (same problem with the un patched rom I tried). It barfs at some point where it tries to read some pointer from a memory address and jump to it. (My interpretation could be wrong).

Image

There is no code at the 0x5AA5A... address

Hummm


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Sun Nov 10, 2013 11:14 pm 
Offline
RomRaider Donator

Joined: Thu Dec 29, 2011 2:04 am
Posts: 181
Ok, looks like R15 is the HW stack pointer. Once I initialize it with something proper the code seem to be happier, it still doesn't return but it blocks on an IO test I think.


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Sun Nov 10, 2013 11:19 pm 
Offline
RomRaider Donator

Joined: Thu Dec 29, 2011 2:04 am
Posts: 181
Ok cool,

Got it to fully execute and return by tricking the IO test. Looks like my patch is working okay ! I'll flash in on a night where I don't have to bring my daughter to school the next day ...

Pretty excited


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Mon Nov 11, 2013 3:22 am 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
No problem at all with making things easier while you learn, I completely understand :) The lack of good docs and ready-to-open HEW files doesn't make things easy..

I recall having some issues with simulating the initializer when I added it, and I believe I had to change the location of the resethandler linker section. I'll confirm this the next time I fire up my windows machine.

After making any big changes to the codebase or adding a new rom, I also follow NSFW's procedure and step through each hook manually. Also, I clear the output window before that and check for any errors that may not throw an exception or stop the simulator.

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Sat Nov 23, 2013 7:08 pm 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
I've committed a set of ready-to-open HEW files to the repo, and updated the readme for basic docs. Basic Sharptune patching API docs are up also.

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Mon Dec 02, 2013 12:08 am 
Offline
RomRaider Donator

Joined: Thu Dec 29, 2011 2:04 am
Posts: 181
Hi Merp,

Cool, I will take a look. So I finally got it to work tonight ! My initial try didn't work because I forgot to replace the call to the OEM cel ram variable in my patch metadata file. Did it tonight and inserted some triggers based on defogger and cruise control and I can get it to work flawlessly.

Thanks to you guys for all the documentation and code. I wouldn't have had enough knowledge to start this for scratch but this provided me enough beta to walk through the process, learn how to debug etc.

It's hugely satisfying !

Quick question, in the metadata file that gives the patcher its instruction. I had to use hard coded addresses because I didn't know how to make the tool accept the pointers to the C variable.
Code:
ReplaceOemCel:
      .long   Replace4Bytes
      .long   0x00090D2C           !! address
      .long   0xFFFFA412       !! old value
      .long   0xFFFFB004           !! new value


Anyway I can do this ?

Code:
ReplaceOemCel:
                 ...
      .long   &pRamVariables->CelSignal           !! new value


Thanks


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Mon Dec 02, 2013 5:06 am 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
whitewater wrote:
So I finally got it to work tonight ! My initial try didn't work because I forgot to replace the call to the OEM cel ram variable in my patch metadata file. Did it tonight and inserted some triggers based on defogger and cruise control and I can get it to work flawlessly.

Thanks to you guys for all the documentation and code. I wouldn't have had enough knowledge to start this for scratch but this provided me enough beta to walk through the process, learn how to debug etc.

It's hugely satisfying !


Most definitely, congrats! :mrgreen:

Quote:
Quick question, in the metadata file that gives the patcher its instruction. I had to use hard coded addresses because I didn't know how to make the tool accept the pointers to the C variable.
Code:
ReplaceOemCel:
      .long   Replace4Bytes
      .long   0x00090D2C           !! address
      .long   0xFFFFA412       !! old value
      .long   0xFFFFB004           !! new value


Anyway I can do this ?

Code:
ReplaceOemCel:
                 ...
      .long   &pRamVariables->CelSignal           !! new value


Thanks


It's been some time since I used ASM to do the metadata, I migrated it over to C because there was some hard limitation that I could not find a workaround for. I think this was it.

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Mon Dec 02, 2013 8:17 am 
Offline
Moderator

Joined: Thu Nov 23, 2006 2:23 am
Posts: 2565
Merp wrote:
It's been some time since I used ASM to do the metadata, I migrated it over to C because there was some hard limitation that I could not find a workaround for. I think this was it.


I don't see a way to do the pointer-to-structure-member thing in ASM, either.

Metadata in C sounds like a great idea.

_________________
2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG
Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Mon Dec 02, 2013 12:45 pm 
Offline
RomRaider Donator

Joined: Thu Dec 29, 2011 2:04 am
Posts: 181
Ok thanks guys, I'll move this over to sharp tune then. I'll check your doc and see if I can figure it out


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Fri Jan 17, 2014 10:50 am 
Offline
Experienced

Joined: Sun Oct 16, 2011 7:57 am
Posts: 150
Hi guys,

Spent some time looking at HEW the last couple of days... I want to see if I can get any further with the flex-fuel patch. My ROM - AZ1G900C, I see has some patches defined in the Merpmod repository, but not everything is there.

I was hoping to start by just mucking around with some of the already built patches and simulating them, to try and learn by "doing"... I see there is already some map switching stuff, but it doesn't appear to be available for my ROM...

Any ideas on how to actually update the header file for my ROM so that I can compile some of the Flash and Switch patches ?

Short of working backwards from another ROM that has a more complete header file... ?


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Sun Jan 19, 2014 6:07 pm 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
I have some code in SharpTune that can convert the .h file to a IDC script. From there you can do more analysis and export a .map file which is converted to .h by SharpTune during MerpMod building.

Use a rom with existing defines as a template is a good idea, or poke around the forums, or ask here. I recommend looking at A8DH202X. It is my testing platform and has the most stuff defined. Just keep in mind there have been many changes to the structures since 2006.

Also, I pushed some updates to both MerpMod and SharpTune a couple weeks ago. There were some issues getting it to build/open after cloning the repo, but it should work much better now!

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Tue Mar 25, 2014 11:34 am 
Offline
RomRaider Donator

Joined: Thu Dec 29, 2011 2:04 am
Posts: 181
Hi guys,

I have been working a bit more with this. Right now I am reverse engineering how the ECU uses the knock correction additive tables. I have a quick usage question for hew, has anyone been able to use ram location in the variable watch ? I tried changing the scope to global, putting an address, de-referencing the address as a pointer. It always "Not available Now".

It would be handy to have all the variable I am interested in in one pane instead of having to browse through the memory view

Thanks for the help


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Thu Jun 09, 2016 9:24 pm 
Offline
Newbie

Joined: Thu Sep 12, 2013 5:33 pm
Posts: 3
I'm trying to get Renesas development tools (old HEW) for a SH2E ECU (SH7058)
in my 2006 WRX Impreza. Does anyone know which target OS one needs to pick.

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Hacking with HEW
PostPosted: Fri Jun 10, 2016 1:28 pm 
Offline
RomRaider Developer

Joined: Thu May 21, 2009 1:49 am
Posts: 7323
Location: Canada eh!
It's defined in the first post of this thread.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 189 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13  Next

All times are UTC


Who is online

Users browsing this forum: DarkMIKE and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subsilver by phpBBservice.nl