This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

U-Boot: 'dlmalloc.c:2084: malloc_extend_top: Assertion failed' when reading large file from MMC FAT

Other Parts Discussed in Thread: 4460

I want to read a file (675 bytes) from the FAT on my MMC. I use the function file_fat_read(), which is called in spl.c. My code is shown below.

Reading smaller files is not a problem. However, reading larger files returns the following error und stops booting the device (PandaBoard OMAP 4460):

`dlmalloc.c:2084: malloc_extend_top: Assertion '((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0' failed.`

My question is: is this file too big to read or do I call file_fat_read() in the wrong way?

My code:

/* 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);
}