Max Peng

MFS with internal flash on M52255

Discussion created by Max Peng on Mar 16, 2010
Latest reply on Apr 2, 2014 by Sean MacKay



As title, how can I read/write internal flash of M52259 with MFS?


I installed flashx driver, opened device and installed MFS, but I cannot format the device.



/* initialize internel flash device */pf_IntFlash=fopen("flashx:", NULL);if(pf_IntFlash==NULL)printf("Error open internal flash device!\n");else{ /* mount filesystem */ mfsStatus=_io_mfs_install(pf_IntFlash, "c:", (_file_size)0);    if(mfsStatus != MFS_NO_ERROR)printf("MFS install failed!\n"); else {  /* format if needed */  FILE_PTR pf_fd;  int_32 error_code;  /* Open the filesystem and detect, if format is required */  pf_fd = fopen("c:", NULL);  error_code = ferror(pf_fd);  if(error_code==MFS_NO_ERROR)printf("Internal flash device initialized.\n");  else if (error_code == MFS_NOT_A_DOS_DISK)   {   /* no file system, need to format */   printf("Formating internal flash drive...\n");   error_code=ioctl(pf_fd, IO_IOCTL_DEFAULT_FORMAT, NULL);   if(error_code)printf("IntFlash format error!(%X)\n", error_code);  }  else printf("Error while opening c:\\ (%s)\n", MFS_Error_text((uint_32)(uint_32)error_code));  //fclose(pf_fd); }}

 The result like following


Formating internal flash drive...IntFlash format error!(301D)

 The error code means MFS_WRITE_FAULT, but I don't know how to solve this...


Please help!