RTEMS 的 MINI2440 QEMU 移植之bsp_libc_init与 rtems_libio_init

发布时间:2024-06-27  

这段时间疯子一样的做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

GNU gdb 6.8

Copyright (C) 2008 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later

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) 

执行结果


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

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 ***


文章来源于:电子工程世界    原文链接
本站所有转载文章系出于传递更多信息之目的,且明确注明来源,不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。

我们与500+贴片厂合作,完美满足客户的定制需求。为品牌提供定制化的推广方案、专属产品特色页,多渠道推广,SEM/SEO精准营销以及与公众号的联合推广...详细>>

利用葫芦芯平台的卓越技术服务和新产品推广能力,原厂代理能轻松打入消费物联网(IOT)、信息与通信(ICT)、汽车及新能源汽车、工业自动化及工业物联网、装备及功率电子...详细>>

充分利用其强大的电子元器件采购流量,创新性地为这些物料提供了一个全新的窗口。我们的高效数字营销技术,不仅可以助你轻松识别与连接到需求方,更能够极大地提高“闲置物料”的处理能力,通过葫芦芯平台...详细>>

我们的目标很明确:构建一个全方位的半导体产业生态系统。成为一家全球领先的半导体互联网生态公司。目前,我们已成功打造了智能汽车、智能家居、大健康医疗、机器人和材料等五大生态领域。更为重要的是...详细>>

我们深知加工与定制类服务商的价值和重要性,因此,我们倾力为您提供最顶尖的营销资源。在我们的平台上,您可以直接接触到100万的研发工程师和采购工程师,以及10万的活跃客户群体...详细>>

凭借我们强大的专业流量和尖端的互联网数字营销技术,我们承诺为原厂提供免费的产品资料推广服务。无论是最新的资讯、技术动态还是创新产品,都可以通过我们的平台迅速传达给目标客户...详细>>

我们不止于将线索转化为潜在客户。葫芦芯平台致力于形成业务闭环,从引流、宣传到最终销售,全程跟进,确保每一个potential lead都得到妥善处理,从而大幅提高转化率。不仅如此...详细>>