在研究nboot过程中,有几个地方不解:
我想让nboot有拷贝eboot到RAM得功能,因此需要进入loadboot函数进行拷贝。
#if 1 //本函数在友善之臂开发板中暂时没有用到
void loadboot(void)
{
DWORD dwSector, dwLength; // Start Sector & Length
DWORD dwRAM, i;
dwSector=EBOOT_SECTOR; //2; //从block:2 page:0开始存放eboot
dwLength=3072;//一共6个block;block2-7;96K容量;如果eboot文件大于96K,需要修改该代码
dwRAM=0x30038000;//eboot load Start address;把NAND FLASH内容拷贝到0X30038000
while (dwLength)
{
FMD_ReadSector(dwSector,(LPBYTE)dwRAM,NULL, 1);
dwSector++;
dwLength--;
dwRAM += SECTOR_SIZE;//该程序目前不做校验 #define SECTOR_SIZE 512
}
Launch(0x30038000);//跳转到eboot,启动eboot,程序不会返回
}
#endif
loader.h中的相关定义
// NAND Boot (loads into SteppingStone) @ Block 0
#define NBOOT_BLOCK 0
#define NBOOT_BLOCK_SIZE 8 /*1 change by capbily for vivi */
#define NBOOT_SECTOR BLOCK_TO_SECTOR(NBOOT_BLOCK)
// TOC @ Block 1
#define TOC_BLOCK 19 /*1 change by capbily for vivi */
#define TOC_BLOCK_SIZE 1
#define TOC_SECTOR BLOCK_TO_SECTOR(TOC_BLOCK)
// Eboot @ Block 2
#define EBOOT_BLOCK 10 /*2 change by capbily for vivi */
#define EBOOT_SECTOR_SIZE (11*PAGES_PER_BLOCK) /*FILE_TO_SECTOR_SIZE(EBOOT_RAM_IMAGE_SIZE)*///PAGES_PER_BLOCK=32
#define EBOOT_BLOCK_SIZE 11 /*SECTOR_TO_BLOCK(EBOOT_SECTOR_SIZE)*/
#define EBOOT_SECTOR BLOCK_TO_SECTOR(EBOOT_BLOCK)
#define RESERVED_BOOT_BLOCKS 0x890// (NBOOT_BLOCK_SIZE + TOC_BLOCK_SIZE + EBOOT_BLOCK_SIZE)
// Images start after OEM Reserved Blocks
#define IMAGE_START_BLOCK RESERVED_BOOT_BLOCKS
#define IMAGE_START_SECTOR BLOCK_TO_SECTOR(IMAGE_START_BLOCK)
nand.h #define BLOCK_TO_SECTOR(block) ((block) << 5 )
1、上面loadboot函数中为什么要循环3072次呢?FMD_ReadSector不是读512B吗?96K不是循环192次就可以了吗?
2、RESERVED_BOOT_BLOCKS(红色)为什么是0x890,NBOOT_BLOCK_SIZE + TOC_BLOCK_SIZE + EBOOT_BLOCK_SIZE=8+1+11=20块=20*32 SECTOR=320K?
3、BLOCK和SECTOR不是32倍关系吗?那eboot块数EBOOT_BLOCK_SIZE 是11,为什么EBOOT_SECTOR_SIZE是11*32呢??
第3个问错了,
// TOC @ Block 1
为什么define TOC_BLOCK 19 而不是define TOC_BLOCK 1 ?
#define EBOOT_BLOCK 10 而不是 #define EBOOT_BLOCK 2 ?
Nboot怎么占了了8个BLOCK,不应该是8个SECTOR 吗?