New targets to Binutils for H8 series

Shrinivas Atre
Mon Jan 6 07:00:00 GMT 2003


Could any one please comment on following or suggest any ideas ?


The H8 port of GNU identifies three targets.
1. H8/300	- ".h8300" in assembly file and linker script
2. H8/300H 	- ".h8300h" in assembly file and linker script
3. H8S	- ".h8300s" in assembly file and linker script

For H8S and H8/300H there is no provision to identify the mode of operation 
i.e. if the executable is for normal mode or advanced mode. 

Due to this we cannot run executables of Normal mode using the GDB/simulator. 
Same problem occurs when the normal mode executable is being debugged.

What I have tried ?
1. Providing the command line switch ( -n -S or -n -h ) while  running 
   the simulator.
2. Addition of one "set mode" command to select the operating mode in the GDB 
   while debugging the normal mode executable.


1. Using these switches for advanced mode executable and not using these 
   switches for normal mode executable *may* crash the GDB/Simulator. 
   This is because the GDB/Simulator will misinterpret the data based upon 
   these switches. And there is no way to ensure this from within executable.

2. When any program is compiled for normal mode with the default linker script 
   ( Default linker script uses 24 bit memory area) there will be code/code 
   references beyond 64K memory in the executable. Now the normal mode assumes 
   that the target has 64K memory and will crash if the memory access beyond 64K 
   is done. To solve this, the executable for normal mode must be created with 
   the linker script which uses 64K memory.

Permanent Solution:
1. I feel, we should add two new targets in the GCC and Binutils for H8S 
   and H8/300H normal mode. e.g. "h8300hn" and "h8300sn". 
   Existing ".h8300h" and ".h8300s" will denote advanced mode. 
   These targets will be automatically used when -mn switch is 
   used while compiling the file.

2. For these additional modes the default linker script will be with 
   64K memory region.

3. This will ensure that every executable will contain full target 
   information including the operating mode. 

This will need few changes in GCC and major changes in Binutils. 
Also corresponding changes in the GDB/Simulator will have to be made.

1. All existing executables (and libraries) compiled with -mn switch will 
   have to be rebuilt. The volume of such executables (or libraries ), 
   I feel, is less. This is because normal mode support just been added 
   to the H8 port of GNU.

Could any one tell me if there are any others issues involved in this ? 
What could be other possible alternative to achieve this ?
Has any one tried such things before ?


Free download of GNUSH and GNUH8 tool chains for Hitachi's SH and H8 Series.
The following site also offers free support to European customers.
Latest versions of GNUSH and GNUH8 are released on October 1, 2002.

More information about the Binutils mailing list