RTEMS 的 MINI2440 QEMU 移植之bsp_libc_init与 rtems_libio_init

来源:互联网 发布:安卓虚拟机软件 编辑:程序博客网 时间:2024/06/09 22:22

这段时间疯子一样的做RTEMS的移植,一直未果,遇到如下问题。

1.  bsp_libc_init 问题,执行之前

 gdb 调试信息

ricky@ricky-laptop:~/rtems/rtems-4.9.5/examples-4.9.5/hello_world_c$arm-rtems4.9-gdb o-optimize/hello.exe

GNUgdb 6.8

Copyright(C) 2008 Free Software Foundation, Inc.

LicenseGPLv3+: GNU GPL version 3 or later<http://gnu.org/licenses/gpl.html>

Thisis free software: you are free to change and redistribute it.

Thereis NO WARRANTY, to the extent permitted by law. Type "showcopying"

and"show warranty" for details.

ThisGDB was configured as "--host=x86_64-unknown-linux-gnu--target=arm-rtems4.9"...

(gdb)target remote :1234

Remotedebugging using :1234

[NewThread 1]

0x30000000in arm_reset_vect ()

(gdb)load

Loadingsection .text, size 0xe1d0 lma 0x30000100

Loadingsection .init, size 0x20 lma 0x3000e2d0

Loadingsection .jcr, size 0x4 lma 0x3000e2f0

Loadingsection .fini, size 0x1c lma 0x3000e2f4

Loadingsection .rodata, size 0xb08 lma 0x3000e310

Loadingsection .ctors, size 0x8 lma 0x3000ee18

Loadingsection .dtors, size 0x8 lma 0x3000ee20

Loadingsection .eh_frame, size 0x4 lma 0x3000ee28

Loadingsection .data, size 0xb18 lma 0x3000ee2c

Startaddress 0x30000100, load size 63556

Transferrate: 12413 KB/sec, 1629 bytes/write.

(gdb)b bsp_libc_init

Breakpoint1 at 0x30001104: file/home/ricky/rtems/rtems-4.9.5/rtems-4.9/c/src/lib/libbsp/arm/mini2440/../../shared/bsplibc.c,line 20.

(gdb)c

Continuing.

Breakpoint1, bsp_libc_init (heap_start=0x3001bfa0, heap_size=66994272,sbrk_amount=0) at/home/ricky/rtems/rtems-4.9.5/rtems-4.9/c/src/lib/libbsp/arm/mini2440/../../shared/bsplibc.c:20

20 RTEMS_Malloc_Initialize( heap_start, heap_size, sbrk_amount );

(gdb) 

执行结果

ricky@ricky-laptop:~/rtems/rtems-4.9.5/examples-4.9.5/hello_world_c$ sh qemu.sh 

S3C: CLK=240 HCLK=240 PCLK=240 UCLK=57

QEMU: ee24c08_init

DM9000: INIT QEMU MAC : 52:54:00:12:34:56

QEMU mini2440_reset: loaded kernel o-optimize/hello.exe at 0x30000000

S3C: CLK=240 HCLK=60 PCLK=30 UCLK=57

S3C: CLK=400 HCLK=100 PCLK=50 UCLK=57

2.  bsp_libc_init 问题,执行之后

gdb 调试信息
ricky@ricky-laptop:~/rtems/rtems-4.9.5/examples-4.9.5/hello_world_c$ arm-rtems4.9-gdb o-optimize/hello.exe 
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-rtems4.9"...
(gdb) target remote :1234
Remote debugging using :1234
[New Thread 1]
0x30000000 in arm_reset_vect ()
(gdb) load
Loading section .text, size 0xe1d0 lma 0x30000100
Loading section .init, size 0x20 lma 0x3000e2d0
Loading section .jcr, size 0x4 lma 0x3000e2f0
Loading section .fini, size 0x1c lma 0x3000e2f4
Loading section .rodata, size 0xb08 lma 0x3000e310
Loading section .ctors, size 0x8 lma 0x3000ee18
Loading section .dtors, size 0x8 lma 0x3000ee20
Loading section .eh_frame, size 0x4 lma 0x3000ee28
Loading section .data, size 0xb18 lma 0x3000ee2c
Start address 0x30000100, load size 63556
Transfer rate: 12413 KB/sec, 1629 bytes/write.
(gdb) b bsp_libc_init
Breakpoint 1 at 0x30001104: file /home/ricky/rtems/rtems-4.9.5/rtems-4.9/c/src/lib/libbsp/arm/mini2440/../../shared/bsplibc.c, line 20.
(gdb) c
Continuing.
Breakpoint 1, bsp_libc_init (heap_start=0x3001bfa0, heap_size=66994272, sbrk_amount=0) at /home/ricky/rtems/rtems-4.9.5/rtems-4.9/c/src/lib/libbsp/arm/mini2440/../../shared/bsplibc.c:20
20    RTEMS_Malloc_Initialize( heap_start, heap_size, sbrk_amount );
(gdb) n
执行结果

ricky@ricky-laptop:~/rtems/rtems-4.9.5/examples-4.9.5/hello_world_c$ sh qemu.sh 
S3C: CLK=240 HCLK=240 PCLK=240 UCLK=57
QEMU: ee24c08_init
DM9000: INIT QEMU MAC : 52:54:00:12:34:56
QEMU mini2440_reset: loaded kernel o-optimize/hello.exe at 0x30000000
S3C: CLK=240 HCLK=60 PCLK=30 UCLK=57
S3C: CLK=400 HCLK=100 PCLK=50 UCLK=57
INSN_LDR
data_abort at address 0x30001544, instruction: 0x1593F000,   spsr = 0x200001D3
active thread thread 0x09010001
Previous sp=0x30013384 lr=0x30001548 and actual cpsr=600001D7
 0xEAFFFFFE 0xEAFFFFFE 0xEAFFFFFE 0x30001108 0x30000428 0x3000022C
 0xC3000001 0x42000000 0x725F5053 0x736D6574 0x7172695F 0x676E6D5F
 0x6E695F74 0x00007469 0x3E000000 0x02000000 0x019B6A00 0x00017F00
 0x00011C00 0x65747200 0x695F736D 0x6D5F7172 0x5F74676E 0x74696E69
 0x00015E00 0x66656400 0x746C7561 0x746E695F 0x6E61685F 0x72656C64
 0x00000000 0x00002000 0x91000200 0x1D00019E 0xC8000001 0x62000000
 0x6C5F7073 0x5F636269 0x74696E69 0x00000000 0x00002F00 0xAE000200
 0xF400019F 0xBB000000 0x6C000000 0x68636269 0x735F7069 0x61697265

 

 

3. 只有simple_main是可以用的,说明了什么呢。


 

有做了些测试,发现 disable itron以后,可以用simple_main, 能说明什么问题呢?

 

ricky@ricky-laptop:~/rtems/rtems-4.9.5/examples-4.9.5/simple_main$ sh qemu.sh 

S3C: CLK=240 HCLK=240 PCLK=240 UCLK=57

QEMU: ee24c08_init

DM9000: INIT QEMU MAC : 52:54:00:12:34:56

QEMU mini2440_reset: loaded kernel o-optimize/simple_main.exe at 0x30000000

S3C: CLK=240 HCLK=60 PCLK=30 UCLK=57

S3C: CLK=400 HCLK=100 PCLK=50 UCLK=57

 

 

*** HELLO WORLD TEST ***

Hello World

*** END OF HELLO WORLD TEST ***