hi everybody,
iam using a nios II system generated from sopc
builder.my system contains
a CFI FLASH and SDRAM.Iam trying to simulate THE MEMTESTC.C exemple from the IDE.the sdram test is allright but the flash test is not.
I have an error in Modelsim "
-ERROR: Could not open flash
i think that the problem is in the function
alt_flash_open_dev witch don't recognize the flash
i changed the code a little bit to be a ble to simulate
static void TestFlash(
int mode,
int flash_type)
{
alt_flash_fd* fd;
int number_of_regions;
int block;
int y=0;
flash_region* regions;
int ret_code = 0x0;
// alt_u8 entry[4];
alt_u8 flashname[30];i replace this variable by CFI_FLASH_NAME
printf("\n get flash name\n");
ret_code = GetFlashName(CFI_FLASH_NAME,CFI);
printf("\n openning the falsh\n");
fd = alt_flash_open_dev(CFI_FLASH_NAME);
if (fd)
{
printf(" -Successfully opened %s\n", CFI_FLASH_NAME);
/* Get some useful info about the flash */
ret_code = alt_get_flash_info(fd, ®ions, &number_of_regions);
if (!ret_code)
{
printf(" -Region 0 contains %d blocks.\n", regions->number_of_blocks);
block = FlashFindErasedBlocks(fd, regions, number_of_regions, mode);
/* If we're in TEST mode, ask if this block is okay to test. */
if(( mode == TEST ) && ( block != QUIT_WITHOUT_TESTING ))
{
printf(" -Block %d, at address 0x%X identified.\n", block, (regions->offset + (block * regions->block_size)));
printf(" -Would you like to test this block? (y/n)");
//GetInputString(entry, sizeof(entry), stdin);
y=1;
// if ( entry[0] == 'y' && entry[1] == '\n' )
if(y==1)
{
/* Test that Flash! */
FlashRunTests(fd, block, regions);
printf(" -Closing flash device \"%s\".\n",CFI_FLASH_NAME);
alt_flash_close_dev(fd);
}
}
}
}
else
{
printf(" -ERROR: Could not open %s\n", CFI_FLASH_NAME);
}
}
i tried a lot of things and i get the same result
if somebody have an idea about how to solve this problem please HELP ME