<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/38272/porting-flashfs-to-use-nandflash</link><description> 
Hi, 
I adopted FlashFS to use my NANDFlash (9F2G08U0A). 
finit() and fformat (&amp;quot;F:&amp;quot;) 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:</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/148374?ContentTypeID=1</link><pubDate>Sat, 23 May 2009 10:13:57 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:10e1d28e-becc-4700-b739-135c773c21df</guid><dc:creator>Leandro Gentili</dc:creator><description>&lt;p&gt;&lt;p&gt;
Another possibility is: to adapt FlashFS to support &lt;b&gt;USB FLASH
Memories&lt;/b&gt; (fs: FAT16/32), but you need an &lt;b&gt;USB Host&lt;/b&gt; port in
your MCU (i.e. LPC2388). I&amp;#39;ve done it and works at pretty good
speeds: ~400KBytes/sec (write).&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/148078?ContentTypeID=1</link><pubDate>Sat, 23 May 2009 06:12:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3b086448-0eca-4320-a331-6cfd77ee6a0c</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
Leonardo,&lt;br /&gt;
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...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/147492?ContentTypeID=1</link><pubDate>Sat, 23 May 2009 00:40:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d133ed67-b1b7-4dbc-be85-b263401fb07c</guid><dc:creator>Leandro Gentili</dc:creator><description>&lt;p&gt;&lt;p&gt;
Tamir,&lt;/p&gt;

&lt;p&gt;
I would go with MCI + SDCard. It has the best performance/price
ratio.&lt;br /&gt;
I&amp;#39;m using the SDcard only for internal use replacing a NAND
flash.&lt;/p&gt;

&lt;p&gt;
Advantages:&lt;br /&gt;
*MCI in 4 bits mode has the fastest speed.&lt;br /&gt;
*The FS is FAT16/32, so you can read/write the info with a PC.&lt;br /&gt;
*Easy to upgrade with more memory if is necessary.&lt;br /&gt;
*SDcards are cheap.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/146329?ContentTypeID=1</link><pubDate>Fri, 22 May 2009 00:30:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7360fa33-2d9e-4260-a598-32d4228e3a9e</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
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, &amp;#39;fformat(&amp;quot;F:&amp;quot;);&amp;quot; with the settings above if sufficient and should
work?&lt;br /&gt;
I think I am going to try to convince the head of R&amp;amp;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.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/144569?ContentTypeID=1</link><pubDate>Fri, 22 May 2009 00:24:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:033a31f6-d571-4fb7-afe0-1c426aea0ebb</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;Added the functions you mentioned above with an empty
implementation&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
You have to fill these functions with the necessary implementation
for reading, writing, erasing and initializing the NANDFlash.&lt;br /&gt;
The differnce is, that you use a spi flash device instead of a
&amp;quot;normal&amp;quot; flash device.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/142242?ContentTypeID=1</link><pubDate>Thu, 21 May 2009 22:37:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7678acb0-96a2-40e5-b92b-78c287dcfa54</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
Stefan,&lt;/p&gt;

&lt;p&gt;
Yesterday I made an attempt to get this to work, without much
success: &amp;#39;fformat&amp;#39; fails. this is what I have does:&lt;br /&gt;
* Enabled SPI flash device in file_config.c&lt;br /&gt;
* Added the functions you mentioned above with an empty
implementation (returning 0)&lt;br /&gt;
* called finit.&lt;/p&gt;

&lt;p&gt;
I see that &amp;#39;fs_spi_Init&amp;#39; is called after &amp;#39;finit&amp;#39; is invoked, but
calling &amp;#39;fformat&amp;#39; fails hence &amp;#39;fs_spi_EraseSector&amp;#39; is never called.
Before I start digging into the assembly - did I miss something in
the procedure?&lt;/p&gt;

&lt;p&gt;
Thanks in advance&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/142241?ContentTypeID=1</link><pubDate>Thu, 21 May 2009 13:01:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9996efdb-5603-4f17-8228-c198b3ac955c</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks. I will try that.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/139087?ContentTypeID=1</link><pubDate>Thu, 21 May 2009 11:50:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7d67191f-4a81-4ac6-8cd5-e77ff4c68957</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi,&lt;br /&gt;
you are right, memory mapped access to NAND flash does not work.&lt;/p&gt;

&lt;p&gt;
Concering FlashFS the problem is, that there is no bad block
management implemented. Thus you have to care about it for your
own.&lt;/p&gt;

&lt;p&gt;
To work around the memory mapped read access to NAND flash, you
can cheat FlashFS and use the NAND flash as SPI flash.&lt;br /&gt;
For Reading - fs_spi_ReadData&lt;br /&gt;
For Writing - fs_spi_ProgramPage&lt;br /&gt;
For Sector erasing - fs_spi_EraseSector&lt;br /&gt;
For Initialization - fs_spi_Init&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/135703?ContentTypeID=1</link><pubDate>Thu, 21 May 2009 07:25:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8925f943-7f87-4b5a-afd0-43b3e9faaf2b</guid><dc:creator>Tamir Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Stefan,&lt;/p&gt;

&lt;p&gt;
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 &amp;#39;fs_Init&amp;#39;, &amp;#39;fs_EraseSector&amp;#39; and
&amp;#39;fs_ProgramPage&amp;#39; to customize the behavior, as decribed here:
&lt;a href="http://www.keil.com/support/man/docs/rlarm/rlarm_fs_cvrt_flashprg_c.htm"&gt;
&lt;a href="http://www.keil.com/support/man/docs/rlarm/rlarm_fs_cvrt_flashprg_c.htm"&gt;www.keil.com/.../rlarm_fs_cvrt_flashprg_c.htm&lt;/a&gt;&lt;/a&gt;&lt;br /&gt;

But the read operation of the NAND flash involves more than
addressing memory mapped I/O - how does this fit into Flash-FS?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/125320?ContentTypeID=1</link><pubDate>Mon, 16 Mar 2009 08:05:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c950544f-56f6-4c81-8ffe-14f82767dbb7</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
I also though, that there would be a stack/heap problem, but I
configured them to be 64kB each and its still failing.&lt;/p&gt;

&lt;p&gt;
Here is the main:&lt;/p&gt;

&lt;pre&gt;
int main()
{
        int result = 0;
        FILE *f1, *fin;
        signed char ch;
        char* fname = &amp;quot;F1.TXT&amp;quot;;
        char line[80];


        // Configure the DBGU
        TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK);
        printf(&amp;quot;-- Basic NandFlash Project %s --\n\r&amp;quot;, SOFTPACK_VERSION);
        printf(&amp;quot;-- %s\n\r&amp;quot;, BOARD_NAME);
        printf(&amp;quot;-- Compiled: %s %s --\n\r&amp;quot;, __DATE__, __TIME__);

        /* Initialize the FlashFS. */
        result = finit();

        printf(&amp;quot;finit() = %i\n&amp;quot;, result);

        f1 = fopen (fname, &amp;quot;w&amp;quot;);
        fputs(&amp;quot;hallo welt&amp;quot;, f1);
        fclose(f1);

        printf(&amp;quot;-- Compiled: %s %s --\n\r&amp;quot;, __DATE__, __TIME__);


        fin = fopen (fname,&amp;quot;r&amp;quot;);
        if (fin == NULL) {
                printf (&amp;quot;File not found!\n&amp;quot;);
        }
        else {
                while (fgets (line, sizeof (line), fin) != NULL) {
                        puts (line);
                }
                fclose (fin);
        }

        printf(&amp;quot;-- Compiled: %s %s --\n\r&amp;quot;, __DATE__, __TIME__);

        return 0;
}
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
I&amp;#39;m using an AT91SAM9260 and execute the code from external SD-RAM. I
just took the NANDFlash example project for KEIL &amp;Acirc;&amp;micro;Vision
out of the software package version 1.5 supplied by ATMEL.&lt;br /&gt;
There are no problems, when I use the NANDFlash without the FlashFS.
I&amp;#39;m able to read/write it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/114761?ContentTypeID=1</link><pubDate>Mon, 16 Mar 2009 07:55:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5de3c5b4-abef-4eb3-8ce7-f63250be7b51</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Do you get a stack overflow or a failed memory allocation
somewhere?&lt;/p&gt;

&lt;p&gt;
Another think is that we only see that you are sending a pointer
&amp;quot;name&amp;quot; in several steps but what does this pointer point at? A
globally allocated memory block or a static text string stored in
flash or?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/101729?ContentTypeID=1</link><pubDate>Mon, 16 Mar 2009 06:38:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c70e213e-5ad7-4951-89c3-3e595f966958</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
The following, I found out:&lt;br /&gt;
When calling __fopen, the variable holding the variable name gets
0x00000000. When stepping it, it is valid, when the PC is at the
first line. When I step in, it gets invalid.&lt;/p&gt;

&lt;pre&gt;
FILEHANDLE _sys_open (const char *name, int openmode) {
   /* Register standard Input Output devices. */
   if (strcmp(name, &amp;quot;STDIN&amp;quot;) == 0) {
      return (STDIN);
   }
   if (strcmp(name, &amp;quot;STDOUT&amp;quot;) == 0) {
      return (STDOUT);
   }
   if (strcmp(name, &amp;quot;STDERR&amp;quot;) == 0) {
      return (STDERR);
   }
   return (__fopen (name, openmode));
}

int __fopen (const char *fname, int openmode) { // until here everything is ok
   /* Low level file open function. */
   U32 i,fid;
   int handle;
   IOB *fcb;

   /* Find unused _iob[] structure. */
   if ((handle = fs_find_iob ()) == EOF) { // when stepping to here, fname gets 0x00000000
      /* Cannot find any unused _iob[] structure */
      return (-1);
   }
...
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/77260?ContentTypeID=1</link><pubDate>Mon, 16 Mar 2009 04:03:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8d68cccf-7f2f-4d45-a76c-20b82f819d2d</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi,&lt;br /&gt;
I found the problem concerning the _sys_open() linker error
message.&lt;br /&gt;
One has to implement all functions like _sys_open, _sys_close,
_sys_write and so in, otherwise the sys_io library is beeing linked
and code cannot be created.&lt;/p&gt;

&lt;p&gt;
But now I encounter new problems:&lt;br /&gt;
I adopted the NANDFlash example project from the AT91SAM9260 software
package to use FlashFS.&lt;br /&gt;
I simply initialize the FS and try to open a file:&lt;/p&gt;

&lt;pre&gt;
/* Initialize the FlashFS. */
result = finit();
printf(&amp;quot;finit() = %i\n&amp;quot;, result);

/* Format a Flash Drive. */
if (fformat (&amp;quot;F:&amp;quot;) != 0) {
        printf (&amp;quot;Flash File System format failed.\n&amp;quot;);
}
else {
        printf (&amp;quot;Flash File System initialized.\n&amp;quot;);
}

f1 = fopen (&amp;quot;F1.TXT&amp;quot;,&amp;quot;w&amp;quot;);
fputs(&amp;quot;hello world&amp;quot;, f1);
fclose(f1);
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Its initialzing ok. Formating does also work, but fopen does not
return - it&amp;#39;s looping inside of fs_Find_File and executes code at
0x00000000 after some time.&lt;/p&gt;

&lt;p&gt;
Does someone have FlashFS running with a NANDFlash?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Porting FlashFS to use NANDFlash</title><link>https://community.arm.com/thread/55632?ContentTypeID=1</link><pubDate>Sun, 15 Mar 2009 21:39:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:179e2945-b138-4ac1-9e74-7ec49f1556d3</guid><dc:creator>John Linq</dc:creator><description>&lt;p&gt;&lt;p&gt;
(I don&amp;#39;t know much about this.)&lt;/p&gt;

&lt;p&gt;
The error msg means:&lt;/p&gt;

&lt;p&gt;
You declared&lt;/p&gt;

&lt;pre&gt;
#pragma import(__use_no_semihosting_swi)
&lt;/pre&gt;

&lt;p&gt;
somewhere.&lt;/p&gt;

&lt;p&gt;
However, your _sys_open() needs some semihosting_swi support.&lt;/p&gt;

&lt;p&gt;
So maybe, you should re-write your _sys_open() or mark the
&amp;quot;#pragma import(__use_no_semihosting_swi)&amp;quot;.&lt;/p&gt;

&lt;p&gt;
I guess, STDIN/STDOUT/STDERR need some semihosting_swi
support.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>