Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Free SH7052F Simulator


Guru

Status: Offline
Posts: 963
Date:
Free SH7052F Simulator


I was talking to Don recently about how hard it is to read the disassembled RISC code in IDApro and said something in passing about what we really need is a Simulator.

A simulator in this context is a program that runs on your PC and pretends to be the target CPU. You can then load your software, in this case the code downloaded from the ECU and single step through it. As you step through it the simulator updates the what registers are holding what and changes to RAM or I/O memory space.

The problem with reading the code in IDA is its so convoluted. It loads a pointer to a variable. Then loads a register off that pointer. Then extends that register to another register, etc etc. By the time you get down to comparing some value to another you can't remember which is which and even if you could then you have to figure out the conditional branch which is setting true to 1 if the result is 0 and then branching if False. In effect what you are trying to do is the simulation in your head as you read the code.

With the simulator you just set the variables, step through the code, and read the results. You don't have to calculate which way the branches jump, it will show you.

I did a quick google search and I found that once more our very good friends at Renesas are there to save the day. They offer a free simulator as part of their Super H family c/c++ compiler package. (126MB)

[Evaluation Software] C/C++ Compiler Package for SuperH Family V.9.02 Release 00

You'll need to register to download it but that is free.


Now this is not a replacement for IDA. It does do disassembly but it is not interactive. You can't place labels, rename variables etc. But used with IDA I think it will really help in figuring out the code.

Here is a screenshot


__________________


Guru

Status: Offline
Posts: 963
Date:

Okay this is really cool...

ecu002.jpg


It has a user defined I/O panel. You just drag to draw a button, then label it for example clutch in. Then in the properties box you tell it to change the specific memory address and bit to the value that equals clutch in. So now as you step thru the code you can try it clutch in or clutch out, set a gear position, RPM etc.

The green box is an 'LED' you draw it then select what color it is when a given address is a given value. I set it to be green when clutch in and white when clutch out.

So with this I could set up a virtual bike and then change the configuration as I step thru the code.

__________________


Guru

Status: Offline
Posts: 2338
Date:

Excellent stuff - I hope this would have been known when we did the busa K2-K7... definately will use this with the next project (which is likely to start earliest late this year after driving season is over).



__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Guru

Status: Offline
Posts: 2338
Date:

Ive have had HEW installed all this time because of sh7086 experimental kit I have used for various purposes...

Now when having this issue with engine leaning at 11200 to test the limiters I tried with HEW but do get a memory access error - any hints on how to initialize the registers and stuff so that I can start testing subroutines ?


__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Guru

Status: Offline
Posts: 963
Date:

I figured the quickest way to resolve it was to send you a copy of my workspace via email. Let us know if it works and if you were able to figure out what the difference was.



__________________


Guru

Status: Offline
Posts: 2338
Date:

This is WAY cool discovery now when finally got it working !!!



__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Member

Status: Offline
Posts: 16
Date:

fwd me a copy of the workspace please? ...i can recompile but you're years ahead of me.

__________________


Guru

Status: Offline
Posts: 2338
Date:

No workspace needed - just correct settings when setting up a new project.



__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Veteran Member

Status: Offline
Posts: 74
Date:



-- Edited by ffaspector on Saturday 17th of October 2009 12:26:44 PM

__________________


Guru

Status: Offline
Posts: 2338
Date:

Create an empty application with this and choose simdebug as your tool and thats it.


__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Veteran Member

Status: Offline
Posts: 74
Date:



-- Edited by ffaspector on Saturday 17th of October 2009 12:27:37 PM

__________________


Veteran Member

Status: Offline
Posts: 74
Date:



-- Edited by ffaspector on Saturday 17th of October 2009 12:25:26 PM

__________________


Guru

Status: Offline
Posts: 963
Date:

damn, there goes my idea for the Atomic Busa ;)

Usually they just don't want you designing their products into any kind of life safety or medical equipment.

__________________


Veteran Member

Status: Offline
Posts: 80
Date:

I give up. I only want to do 2 things with this highperformance embedded workshop:

(a) Can anyone tell me how to load this with the dumped ECU machine code?

(b) I want to write some code in assy ... but I can't find any information on the syntax for directives ... i.e. I want the code to start execution from FFFF8800 (the start of the execution area for a downloaded programming control program) ... I tried using

.org H'FFFF8800

but I think maybe either this workshop doesn't support code compilation/assembly at such high addresses. :( or my guessing at the directive syntax is wrong ??

any clues?

Cheers,
Mark

__________________


Veteran Member

Status: Offline
Posts: 80
Date:

OK, found one answer: The mnemonics for execution instruction and assembly directives conform to the naming rules
laid out in the IEEE-694 specifications, and the system is uniform.

document REJ10J1571-0100 (SuperH RISC engine C/C++ Compiler, Assembler, Optimizing Linkage Editor) has it all ...Chapter 11.4 Assembler Directives



-- Edited by bozo at 14:52, 2008-12-14

__________________


Veteran Member

Status: Offline
Posts: 80
Date:

OK, got it assembling at FFFF8800 - here're the settings for future reference in case I (or anyone else) need it again:

HEW settings:

>build>build phases
build order
+ SH assembler
+ OptLinker

>build>build configurations
current configuration
+ SimDebug_SH-2

Source code:

.SECTION CD,CODE,LOCATE=H'FFFF8800
.ORG H'FFFF8800


__________________


Guru

Status: Offline
Posts: 963
Date:

Thanks for documenting your progress. I'm sure it will help others down the road.

__________________


Veteran Member

Status: Offline
Posts: 80
Date:

no sweat, another bonus tonight is that I managed to upload the ECU binary & disassemble it.

Again for reference,
> file > download module
& set format to binary

once downloaded, right click on it in the projects window and ensure debug settings for the file are correct (target=SH2 simulator, debug format = binary)

and go to disassembly view

cheers,

__________________


Member

Status: Offline
Posts: 7
Date:

guys im working with the new realease of this. can you give a little tururial? im learning c++ as we speak, but im not there yet..i need a little push lol

__________________


Guru

Status: Offline
Posts: 963
Date:

What version are you using and what did you need a tutorial on?

__________________


Veteran Member

Status: Offline
Posts: 40
Date:


I am just experimenting with the HEW, I have the BusaK5EU bin loaded, it disassembles ok. I open the GUI I/O view, try to setup a clutch button, use the memory address H'FFFF8228 set a value and when I try to click ok I get an error saying 'Memory Resource not allocated'.

The Simulator Memory Resource dialogue shows that memory resource is allocated from 00000000-0003FFFF and FFFF83D0-FFFF83DD.

I didn't enter these values, show I assume the are some sort of presets.

The 00000000-0003FFFF makes sense as that is the ROM size, but I can't find a reference in the 7052 manual for the other resource set.

The RAM addresses are FFFF8000-FFFFAFFF, should it be set to that?

Also does anyone have a set of initial values for the RAM, I am experimenting with the HEW with the busa stuff s there is more info available so I can check my work. I intend on working the busa shifter code into a GSXR 600 ecu code.

I love this stuff, and cant believe I have never come across this forum before... in two weeks I understand more about electronics and disassembly than I learnt in two years (not) going to university... still if I had spent more time reading processor manuals and less time in the pub it may have helped!

Any info or advice would be greatly appreciated.

__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard