This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Commandline parameters in H8300


Hi All,

I was investigating how I could go about implementing 
commandline parameter support for H8300 Simulator. For 
that I was studying codes of various simulators, SH, 
ARM etc.

This seems to be the strategy used in ARM :

In Newlib (crt0.S):
1) It seems to be configurable, such that, if some 
compilation flag is given, then some code is generated.
2) The code calls a Sftware Interrupt SWI_GetEnv which 
is handled in the simulator.

In the simulator:
1) This gets the commandline and saves it in a variable 
state->CommandLine.
2) It also saves the commandline to an address f00L.

In Newlib
3) Then in crt0.S, the runtime stack seems to be filled 
up with argv, and argc is in Register 0 and pointer of 
argv in Register 1.
4)Then main is called.

Am I interpreting it correctly.

If I were to use a similar strategy for H8300, where do I 
store the commandline, in ARM, it seems the addresses 
0x0000-0x8000 are workspace, hence free, so 0xf00L seems 
to be a good location as it won't be disturbed, in H8300, 
there is an eight bit area, could that be used?

How do I make it configurable, that is, this code is added 
only if I compile it with some option, which points that a 
simulator will be used (that seems to eb the strategy used 
in ARM). I wouldn't want to change the default behaviour so 
that nothing else is affected.

Concerns:
1) H8300 does not have a trap instruction, and hence, I will 
have to jump to some magic memory location, say 0xc4. I have 
used a similar strategy for File I/O implementation.

http://sources.redhat.com/ml/gdb-patches/2003-01/msg00054.html

2) If I use the eight bit memory present, then I will exhaust 
it as I would keep the maximum size of commandline as 255. So, 
that memory may be unavailable for any other uses. As the 
location of this memory may be dependent on the linker script, 
any change in the linker script may result in a change here.

Any suggestions, ideas would be appreciated.

Thanks and Best Regards,

Venky


> -----Original Message-----
> From: D.Venkatasubramanian, Noida
> Sent: Monday, January 06, 2003 5:14 PM
> To: 'Kazu Hirata'; gdb@sources.redhat.com
> Subject: Commandline parameters in H8300
> 
> 
> Hi All,
> 
> Though the H8300 is a microcontroller, is it possible 
> that support for commandline parameters can be implemented 
> for the H8300 Simulator.
> 
> If yes, where should I start? Does it require some change 
> in the code generation part of GCC, or the change would be 
> wholly confined to GDB. Any pointers to this would be 
> useful.
> 
> Changing code generation may not be appropriate, but if the 
> change is wholly confined to the H8300 Simulator part only, 
> then it could be a useful complement, to my already submitted 
> (uncommited) patch for File I/O implementation on the sim:
> 
> http://sources.redhat.com/ml/gdb-patches/2003-01/msg00054.html
> 
> File I/O with command line parameter passing would be extremely 
> useful for testing purposes, although practically useless on the 
> physical target.
> 
> Thanks and Best Regards,
> 
> Venky
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]