Ce uses *. bib to decide (reloade ?) Memory layout.
Generally, the project contains two images: Bootloader and OS. Therefore, the project contains boot. bib and config. bib.
The content of bib is described below:
Oemaddresstable
This table is declared in the Code and used to be placed in the invalid region Register address of MMU.
Therefore, the content of this table is virtual-physical address. format:
The Code addresses in virtual, physical, and sizece are all virtual addresses. This table is used to parse the table to the actual address.
Config. bib
Use the following sections to control the use of memory
Ramimage-all the kernel and conpoment will be placed in this region. (Probably code, const region ?)
The ram-kernel will use this part of the region as the ram space required by the application or the kernel itself (data, stack ?)
The reserved-kernel does not use this region. Programmer can use hard-coded to access the region address.
Autosize-this is an option. When you set on, the builder combines ramimage and ram into a region.
Eboot. bib (boot. bib)
Similar to config. bib, but note that if our bootloader does not initiate MMU, the memory range in this part is Phyical address, not virtual address.
Bringing it together
Generally, Bootloader and OS use the same oemaddresstable. Therefore, their virtual addresses are the same, it can be used as an empty space between the Bootloader and the OS, or as a buffer for DMA.
In fact, the addresses not declared in bib will not be used to place component (Code, const ?) And allocate (data, stack ?). Therefore, the purpose of the reserved section is like a comment, which is used to mark the region used in our coding.
Example
The following oemaddresstable is declared in common \ Startup. ASM of XX platform:
_ Oemaddresstable:
Dd 80000000 H, 0, 04000000h that is to say, virtual address 0x80000000 will apply to the location of the actual 0x00000000, and the mapping size is 64 MB.
The following section is available in eboot \ Boot. bib ..
Memory
; Name start Size Type
;-----------------------------------
Eboot 00130000 00020000 ramimage
Ram 00150000 00070000 Ram
Ethdma 00200000 00020000 Reserved
. This platform bootloader does not initiate MMU, so the preceding definition uses physical address.
If we apply it to the virtual address, it will be a zone of. 0x80130000-0x80220000.
The code + const region of bootloader is 0x80130000-0x80150000.
Next let's take a look at the config. bib of the OS:
Memory
; Name start Size Type
;-----------------------------
NK 80220000 009e0000 ramimage
Ram 80c00000 00c40000 Ram
DMA 80100000 00030000 Reserved
Bootargs 801fff00 00000100 Reserved
Edbg_dma 80200000 00020000 Reserved
? "Let" Drop the bootloader region (0x80130000-0x80150000 ).
Please refer to one region and repeat the use zones of the Two bibs .. you can see ::
The last region is NK and NK Ram. In this way, ensure that the kernel's work zone starts from 0x80220000 and does not parse the previous bootloader code/data.
One region is repeated in config. bib and boot. bib: ethdma and edbgdma. In this case, when the bootloader moves to the OS, the changes can still be used by the OS.
One thing to be careful about is: 0x80100000-0x80130000. Fortunately, before bootloader, if there is more kernel, the bootloader code will be overwritten. In this case, there is no way for the kernel to jump back to the bootloader to restore the line during warm reset.