Simon Glass | 67aadc1 | 2024-09-26 14:28:51 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | |
| 3 | Memory Management |
| 4 | ----------------- |
| 5 | |
| 6 | .. note:: |
| 7 | |
| 8 | This information is outdated and needs to be updated. |
| 9 | |
| 10 | U-Boot runs in system state and uses physical addresses, i.e. the |
| 11 | MMU is not used either for address mapping nor for memory protection. |
| 12 | |
| 13 | The available memory is mapped to fixed addresses using the |
| 14 | memory-controller. In this process, a contiguous block is formed for each |
| 15 | memory type (Flash, SDRAM, SRAM), even when it consists of several |
| 16 | physical-memory banks. |
| 17 | |
| 18 | U-Boot is installed in XIP flash memory, or may be loaded into a lower region of |
| 19 | RAM by a secondary program loader (SPL). After |
| 20 | booting and sizing and initialising DRAM, the code relocates itself |
| 21 | to the upper end of DRAM. Immediately below the U-Boot code some |
| 22 | memory is reserved for use by malloc() [see CONFIG_SYS_MALLOC_LEN |
| 23 | configuration setting]. Below that, a structure with global Board-Info |
| 24 | data is placed, followed by the stack (growing downward). |
| 25 | |
| 26 | Additionally, some exception handler code may be copied to the low 8 kB |
| 27 | of DRAM (0x00000000 ... 0x00001fff). |
| 28 | |
| 29 | So a typical memory configuration with 16 MB of DRAM could look like |
| 30 | this:: |
| 31 | |
| 32 | 0x0000 0000 Exception Vector code |
| 33 | : |
| 34 | 0x0000 1fff |
| 35 | 0x0000 2000 Free for Application Use |
| 36 | : |
| 37 | : |
| 38 | |
| 39 | : |
| 40 | : |
| 41 | 0x00fb ff20 Monitor Stack (Growing downward) |
| 42 | 0x00fb ffac Board Info Data and permanent copy of global data |
| 43 | 0x00fc 0000 Malloc Arena |
| 44 | : |
| 45 | 0x00fd ffff |
| 46 | 0x00fe 0000 RAM Copy of Monitor Code |
| 47 | ... eventually: LCD or video framebuffer |
| 48 | ... eventually: pRAM (Protected RAM - unchanged by reset) |
| 49 | 0x00ff ffff [End of RAM] |