zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    CSS Friendly Control Adapters CSSFriendly.dll
    2008秋季计算机软件基础未交实验报告名单
    About NeatHtml™ Brettle.Web.NeatHtml.dll
    What is DotNetOpenMail DotNetOpenMail.dll
    What is the simplest way to distribute a .NET COM server to any platform?
    页面压缩 Enabling Gzip and Deflate HTTP Compression in ASP.NET pages(转)
    [算法分析]计数排序
    [置顶] EJDesktop开源项目
    继承初体验
    [置顶] 基于stm32f103zet6之UC/OS_II的学习1(初步移植OS点灯大法)
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/5858725.html
Copyright © 2011-2022 走看看