问题是这样的,eboot运行起来之后我使用 F) Low-level format the Smart Media card
这时候可以看到DNW打印如下信息
Enter your selection: f
Reserving Blocks [0x0 - 0x11] ...
...reserve complete.
Low-level format Blocks [0x12 - 0xfff] ...
...erase complete.
Reserving Blocks [0x0 - 0x11] 我不理解为什么只保留了前12块。
在代码中追踪,从功能F看起 ,
- C/C++ code
OALMSG(TRUE, (TEXT("Reserving Blocks [0x%x - 0x%x] ...\r\n"), 0, IMAGE_START_BLOCK-1)); for (i = 0; i < IMAGE_START_SECTOR; i++) { FMD_WriteSector(i, NULL, &si, 1); } OALMSG(TRUE, (TEXT("...reserve complete.\r\n")));
可以看到是IMAGE_START_BLOCK-1 ,继续往下看
loader.h中
- C/C++ code
#define RESERVED_BOOT_BLOCKS (NBOOT_BLOCK_SIZE + TOC_BLOCK_SIZE + EBOOT_BLOCK_SIZE)// Images start after OEM Reserved Blocks#define IMAGE_START_BLOCK RESERVED_BOOT_BLOCKS
RESERVED_BOOT_BLOCKS就是nboot占块+TOC块+eboot占的块
前面两个好说 , 都是1
- C/C++ code
#define NBOOT_BLOCK 0#define NBOOT_BLOCK_SIZE 1#define NBOOT_SECTOR BLOCK_TO_SECTOR(NBOOT_BLOCK)// TOC @ Block 1#define TOC_BLOCK 1#define TOC_BLOCK_SIZE 1#define TOC_SECTOR BLOCK_TO_SECTOR(TOC_BLOCK)// Eboot @ Block 2#define EBOOT_BLOCK 2#define EBOOT_SECTOR_SIZE FILE_TO_SECTOR_SIZE(EBOOT_RAM_IMAGE_SIZE)#define EBOOT_BLOCK_SIZE SECTOR_TO_BLOCK(EBOOT_SECTOR_SIZE)#define EBOOT_SECTOR BLOCK_TO_SECTOR(EBOOT_BLOCK)
eboot占的块是根据eboot大小得来的 EBOOT_RAM_IMAGE_SIZE
这个在上面有定义的 ,一起贴出来
- C/C++ code
#define EBOOT_RAM_IMAGE_BASE 0x80038000#define EBOOT_RAM_IMAGE_SIZE 0x00040000#define EBOOT_STORE_OFFSET 0#define EBOOT_STORE_ADDRESS (EBOOT_RAM_IMAGE_BASE + EBOOT_STORE_OFFSET)#define EBOOT_STORE_MAX_LENGTH EBOOT_RAM_IMAGE_SIZE// BinFS work area defined in boot.bib#define BINFS_RAM_START (0x80021000 | CACHED_TO_UNCACHED_OFFSET) // uncached#define BINFS_RAM_LENGTH 0x5000//// Nk Memory reigions defined in config.bib...//#define ROM_RAMIMAGE_START 0x80000000#define ROM_RAMIMAGE_SIZE 0x02000000#define FILE_CACHE_START (0x80200000 | CACHED_TO_UNCACHED_OFFSET) // Start of file cache (temporary store // for flash images).// Driver globals pointer (parameter sharing memory used by bootloader and OS).//#define pBSPArgs ((BSP_ARGS *) IMAGE_SHARE_ARGS_UA_START)// Platform "BOOTME" root name.//#define PLATFORM_STRING "SMDK2440"#ifndef SECTOR_SIZE#define SECTOR_SIZE 512#endif#ifndef PAGES_PER_BLOCK#define PAGES_PER_BLOCK 32#endif#ifndef BADBLOCKMARK#define BADBLOCKMARK 0x00#endif#ifndef SECTOR_TO_BLOCK#define SECTOR_TO_BLOCK(sector) ((sector) >> 5 )#endif#ifndef BLOCK_TO_SECTOR#define BLOCK_TO_SECTOR(block) ((block) << 5 )#endif
eboot大小 256K 按他的算 EBOOT_BLOCK_SIZE=256*1024/(32*512)=16 block
那就应该是一共保留18块 ,不知道我哪里算错了 , 望指教。
------解决方案--------------------