u-boot README--Memory Management&initialize

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.

时间: 2024-08-07 16:59:05

u-boot README--Memory Management&initialize的相关文章

Fixed Partition Memory Management UVALive - 2238 建图很巧妙 km算法左右顶点个数不等模板以及需要注意的问题 求最小权匹配

/** 题目: Fixed Partition Memory Management UVALive - 2238 链接:https://vjudge.net/problem/UVALive-2238 题意:lv 思路:lrjP352. 来自lrj训练指南. n个程序作为左边结点, n*m个结点在右边:由于只要求n个程序在右边能找到的匹配点,km算法可以求解.修改nx,ny的值. if(f[i][j]==-1){ for(int k = 1; k <= n; k++) love[i][j*n+k-

Objective -C Memory Management 内存管理 第一部分

Objective -C Memory Management??内存管理??第一部分 Memory management is part of a more general problem in programming called resource management. 内存管理是资源管理的一部分. Every computer system has finite resources for your program to use. These include memory, open fi

Android Memory Management, OutOfMemoryError

A Android框架强制每个进程的24 MB内存限制.在一些旧的设备,如在G1,限制为16 MB 更低,更重要的是,由位图使用的内存限制.处理图像的应用程序,它是很容易达到此限制,并获得与OOM 异常死亡 的过程:E / dalvikvm堆(12517):1048576字节外部分配这个 过程中过大的E / GraphicsJNI(12517): VM将不会让我们分配1048576字节 / AndroidRuntime(12517):关闭VM / dalvikvm(12517):主题ID = 1

2015.12.21 内存管理(memory management)

Memory Management 1.什么是内存管理? 程序在运行过程中管理内存分配的过程,当需要内存的时候就申请一片内存空间,不需要就释放掉. 2.如何去管理内存 站在分配对象拥有权的角度来操作内存. 3.内存管理的两种办法 a. MRR(Manual Retain Release)手动管理,实现的机制:reference counting(引用计数机制). b. ARC(Auto Reference Counting)自动引用计数,实现机制:系统在程序编译阶段自动添加了释放对象的办法. 4

《modern operating system》 chapter 3 MEMORY MANAGEMENT 笔记

MEMORY MANAGEMENT The part of the operating system that manages (part of) the memory hierarchy is called thememory manager 这章感觉有点多...80 多页..看完都看了两天多,做笔记就更有点不想...有点懒了..但是要坚持下去,可以自己较劲 对于内存的抽象,最简单的抽象就是...没有抽象 和第一次看不一样,把summary放在最前面,对整个mamory management的

Objective-C Memory Management Being Exceptional 异常处理与内存

Objective-C Memory Management ? ?Being Exceptional ?异常处理与内存 3.1Cocoa requires that all exceptions must be of type NSException cocoa?需要所有的异常是NSException类型的. so even though you can throw an exception from other objects, Cocoa isn't set up to deal with

Summary of Memory Management Methods

Summary of Memory Management Methods Table 18-1 summarizes the various memory management methods. If you do not enable automatic memory management, then you must separately configure one memory management method for the SGA and one for the PGA. Note:

Automatic Tuning of Memory Management

4.2.2 Automatic Tuning of Memory Management Two memory management initialization parameters, MEMORY_TARGET and MEMORY_MAX_TARGET, enable automatic management of the System Global Area (SGA), Program Global Area (PGA), and other memory required to run

Objective-C Memory Management 内存管理 2

Objective-C Memory Management?内存管理? 2? 2.1 The Rules of Cocoa Memory Management 内存管理规则 (1)When you create an object using new, alloc, or copy, the object has aretain count of 1. You are responsible for sending the object a release or autorelease mess