[ELDK] Crosstool for MIPS exception in "run time"

Bemipefe bemipefe at libero.it
Fri Nov 30 22:35:33 CET 2007


Hi programmers!
My english is not the best (i'm italian) but i wish that you understand 
my words ;)

I have downloaded and installed the tool in the "mips-2007-01-21.iso"
It's is a good tool , the web don't provide tool with the same simplicity.

I have tried to compile in this manner:

mips-linux-gcc -EL -I../../src/include/testmachine -c hello.c
mips-linux-ld -O2 -EL -Ttext 0x80030000 -T 
$HOME/Programs/mipstools/mips_4KCle/usr/lib/ldscripts/elf32ltsmip.xbn -e 
f hello.o -o hello


The file hello.c is a testfile provided by gxemul package.
If i run the program with gxemul i get an exception:

<f>
800000e0: 3c1c0001      lui     gp,0x1
GXemul>
800000e4: 279c8060      addiu   gp,gp,-32672
GXemul>
800000e8: 0399e021      addu    gp,gp,t9
GXemul>
800000ec: 27bdffe0      addiu   sp,sp,-32
GXemul>
800000f0: afbf001c      sw      ra,28(sp)       [0xa0007efc]
GXemul>
800000f4: afbe0018      sw      fp,24(sp)       [0xa0007ef8]
GXemul>
800000f8: 03a0f021      move    fp,sp
GXemul>
800000fc: afbc0010      sw      gp,16(sp)       [0xa0007ef0]
GXemul>
80000100: 8f828018      lw      v0,-32744(gp)   [0x00000078]
[ exception TLBL vaddr=0x00000078 pc=0x80000100 <f+0x20> ]

I have also tried a simple "Hello World" but the result not differ.
The dump of program is this:

hello:     file format elf32-tradlittlemips

Disassembly of section .text:

80000000 <printchar>:
80000000:       27bdfff8        addiu   sp,sp,-8
80000004:       afbe0000        sw      s8,0(sp)
80000008:       03a0f021        move    s8,sp
8000000c:       00801021        move    v0,a0
80000010:       a3c20008        sb      v0,8(s8)
80000014:       3c031000        lui     v1,0x1000
80000018:       93c20008        lbu     v0,8(s8)
8000001c:       a0620000        sb      v0,0(v1)
80000020:       03c0e821        move    sp,s8
80000024:       8fbe0000        lw      s8,0(sp)
80000028:       27bd0008        addiu   sp,sp,8
8000002c:       03e00008        jr      ra
80000030:       00000000        nop

80000034 <halt>:
80000034:       27bdfff8        addiu   sp,sp,-8
80000038:       afbe0000        sw      s8,0(sp)
8000003c:       03a0f021        move    s8,sp
80000040:       3c021000        lui     v0,0x1000
80000044:       34420010        ori     v0,v0,0x10
80000048:       a0400000        sb      zero,0(v0)
8000004c:       03c0e821        move    sp,s8
80000050:       8fbe0000        lw      s8,0(sp)
80000054:       27bd0008        addiu   sp,sp,8
80000058:       03e00008        jr      ra
8000005c:       00000000        nop

80000060 <printstr>:
80000060:       3c1c0001        lui     gp,0x1
80000064:       279c80e0        addiu   gp,gp,-32544
80000068:       0399e021        addu    gp,gp,t9
8000006c:       27bdffe0        addiu   sp,sp,-32
80000070:       afbf001c        sw      ra,28(sp)
80000074:       afbe0018        sw      s8,24(sp)
80000078:       03a0f021        move    s8,sp
8000007c:       afbc0010        sw      gp,16(sp)
80000080:       afc40020        sw      a0,32(s8)
80000084:       1000000c        b       800000b8 <printstr+0x58>
80000088:       00000000        nop
8000008c:       8fc20020        lw      v0,32(s8)
80000090:       80420000        lb      v0,0(v0)
80000094:       00401821        move    v1,v0
80000098:       8fc20020        lw      v0,32(s8)
8000009c:       24420001        addiu   v0,v0,1
800000a0:       afc20020        sw      v0,32(s8)
800000a4:       00602021        move    a0,v1
800000a8:       8f998030        lw      t9,-32720(gp)
800000ac:       0320f809        jalr    t9
800000b0:       00000000        nop
800000b4:       8fdc0010        lw      gp,16(s8)
800000b8:       8fc20020        lw      v0,32(s8)
800000bc:       80420000        lb      v0,0(v0)
800000c0:       1440fff2        bnez    v0,8000008c <printstr+0x2c>
800000c4:       00000000        nop
800000c8:       03c0e821        move    sp,s8
800000cc:       8fbf001c        lw      ra,28(sp)
800000d0:       8fbe0018        lw      s8,24(sp)
800000d4:       27bd0020        addiu   sp,sp,32
800000d8:       03e00008        jr      ra
800000dc:       00000000        nop

800000e0 <f>:
800000e0:       3c1c0001        lui     gp,0x1
800000e4:       279c8060        addiu   gp,gp,-32672
800000e8:       0399e021        addu    gp,gp,t9
800000ec:       27bdffe0        addiu   sp,sp,-32
800000f0:       afbf001c        sw      ra,28(sp)
800000f4:       afbe0018        sw      s8,24(sp)
800000f8:       03a0f021        move    s8,sp
800000fc:       afbc0010        sw      gp,16(sp)
80000100:       8f828018        lw      v0,-32744(gp)
80000104:       24440140        addiu   a0,v0,320
80000108:       8f998034        lw      t9,-32716(gp)
8000010c:       0320f809        jalr    t9
80000110:       00000000        nop
80000114:       8fdc0010        lw      gp,16(s8)
80000118:       8f99802c        lw      t9,-32724(gp)
8000011c:       0320f809        jalr    t9
80000120:       00000000        nop
80000124:       8fdc0010        lw      gp,16(s8)
80000128:       03c0e821        move    sp,s8
8000012c:       8fbf001c        lw      ra,28(sp)
80000130:       8fbe0018        lw      s8,24(sp)
80000134:       27bd0020        addiu   sp,sp,32
80000138:       03e00008        jr      ra
8000013c:       00000000        nop

The other sections of the ELF are this:

Contents of section .reginfo:
 400094 1c0000f2 00000000 00000000 00000000  ................
 4000a4 00000000 40810080                    .... at ...
Contents of section .rodata:
 80000140 48656c6c 6f20776f 726c640a 00000000  Hello world.....
Contents of section .got:
 80000150 00000000 00000080 00000080 00000000  ................
 80000160 00000000 00000000 00000000 34000080  ............4...
 80000170 00000080 60000080                    ....`...
Contents of section .comment:
 0000 00474343 3a202847 4e552920 342e302e  .GCC: (GNU) 4.0.
 0010 30202844 454e5820 454c444b 20342e31  0 (DENX ELDK 4.1
 0020 20342e30 2e302900                     4.0.0).
Contents of section .pdr:
 0000 00000080 00000040 f8ffffff 00000000  ....... at ........
 0010 00000000 08000000 1e000000 1f000000  ................
 0020 34000080 00000040 f8ffffff 00000000  4...... at ........
 0030 00000000 08000000 1e000000 1f000000  ................
 0040 60000080 000000c0 fcffffff 00000000  `...............
 0050 00000000 20000000 1e000000 1f000000  .... ...........
 0060 e0000080 000000c0 fcffffff 00000000  ................
 0070 00000000 20000000 1e000000 1f000000  .... ...........






More information about the eldk mailing list