Reputation: 2942
I want to perform some operation(load a small firmware) while i am in u-boot.
Does someone know how much DRAM does u-boot occupy in the beginning and end of DRAM,
so that i can load my firmware in the unoccupied area of DRAM which is not occupied by u-boot?
Upvotes: 2
Views: 6072
Reputation: 17077
U-Boot is configurable, so the answer depends on your specific build. The commands and features configured into U-Boot will determine its actual size. Typically U-Boot is built to reside/execute in the upper portion of main memory, and the remainder of low memory is available for whatever.
In your board's config file, the definition for CONFIG_SYS_TEXT_BASE
sets the start address of U-Boot. (Older versions of U-Boot had a different method of specifying this start address symbol.)
Examine the generated System.map
file (in the same directory as the u-boot.bin
executable) for the addresses that the linker has assigned to each entry point.
In your board's config file, there's also something like:
#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_CS6
#define CONFIG_SYS_SDRAM_SIZE 0x08000000
to define the physical address range of main memory.
U-Boot will start its stack at the end of SDRAM, or BASE+SIZE.
So the region between CONFIG_SYS_TEXT_BASE
+(size of u-boot.bin) and the end of SDRAM is the available stack area.
U-Boot will also use memory below CONFIG_SYS_TEXT_BASE
for its malloc()
pool. The size of that region is defined by CONFIG_SYS_MALLOC_LEN
.
So the memory between CONFIG_SYS_SDRAM_BASE
and
CONFIG_SYS_TEXT_BASE
-CONFIG_SYS_MALLOC_LEN
should be available.
ADDENDUM
The above comments apply to a U-Boot that is loaded and executed in main memory (i.e. DRAM).
Some systems execute U-Boot out of ROM or NOR Flash, and then U-Boot will relocate itself to RAM. Some (old?) documentation is here.
Upvotes: 4