bootloader导读.第一阶段

来源:互联网 发布:淘宝买的的鲜人参 编辑:程序博客网 时间:2024/04/29 05:28

从nandflash copy到 ram中

    先看分区信息

             vivi 0x00000000-0x00020000  0-128K

             param 0x00020000-0x0002f000  64K

             kernel  0x00030000-0x001f0000  1M+960K

             root    0x00200000-0x04000000     到 64M

以上分区是nandflash上的分区, 非ram上,要注意区分.

 关于vivi  copy to myself

  要搞清楚具体从nandflash  哪个地址范围copy到ram的哪个地址范围

 分析我手上的代码

   nandflash是从0x00000000-0x00020000   128K  readout

   ram    VIVI_RAM_BASE=DRAM_BASE+DRAM_SIZE-VIVI_RAM_SIZE

                                      =0X00000000+64M-1M

 即, ram中是放在63M到64M这个区间.

   

   当然 ,之后设定堆栈指针的sp  就是64M-4 这个地址了.  堆栈向下生长.

 

内存和 nandflash映射表  供参考.  kernel大小跟上面提到的不同.

64MB RAM (DRAM)
0x3400 0000 +----------------------+
                  |VIVI RAM (size: 1M)    |
0x33F0 0000 +----------------------+ VIVI_RAM_BASE
                  |HEAP AREA(size: 1M)   |
0x33E0 0000 +----------------------+ HEAP_BASE
                  |MMU TABLE(size: 16k)  |
0x33DF C000 +----------------------+ MMU_TABLE_BASE
                  |                               |
           mtd partition table (size: 16k)| MTD_PART_SIZE -----/
0x33DF 8000 +----------------------+                               |
          vivi parameter table(size: 16k)| PARAMETER_TLB_SIZE  | vivi pri data
0x33DF 4000 |----------------------+                               |
         linux command line (size: 16k)  | LINUX_CMD_SIZE  -----/
                  |                               |
0x33DF 0000 +----------------------+ VIVI_PRIV_RAM_BASE
                  |                              |
                  |   free memory            |
                  |                              |
0x3010 8000 +----------------------+
                  |   kernel (size: 1MB)     |
0x3000 8000 +----------------------+
                  |                              |
                  |   free memory            |
                  |                              |
0x3000 0100 +----------------------+
           kernel param (size 256Byte)  |
0x3000 0000 +----------------------+ DRAM_BASE
64MB ROM (NAND Flash)
* 0x0400 0000 +-----------------------------+
*                   |                                         |
*                   | jffs2 (size: 61M)                   | user
*                   |                                         |
* 0x0030 0000 +-----------------------------+
*                   | root  (size: 2048k)                 |
* 0x0010 0000 +-----------------------------+
*                   | kernel (size: 832k)                |
* 0x0003 0000 +-----------------------------+
*                   | param (size: 64k)                   |
* 0x0002 0000 +-----------------------------+
*                   | vivi  (size: 128k)                  |
* 0x0000 0000 +-----------------------------+

 

 #define MMU_TABLE_BASE (HEAP_BASE - MMU_TABLE_SIZE)
#define HEAP_BASE (VIVI_RAM_BASE - HEAP_SIZE)
#define VIVI_RAM_BASE (DRAM_BASE + DRAM_SIZE - VIVI_RAM_SIZE)
#define DRAM_BASE DRAM_BASE0
#define DRAM_BASE0       0x30000000      /* base address of dram bank 0 */
#define DRAM_SIZE        SZ_64M
#define SZ_8M            0x00800000
#define VIVI_RAM_SIZE    SZ_1M
#define HEAP_SIZE        SZ_1M
#define SZ_1M            0x00100000
#define MMU_TABLE_SIZE   SZ_16K
#define SZ_16K           0x00004000static
unsigned long *mmu_tlb_base = (unsigned long *) MMU_TABLE_BASE;
putstr_hex("MMU table base address = 0x", (unsigned long)mmu_tlb_base);

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/qsycn/archive/2009/05/31/4228544.aspx

 

原创粉丝点击