Hi
I'm using the following code to open the flash.
if (_io_nandflash_wl_install(&_bsp_nandflash_wl_init, FFS_DEVICE) != MQX_OK)
{
printf("Can't install FFS!\n");
// _task_block();
}
else
{
if (nandflash_handle == NULL)
{
/* Open nand flash wl in normal mode */
nandflash_handle = fopen(FFS_DEVICE, NANDWL_OPEN_NORMAL);
if ( nandflash_handle == NULL )
{
printf("Unable to open NAND Flash device.\n");
printf("\nYou must run \"ffs_repair\" command\n");
return -1;
}
/* Install MFS over nand_wl driver */
error_code = _io_mfs_install(nandflash_handle, filesystem_name, (_file_size)0);
if (error_code != MFS_NO_ERROR)
{
printf("Error initializing MFS: %s\n", MFS_Error_text((uint32_t)error_code));
return -1;
}
if (filesystem_handle == NULL)
{
/* Open file system */
filesystem_handle = fopen(filesystem_name, NULL);
error_code = ferror (filesystem_handle);
if ((error_code != MFS_NO_ERROR) && (error_code != MFS_NOT_A_DOS_DISK))
{
printf("Error opening filesystem: %s\n", MFS_Error_text((uint32_t)error_code));
return -1;
}
printf ("NAND flash installed to %s\n", filesystem_name);
if ( error_code == MFS_NOT_A_DOS_DISK )
{
printf("NOT A DOS DISK! Format will start.\n");
error_code = ioctl(filesystem_handle,IO_IOCTL_DEFAULT_FORMAT,NULL);
if (error_code != MFS_NO_ERROR)
{
printf("Format finish with error code 0x%X", error_code);
}
else
{
printf("Format finish");
}
return 0;
}
}
else
{
printf("\nNAND flash was installed.\n");
}
}
else
{
printf("\nNAND flash device was opened.\n");
}
return 0;
}
After that I open a file by using path "a:/file.x"...
This answer to your question?