MMC の FAT からファイル (675 バイト) を読み込みたいです。spl.c で呼び出される関数 file_fat_read() を使用します。私のコードを以下に示します。
小さいファイルの読み取りは問題ありません。ただし、より大きなファイルを読み取ると、次のエラーが返され、デバイスの起動が停止します (PandaBoard OMAP 4460):
dlmalloc.c:2084: malloc_extend_top: Assertion '((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0' failed.
私の質問は次のとおりです。このファイルは大きすぎて読み取ることができませんか、それとも間違った方法で file_fat_read() を呼び出していますか?
私のコード:
/* Function to read Helper Data from MMC */
void readHelperData(char *filename, int length){
s32 err;
uint8_t i = 0;
printf("\n[D] - Reading Helper Data\r\n\n");
err = file_fat_read(filename, helperData, length);
if(err > 0){
printf("[D] - Received Helper Data (%d bytes):\n", err);
for(i = 0; i < err; i++){
if((i%9==0)&&i>0) printf("\n");
printf("0x%02x ", helperData[i]);
}
}else{
printf("[E] - Error reading Helper Data file %s from MMC\n", filename);
}
puts("");
}
void board_init_r(gd_t *id, ulong dummy)
{
u32 boot_device;
debug(">>spl:board_init_r()\n");
mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START, CONFIG_SYS_SPL_MALLOC_SIZE);
#ifdef CONFIG_SPL_BOARD_INIT
spl_board_init();
#endif
printf("\nReconstruction mode\n\n");
/* Encoding steps for reconstruction phase */
readMeasurement((char*)0x40300000, 675, measurement);
boot_device = omap_boot_device();
printf("boot device - %d\n", boot_device);
spl_mmc_load_image(1);
readHelperData("test.dat", 15);
}