Memory Management:
------------------

U-Boot runs in system state and uses physical addresses, i.e. the
MMU is not used either for address mapping nor for memory protection.

The available memory is mapped to fixed addresses using the memory
controller. In this process, a contiguous block is formed for each
memory type (Flash, SDRAM, SRAM), even when it consists of several
physical memory banks.

U-Boot is installed in the first 128 kB of the first Flash bank (on
TQM8xxL modules this is the range 0x40000000 ... 0x4001FFFF). After
booting and sizing and initializing DRAM, the code relocates itself
to the upper end of DRAM. Immediately below the U-Boot code some
memory is reserved for use by malloc() [see CONFIG_SYS_MALLOC_LEN
configuration setting]. Below that, a structure with global Board
Info data is placed, followed by the stack (growing downward).

Additionally, some exception handler code is copied to the low 8 kB
of DRAM (0x00000000 ... 0x00001FFF).

So a typical memory configuration with 16 MB of DRAM could look like
this:

0x0000 0000 Exception Vector code
:
0x0000 1FFF
0x0000 2000 Free for Application Use
:
:

:
:
0x00FB FF20 Monitor Stack (Growing downward)
0x00FB FFAC Board Info Data and permanent copy of global data
0x00FC 0000 Malloc Arena
:
0x00FD FFFF
0x00FE 0000 RAM Copy of Monitor Code
... eventually: LCD or video framebuffer
... eventually: pRAM (Protected RAM - unchanged by reset)
0x00FF FFFF [End of RAM]

System Initialization:
----------------------

In the reset configuration, U-Boot starts at the reset entry point
(on most PowerPC systems at address 0x00000100). Because of the reset
configuration for CS0# this is a mirror of the onboard Flash memory.
To be able to re-map memory U-Boot then jumps to its link address.
To be able to implement the initialization code in C, a (small!)
initial stack is set up in the internal Dual Ported RAM (in case CPUs
which provide such a feature like MPC8xx or MPC8260), or in a locked
part of the data cache. After that, U-Boot initializes the CPU core,
the caches and the SIU.

Next, all (potentially) available memory banks are mapped using a
preliminary mapping. For example, we put them on 512 MB boundaries
(multiples of 0x20000000: SDRAM on 0x00000000 and 0x20000000, Flash
on 0x40000000 and 0x60000000, SRAM on 0x80000000). Then UPM A is
programmed for SDRAM access. Using the temporary configuration, a
simple memory test is run that determines the size of the SDRAM
banks.

When there is more than one SDRAM bank, and the banks are of
different size, the largest is mapped first. For equal size, the first
bank (CS2#) is mapped first. The first mapping is always for address
0x00000000, with any additional banks following immediately to create
contiguous memory starting from 0.

Then, the monitor installs itself at the upper end of the SDRAM area
and allocates memory for use by malloc() and for the global Board
Info data; also, the exception vector code is copied to the low RAM
pages, and the final stack is set up.

Only after this relocation will you have a "normal" C environment;
until that you are restricted in several ways, mostly because you are
running from ROM, and because the code will have to be relocated to a
new address in RAM.

最新文章

  1. Web Fundamentsals学习1-Multiple-Screen-Site
  2. MySQL如何导出带日期格式的文件
  3. ueditor调用其中的附件上传功能
  4. 【转载】阎焱:90后创业是扯淡 大量O2O和P2P公司濒临倒闭
  5. SAP ALV显示并打印(非OO方式)
  6. cocos2d-x-3.0 的改变,由于变得太多,一点点累积吧!
  7. cocos2dx 2.x版本:简化提炼tolua++绑定自定义类到lua中使用
  8. Spring Data JPA教程,第一部分: Configuration(翻译)
  9. C# 类型的创建
  10. leetco Path Sum II
  11. “psql: could not connect to server: Connection refused” Error when connecting to remote database
  12. Azure Messaging-ServiceBus Messaging消息队列技术系列7-消息事务
  13. CI 图片上传路径问题的解决
  14. gcc编译C源文件
  15. python note 01 计算机基础与变量
  16. 【BZOJ5019】[SNOI2017]遗失的答案(FWT,动态规划)
  17. 物联网架构成长之路(23)-Docker练习之Elasticsearch服务搭建
  18. PDF文档的目录编辑与显示
  19. C# 子线程调用主线程窗体的解决方法
  20. mysql 根据一张表更新另一张表

热门文章

  1. POJ 1990 MooFest(zkw线段树)
  2. 【XStream】xml和java实体的相互转化
  3. jsonObject关于xml,json,bean之间的转换关系
  4. [置顶] kubernetes资源对象--limitranges
  5. web服务器、wsgi、应用
  6. vsftp 服务配置篇
  7. python gzip压缩
  8. java gc log
  9. Poj 4227 反正切函数的应用
  10. Node.js 使用angularjs取得Nodejs http服务端返回的JSON数组示例