<?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>Using RL-FlashFS</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/21227/using-rl-flashfs</link><description> 
Hi! 

 
I already wrote to the support and described my problem, but I
didn&amp;#39;t get a reaction yet. Maybe someone of you can help me. 

 
I use the RL-RTX kernel and the RL-TCPnet library on a
AT91SAM7X256 device. This works well, but now I tried to implement</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Using RL-FlashFS</title><link>https://community.arm.com/thread/99814?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2007 00:11:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8077ce1c-2a8f-420f-994c-3daf9c04b150</guid><dc:creator>Franc  Urbanc</dc:creator><description>&lt;p&gt;&lt;p&gt;
Maybe you are returning from &lt;i&gt;program_page()&lt;/i&gt; too early. If
the flash programming has not finished yet, you might get abort in
the return. This also explains why it works if you set a breakpoint
into this function where you wait and then single step.&lt;/p&gt;

&lt;p&gt;
Franc&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using RL-FlashFS</title><link>https://community.arm.com/thread/75628?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2007 07:58:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cdbe75a9-8158-468f-9318-8e326eb45a7a</guid><dc:creator>Karsten Loof</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank you for the hint. Now the described problem is gone, but
there are new ones.&lt;br /&gt;
I initialize the file system with finit() and then i perform a check
with fcheck(). This works without failure. Then I try to open a file
and get an abort. But this happens only if I run to a breakpoint
after the open call. When I put a breakpoint into the fs_ProgramPage
function and code execution stops there is no abort and I get a valid
Pointer from the fopen function.&lt;/p&gt;

&lt;p&gt;
fs_ProgramPage, fs_EraseSector, fs_Init are relocated into RAM.
fs_ProgramPage calls a swi which calls the flash programming routine.
The abort occurs somewhere after the return from fs_ProgrammPage.
Here is the code:&lt;/p&gt;

&lt;pre&gt;
int __swi(8) program_page (U32 adr, U32 sz, U8 *buf);
int __SWI_8 (U32 adr, U32 sz, U8 *buf)  {

        unsigned long   page;
        unsigned long * Flash;

        Flash = (unsigned long *)adr;
        page  = (adr - FLASH_BASE_ADDRESS) / FLASH_PAGE_SIZE_BYTE;

        // Unlock Page Command
        AT91C_BASE_MC-&amp;gt;MC_FCR = AT91C_MC_CORRECT_KEY | AT91C_MC_FCMD_UNLOCK |
                         (AT91C_MC_PAGEN &amp;amp; (page &amp;lt;&amp;lt; 8));

        // Wait until the end of Command
        while ((AT91C_BASE_MC-&amp;gt;MC_FSR &amp;amp; AT91C_MC_FRDY) != AT91C_MC_FRDY);

        // Copy to the Write Buffer
        for (sz = (sz + 3) &amp;amp; ~3; sz; sz -= 4, buf += 4)
        {
                *Flash++ = *((unsigned long *)buf);
        }
        //* Start Programming Command
        AT91C_BASE_MC-&amp;gt;MC_FCR = AT91C_MC_CORRECT_KEY | AT91C_MC_FCMD_START_PROG |
                         (AT91C_MC_PAGEN &amp;amp; (page &amp;lt;&amp;lt; 8));

        // Wait until the end of Command
        while ((AT91C_BASE_MC-&amp;gt;MC_FSR &amp;amp; AT91C_MC_FRDY) != AT91C_MC_FRDY);

    // Check for Errors
        if (AT91C_BASE_MC-&amp;gt;MC_FSR &amp;amp; (AT91C_MC_PROGE | AT91C_MC_LOCKE))
                return 1;
        return 0;
}


/*--------------------------- fs_Init ---------------------------------------*/

int fs_Init (U32 adr, U32 clk) {
        /* Library default fs_Init function. */
        unsigned long clkus;


        // Calculate Flash Microsecond Cycle Number - Approximate (no Library Code)
//      clkus = (1074*(clk &amp;gt;&amp;gt; 10)) &amp;gt;&amp;gt; 20;            // Master Clock Cycles in 1.0us
        clkus = (1611*(clk &amp;gt;&amp;gt; 10)) &amp;gt;&amp;gt; 20;            // Master Clock Cycles in 1.5us

        // Set Flash Microsecond Cycle Number
        // Set Flash Waite State to max. (Single Cycle Access at Up to 30 MHz)
        AT91C_BASE_MC-&amp;gt;MC_FMR = ((AT91C_MC_FMCN) &amp;amp; (clkus &amp;lt;&amp;lt; 16)) | AT91C_MC_FWS_3FWS;
        return (0);
}


/*--------------------------- fs_EraseSector --------------------------------*/

int fs_EraseSector (U32 adr)  {
   /* Library default fs_EraseSector function. */

        return (0);                  // Automatic Erase during Program Cycle
}


/*--------------------------- fs_ProgramPage --------------------------------*/
/*
 *    Program Page in Flash Memory
 *    Parameter:      adr:  Page Start Address
 *                    sz:   Page Size
 *                    buf:  Page Data
 *    Return Value:   0 - OK,  1 - Failed
 */

int fs_ProgramPage (U32 adr, U32 sz, U8 *buf)  {
   /* Library default fs_ProgramPage function. */

   unsigned int ret;

   ret = program_page(adr,sz,buf);

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

&lt;p&gt;
I don&amp;#39;t understand what happens and how I can find out what
happens. I am just starting to work with arm based controllers.&lt;/p&gt;

&lt;p&gt;
Best regards&lt;br /&gt;
Karsten Loof&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using RL-FlashFS</title><link>https://community.arm.com/thread/48809?ContentTypeID=1</link><pubDate>Mon, 22 Oct 2007 22:11:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:804bdb86-065d-4c3f-9ddc-78bfb504059d</guid><dc:creator>Franc  Urbanc</dc:creator><description>&lt;p&gt;&lt;p&gt;
File System needs a heap. Check your heap size in the startup
file. Typical setting is 0x800, however you may try to reduce it.&lt;/p&gt;

&lt;p&gt;
Franc&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>