ARM可以设置开机启动方式,从Nor 或nand flash启动。如果从Nor flash启动,一般是上电后运行地址0处的代码。如果是nand flash ,flash接口会自动把nand flash最前面一小部分代码搬移到RAM中,然后运行。
Nor flash接在ARM 总线的0地址处,Nand flash 有专用的nand接口。
1. 内核启动地址ZTEXTADDR
解压代码运行的开始地址。没有物理地址和虚拟地址之分,因为此时MMU处于关闭状态。这个地址不一定时RAM的地址,可以是支持读写寻址的flash等存储中介。
Start address of decompressor. here's no point in talking about virtual or physical addresses here, since the MMU will be off at the time when you call the decompressor code. You normally call the kernel at this address to start it booting. This doesn't have to be located in RAM, it can be in flash or other read-only or read-write addressable medium.
在arch/arm/boot/compressed/Makefile中说的很明确
#
# We now have a PIC decompressor implementation. Decompressors running
# from RAM should not define ZTEXTADDR. Decompressors running directly
# from ROM or Flash must define ZTEXTADDR (preferably via the config)
# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
ifeq ($(CONFIG_ZBOOT_ROM),y)
ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT)
ZBSSADDR:= $(CONFIG_ZBOOT_ROM_BSS)
else
ZTEXTADDR := 0
ZBSSADDR:= ALIGN(8)
endif
ZRELADDR
内核启动在RAM中的地址。压缩的内核映像被解压到这个地址,然后执行。
This is the address where the decompressed kernel will be written, and eventually executed. The following constraint must be valid:
__virt_to_phys(TEXTADDR) == ZRELADDR
The initial part of the kernel is carefully coded to be position independent.
一般定义在项目目录下,比如:
arch/arm/mach-at91/Makefile.boot: zreladdr-y += 0x70008000
arch/arm/mach-at91/Makefile.boot: zreladdr-y += 0x20008000
arch/arm/mach-cns3xxx/Makefile.boot: zreladdr-y += 0x00008000
arch/arm/mach-davinci/Makefile.boot: zreladdr-y += 0xc0008000
arch/arm/mach-davinci/Makefile.boot: zreladdr-y += 0x80008000
arch/arm/mach-dove/Makefile.boot: zreladdr-y += 0x00008000
arch/arm/mach-ebsa110/Makefile.boot: zreladdr-y += 0x00008000
arch/arm/mach-exynos/Makefile.boot: zreladdr-y += 0x40008000
arch/arm/mach-footbridge/Makefile.boot: zreladdr-y += 0x00008000
arch/arm/mach-gemini/Makefile.boot: zreladdr-y += 0x00008000
arch/arm/mach-gemini/Makefile.boot: zreladdr-y += 0x10008000
arch/arm/mach-integrator/Makefile.boot: zreladdr-y += 0x00008000
arch/arm/mach-iop13xx/Makefile.boot: zreladdr-y += 0x00008000
在arch/arm/boot/Makefile中被赋值:
ZRELADDR := $(zreladdr-y)
PARAMS_PHYS := $(params_phys-y)
INITRD_PHYS := $(initrd_phys-y)
... ...
ifneq ($(LOADADDR),)
UIMAGE_LOADADDR=$(LOADADDR)
else
ifeq ($(CONFIG_ZBOOT_ROM),y)
UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
你好:ARM是32位的处理器,地址范围是0-4G,都是默认从0x0开始启动。具体存储介质映射的地址范围每个芯片ARM生产商不尽相同。比如ARM7 ARM9 地址的映射是没有做严格的规定的,这个由芯片生产商自己定,但是可以通过查看各个芯片对应的数据手册能够看到内存映射图(memory map)。对于cortex M ARM有做了比较详细的内存映射规定,比如前256M(0x00000000-0x1fffffff)空间用来映射Flash(很多芯片生产商不会映射这么大的Flash,只会映射一部分,比如1024K,64K等等),接下来的256M(0x20000000-0x3fffffff)用来映射SRAM,再接下来的256M是外设寄存器,在接下来的1G是片外RAM....(具体可以看《cortex M3的权威指南》)。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)