We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I adopted FlashFS to use my NANDFlash (9F2G08U0A). finit() and fformat ("F:") are working fine and the flash gets erased. But if I call fopen, to create files, I get linker error:
.\at91sam9260-sdram\at91sam9260-sdram.axf: Error: L6915E: Library reports error: __use_no_semihosting_swi was requested, but _sys_open was referenced
I got a retarget.c which implements _sys_open and many other _sys-functions:
FILEHANDLE _sys_open (const char *name, int openmode) { /* Register standard Input Output devices. */ if (strcmp(name, "STDIN") == 0) { return (STDIN); } if (strcmp(name, "STDOUT") == 0) { return (STDOUT); } if (strcmp(name, "STDERR") == 0) { return (STDERR); } return (__fopen (name, openmode)); }
How can I compile my code without errors?
Hello Stefan,
I plan to integrate a similar NAND flash into a my product (it incorporates Flash-FS, too). I saw in the manual that one is expected to provide the implementaiton of 'fs_Init', 'fs_EraseSector' and 'fs_ProgramPage' to customize the behavior, as decribed here: www.keil.com/.../rlarm_fs_cvrt_flashprg_c.htm But the read operation of the NAND flash involves more than addressing memory mapped I/O - how does this fit into Flash-FS?
Hi, you are right, memory mapped access to NAND flash does not work.
Concering FlashFS the problem is, that there is no bad block management implemented. Thus you have to care about it for your own.
To work around the memory mapped read access to NAND flash, you can cheat FlashFS and use the NAND flash as SPI flash. For Reading - fs_spi_ReadData For Writing - fs_spi_ProgramPage For Sector erasing - fs_spi_EraseSector For Initialization - fs_spi_Init
Thanks. I will try that.
Stefan,
Yesterday I made an attempt to get this to work, without much success: 'fformat' fails. this is what I have does: * Enabled SPI flash device in file_config.c * Added the functions you mentioned above with an empty implementation (returning 0) * called finit.
I see that 'fs_spi_Init' is called after 'finit' is invoked, but calling 'fformat' fails hence 'fs_spi_EraseSector' is never called. Before I start digging into the assembly - did I miss something in the procedure?
Thanks in advance
Added the functions you mentioned above with an empty implementation
You have to fill these functions with the necessary implementation for reading, writing, erasing and initializing the NANDFlash. The differnce is, that you use a spi flash device instead of a "normal" flash device.
Thanks for your reply. I understand this of course. I just wanted to see if the erase sector function is called - which is not the case (returning 0 from any of these functions is considered as success). So, 'fformat("F:");" with the settings above if sufficient and should work? I think I am going to try to convince the head of R&D to replace that flash chip. I mean, I have seen that FlashFS calls a function that is likely to attempt to configure the SPI bus when using these settings. I am worried about the side effects on our SPI chips and general maintainability.
Tamir,
I would go with MCI + SDCard. It has the best performance/price ratio. I'm using the SDcard only for internal use replacing a NAND flash.
Advantages: *MCI in 4 bits mode has the fastest speed. *The FS is FAT16/32, so you can read/write the info with a PC. *Easy to upgrade with more memory if is necessary. *SDcards are cheap.
Leonardo, Thanks for your reply. My system already has an SD card plus a NAND flash and a NOR flash. something will have to go, and due to price considerations it is likely to be the SD card...
Another possibility is: to adapt FlashFS to support USB FLASH Memories (fs: FAT16/32), but you need an USB Host port in your MCU (i.e. LPC2388). I've done it and works at pretty good speeds: ~400KBytes/sec (write).