手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

redboot on QEMU for mini2440

[日期:2011-09-04] 来源:csdn  作者:rickleaf [字体:大 中 小]

2. 让ecos增加对mini2440的支持

http://code.google.com/p/redboot-mini2440/ 这个project里面有全部的代码,不过可能用于各种原因并没有完善。

我们获得他的源代码基于ecos 3.0,然后我们根据smdk2410重新创建mini2440的hal 模块

  1. ricky@ricky-laptop:/opt/ecos/ecos-hg/packages/hal/arm/arm9$ ls  mini2440/current/  
  2. cdl  ChangeLog  include  misc  src  
  3. ricky@ricky-laptop:/opt/ecos/ecos-hg/packages/hal/arm/arm9$ ls  mini2440/current/src/  
  4. hal_diag.c  mini2440_misc.c  
  5. ricky@ricky-laptop:/opt/ecos/ecos-hg/packages/hal/arm/arm9$ ls  mini2440/current/cdl/  
  6. hal_arm_arm9_mini2440.cdl  
  7. ricky@ricky-laptop:/opt/ecos/ecos-hg/packages/hal/arm/arm9$ ls  mini2440/current/include/  
  8. hal_diag.h           hal_platform_setup.h  pkgconf   plf_stub.h  
  9. hal_platform_ints.h  memcfg.h              plf_io.h  s3c2440x.h  
  10. ricky@ricky-laptop:/opt/ecos/ecos-hg/packages/hal/arm/arm9$ ls  mini2440/current/misc/  
  11. mini2440_redboot_RAM.ecm  mini2440_redboot_ROMRAM.ecm  
  12. ricky@ricky-laptop:/opt/ecos/ecos-hg/packages/hal/arm/arm9$   

3. 针对QEMU的修改

为了能让redboot顺利的运行在qemu上面,我们需要让程序直接跑在sdram上面,但是需要对硬件做必要的初始化。

所以,目前的RAM,ROM,ROMRAM都不太合适,我们加入一个新的启动方式QEMU,相当于ROMRAM方式下面禁用mmu的跳转

  1. Revision: 3047  
  2. Branch: default  
  3. Author: Ricky Wu <rickleaf.wu@gmail.com>  2011-03-01 15:38:16  
  4. Committer: Ricky Wu <rickleaf.wu@gmail.com>  2011-03-01 15:38:16  
  5. Tags: tip  
  6. Parent: 3046:e7902e8a3e20 (1. remove QEMU start method. 2. add simple nand read funtion)  
  7.     mini2440 redboot can be run on qemu for mini2440  
  8. ----- packages/hal/arm/arm9/mini2440/current/cdl/hal_arm_arm9_mini2440.cdl -----  
  9. @@ -78,8 +78,8 @@  
  10.      cdl_component CYG_HAL_STARTUP {  
  11.          display       "Startup type"  
  12.          flavor        data  
  13. -        legal_values  { "RAM" "ROM" "ROMRAM" "NAND" }  
  14. -        default_value  { "NAND" }  
  15. +        legal_values  { "RAM" "ROM" "ROMRAM" "NAND" "QEMU" }  
  16. +        default_value  { "QEMU" }  
  17.          no_define  
  18.          define -file system.h CYG_HAL_STARTUP  
  19.          description   "  
  20. @@ -328,7 +328,8 @@  
  21.          no_define  
  22.          calculated { CYG_HAL_STARTUP == "RAM" ? "arm_arm9_mini2440_ram" : /  
  23.                       CYG_HAL_STARTUP == "ROM" ? "arm_arm9_mini2440_rom" : /  
  24. -                                                "arm_arm9_mini2440_romram" }  
  25. +                     CYG_HAL_STARTUP == "ROMRAM" ? "arm_arm9_mini2440_romram" : /  
  26. +                                                "arm_arm9_mini2440_qemu" }  
  27.    
  28.          cdl_option CYGHWR_MEMORY_LAYOUT_LDI {  
  29.              display "Memory layout linker script fragment"  
  30. @@ -337,7 +338,8 @@  
  31.              define -file system.h CYGHWR_MEMORY_LAYOUT_LDI  
  32.              calculated {CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_arm9_mini2440_ram.ldi>" :  /  
  33.                          CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_arm9_mini2440_rom.ldi>" : /  
  34. -                                                   "<pkgconf/mlt_arm_arm9_mini2440_romram.ldi>" }  
  35. +                        CYG_HAL_STARTUP == "ROMRAM" ? "<pkgconf/mlt_arm_arm9_mini2440_romram.ldi>" : /  
  36. +                                                   "<pkgconf/mlt_arm_arm9_mini2440_qemu.ldi>" }  
  37.          }  
  38.    
  39.          cdl_option CYGHWR_MEMORY_LAYOUT_H {  
  40. @@ -347,7 +349,8 @@  
  41.              define -file system.h CYGHWR_MEMORY_LAYOUT_H  
  42.              calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_arm9_mini2440_ram.h>" :  /  
  43.                           CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_arm9_mini2440_rom.h>" : /  
  44. -                                                    "<pkgconf/mlt_arm_arm9_mini2440_romram.h>" }  
  45. +                         CYG_HAL_STARTUP == "ROMRAM" ? "<pkgconf/mlt_arm_arm9_mini2440_romram.h>" : /  
  46. +                                                    "<pkgconf/mlt_arm_arm9_mini2440_qemu.h>" }  
  47.          }  
  48.      }  
  49.    
  50. @@ -356,7 +359,7 @@  
  51.          flavor        bool  
  52.          default_value 0  
  53.          parent        CYGPKG_HAL_ROM_MONITOR  
  54. -        requires      { (CYG_HAL_STARTUP == "ROM") || (CYG_HAL_STARTUP == "ROMRAM") }  
  55. +        requires      { (CYG_HAL_STARTUP == "ROM") || (CYG_HAL_STARTUP == "ROMRAM") || (CYG_HAL_STARTUP == "QEMU") }  
  56.          description   "  
  57.              Enable this option if this program is to be used as a ROM monitor,  
  58.              i.e. applications will be loaded into RAM on the board, and this  
  59. ----- packages/hal/arm/arm9/mini2440/current/include/hal_platform_setup.h -----  
  60. @@ -91,7 +91,7 @@  
  61.  #endif   
  62.    
  63.    
  64. -#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)  
  65. +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYG_HAL_STARTUP_QEMU)  
  66.  #define PLATFORM_SETUP1 _platform_setup1  
  67.  #define CYGHWR_HAL_ARM_HAS_MMU  
  68.  #define CYGSEM_HAL_ROM_RESET_USES_JUMP   
  69. @@ -160,7 +160,7 @@  
  70.    
  71.          // To reduce PLL lock time, adjust the LOCKTIME register.    
  72.          ldr    r0,=LOCKTIME  
  73. -        ldr    r1,=0xffffff  
  74. +        ldr    r1,=0xffffffff  
  75.          str    r1,[r0]  
  76.    
  77.          // We must set ratios, set memctl, then change FCLK.   
  78.  packages/hal/arm/arm9/mini2440/current/include/pkgconf/mlt_arm_arm9_mini2440_qemu.h   
  79. new file mode 100644  
  80. @@ -0,0 +1,20 @@  
  81. +// eCos memory layout - Fri Oct 20 05:43:59 2000   
  82. +  
  83. +// This is a generated file - do not edit   
  84. +  
  85. +#ifndef __ASSEMBLER__  
  86. +#include <cyg/infra/cyg_type.h>  
  87. +#include <stddef.h>  
  88. +  
  89. +#endif  
  90. +#define CYGMEM_REGION_ram (0)  
  91. +#define CYGMEM_REGION_ram_SIZE (0x4000000)  
  92. +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)  
  93. +#define CYGMEM_REGION_sram (0x40000000)  
  94. +#define CYGMEM_REGION_sram_SIZE (0x1000)  
  95. +#define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)  
  96. +#ifndef __ASSEMBLER__  
  97. +extern char CYG_LABEL_NAME (__heap1) [];  
  98. +#endif  
  99. +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))  
  100. +#define CYGMEM_SECTION_heap1_SIZE (0x4000000 - (size_t) CYG_LABEL_NAME (__heap1))  
  101.  packages/hal/arm/arm9/mini2440/current/include/pkgconf/mlt_arm_arm9_mini2440_qemu.ldi   
  102. new file mode 100644  
  103. @@ -0,0 +1,30 @@  
  104. +// eCos memory layout - Fri Oct 20 05:43:59 2000   
  105. +  
  106. +// This is a generated file - do not edit   
  107. +  
  108. +#include <cyg/infra/cyg_type.inc>  
  109. +  
  110. +MEMORY  
  111. +{  
  112. +    ram  : ORIGIN = 0, LENGTH = 0x4000000  
  113. +    sram : ORIGIN = 0x40000000, LENGTH = 0x1000  
  114. +}  
  115. +  
  116. +SECTIONS  
  117. +{  
  118. +    SECTIONS_BEGIN  
  119. +    SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA)  
  120. +    SECTION_rom_vectors (ram, 0x8000, LMA_EQ_VMA)  
  121. +    SECTION_RELOCS (ram, ALIGN (0x1), LMA_EQ_VMA)  
  122. +    SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA)  
  123. +    SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)  
  124. +    SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA)  
  125. +    SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA)  
  126. +    SECTION_got (ram, ALIGN (0x4), LMA_EQ_VMA)  
  127. +    SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)  
  128. +    SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA)  
  129. +    SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA)  
  130. +    SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)  
  131. +    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);  
  132. +    SECTIONS_END  
  133. +}  

4. 如何在QEMU中运行 

注意一下,需要用我们自己编译出来的qemu-system-arm

qemu-system-arm  -M mini2440 -m 128M -kernel install/bin/redboot.elf  -show-cursor -serial stdio

ricky@ricky-laptop:~/ecos/projects/mini2440-redboot$ 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 install/bin/redboot.elf at 0x30000000
S3C: CLK=240 HCLK=60 PCLK=30 UCLK=57
S3C: CLK=400 HCLK=100 PCLK=50 UCLK=57
+
RedBoot(tm) bootstrap and debug environment [QEMU]
Non-certified release, version UNKNOWN - built 15:39:35, Mar  1 2011
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
RedBoot is free software, covered by the eCos license, derived from the
GNU General Public License. You are welcome to change it and/or distribute
copies of it under certain conditions. Under the license terms, RedBoot's
source code and full license terms must have been made available to you.
Redboot comes with ABSOLUTELY NO WARRANTY.
Platform: MINI2440 system (ARM9) 
RAM: 0x00000000-0x04000000 [0x0001aab0-0x04000000 available]
RedBoot> help
Manage machine caches
   cache [ON | OFF]
Display/switch console channel
   channel [-1|<channel number>]
Compute a 32bit checksum [POSIX algorithm] for a range of memory
   cksum -b <location> -l <length>
Display (hex dump) a range of memory
   dump -b <location> [-l <length>] [-s] [-1|-2|-4]
Execute an image - with MMU off
   exec [-w timeout] [-b <load addr> [-l <length>]]
        [-r <ramdisk addr> [-s <ramdisk length>]]
        [-c "kernel command line"] [-t <target> ] [<entry_point>]
Execute code at a location
   go [-w <timeout>] [-c] [entry]
Help about help?
   help [<topic>]
Display command history
   history 
Load a file
   load [-r] [-v] [-m <varies>] [-c <channel_number>] 
        [-b <base_address>] <file_name>
Compare two blocks of memory
   mcmp -s <location> -d <location> -l <length> [-1|-2|-4]
Copy memory from one address to another
   mcopy -s <location> -d <location> -l <length> [-1|-2|-4]
Fill a block of memory with a pattern
   mfill -b <location> -l <length> -p <pattern> [-1|-2|-4]
Reset the system
   reset 
Display RedBoot version information
   version 
Display (hex dump) a range of memory
   x -b <location> [-l <length>] [-s] [-1|-2|-4]
RedBoot> 
linux
相关资讯       qemu  mini2440 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款