This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


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

Re: possible success with h8300 cross egcs


I'm not very familiar with h8 assembly so I don't have any commentary
information to give you, but here's the results of using my toolchain
on the same sample program you posted.  I ran the compiler once with -mh
and once wihout.  Looks like the -mh version generated the same code
as yours, but the debug session suggests that the program did the
correct thing.
Hope this is helpful to you, let me know if I can help out with any
other
comparisons or anything.

(BTW, have you experienced the trouble I'm having with the linker
crashing
when trying to include archive's in the link?)


//
//	compiled main to obj file main.o
//	and compiled with -mh to obj file mhmain.o
//
[randall@rsl h8test]$ h8300-hitachi-hms-gcc -c -g main.c -o main.o
[randall@rsl h8test]$ h8300-hitachi-hms-gcc -c -mh -g main.c -o mhmain.o



//
//	dumped result of main.o
//
[randall@rsl h8test]$ h8300-hitachi-hms-objdump --disassemble main.o

main.o:     file format coff-h8300

Disassembly of section .text:

00000000 <_main>:
   0:   6d f6           6d f6             mov.w r6,@-e7
   2:   0d 76           0d 76             mov.w r7,r6
   4:   6b 02 00 00     6b 02 00 00       mov.w @0x0:16,r2
   8:   6b 03 00 00     6b 03 00 00       mov.w @0x0:16,r3
   c:   6b 82 00 00     6b 82 00 00       mov.w r2,@0x0:16
  10:   6b 83 00 00     6b 83 00 00       mov.w r3,@0x0:16

00000014 <.L2>:
  14:   40 00           40 00             bra   .0 (16)
  16:   40 00           40 00             bra   .0 (18)

00000018 <.L4>:
  18:   40 00           40 00             bra   .0 (1a)

0000001a <.L1>:
  1a:   6d 76           6d 76             mov.w @r7+,r6
  1c:   54 70           54 70             rts

//
//	dumped result of mhmain.o
//
[randall@rsl h8test]$ h8300-hitachi-hms-objdump --disassemble mhmain.o

mhmain.o:     file format coff-h8300

Disassembly of section .text:

00000000 <_main>:
   0:   01 00 6d f6     01 00 6d f6       mov.l er6,@-er7
   4:   0f f6           0f f6             mov.l er7,er6
   6:   01 00 6b 02     01 00 6b 02 00 00 mov.l @0x0:16,er2
   a:   00 00 
   c:   01 00 6b a2     01 00 6b a2 00 00 00 00 mov.l   er2,@0x0:32
  10:   00 00 00 00 

00000014 <.L2>:
  14:   40 00           40 00             bra   .0 (16)
  16:   40 00           40 00             bra   .0 (18)

00000018 <.L4>:
  18:   40 00           40 00             bra   .0 (1a)

0000001a <.L1>:
  1a:   01 00 6d 76     01 00 6d 76       mov.l @er7+,er6
  1e:   54 70           54 70             rts

//
//	compile, link and debug a.out
//
[randall@rsl h8test]$ h8300-hitachi-hms-gcc -g main.c
[randall@rsl h8test]$ h8300-hitachi-hms-gdb
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "--host=i586-pc-linux-gnulibc1
--target=h8300-hitachi-hms".
(gdb) file a.out
Reading symbols from a.out...done.
(gdb) target sim
Connected to the simulator.
(gdb) load a.out
Loading section .text, size 0x1ce2 lma 0x100
Loading section .data, size 0x3ba lma 0x1de2
Loading section .stack, size 0x2 lma 0xfefc
Start address 0x120
Transfer rate: 66800 bits in <1 sec.
(gdb) list
1       float   f;
2
3       int     main()
4       {
5               f=1.23;
6               while(1);
7       }
8
(gdb) break 6
Breakpoint 1 at 0x158: file main.c, line 6.
(gdb) run
Starting program: /home/randall/job/h8test/a.out 

Breakpoint 1, main () at main.c:6
6               while(1);
(gdb) print f
$1 = 1.23000002
(gdb) 

//
//	compile with -mh, link and debug 
//
[randall@rsl h8test]$ h8300-hitachi-hms-gcc -mh -g main.c
[randall@rsl h8test]$ h8300-hitachi-hms-gdb
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "--host=i586-pc-linux-gnulibc1
--target=h8300-hitachi-hms".
(gdb) file a.out
Reading symbols from a.out...done.
(gdb) target sim
Connected to the simulator.
(gdb) load a.out
Loading section .text, size 0x1d78 lma 0x100
Loading section .data, size 0x6c8 lma 0x1e78
Loading section .stack, size 0x4 lma 0x3fffc
Start address 0x120
Transfer rate: 74272 bits in <1 sec.
(gdb) list
1       float   f;
2
3       int     main()
4       {
5               f=1.23;
6               while(1);
7       }
8
(gdb) break 6
Breakpoint 1 at 0x15e: file main.c, line 6.
(gdb) run
Starting program: /home/randall/job/h8test/a.out 

Breakpoint 1, main () at main.c:6
6               while(1);
(gdb) print f
$1 = 1.23000002
(gdb) 


--
|\/|
|/\| randall@elgar.com
|\/| rsl@zanshinsys.com http://www.zanshinsys.com
________________________________________________
To get help for the crossgcc list, send mail to
crossgcc-request@cygnus.com with the text 'help'
(without the quotes) in the body of the message.