This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTL: Flash File System

Hi

I'm using flash device.

Configuration:
Sector size 256 byte.

The fuction ffree() returns always 0 byte.

Is this possible?

Parents
  • Hi Stefan,

    Thanks for the advice. I still have problem with flash file system. Followed code I can compile and run on STR912FW44.

    int main(void)
    {
     S32 tmpS32;
     FILE *f;
    
     f = NULL;
     // *********************************
     tmpS32 = fcheck("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     tmpS32 = fformat("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     while(1)
     {
     };
    }
    


    I set breakpoint to the fcheck() line and be able go trough by pressing F10. Both fcheck() and fformat() return zero. If I add few lines (fopen() and fclose()), I can compile, but program never reach main() function and lookup somewhere between startup file str91x.s and main() function. Followed is this code.

    int main(void)
    {
     S32 tmpS32;
     FILE *f;
    
     f = NULL;
     // *********************************
     tmpS32 = fcheck("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     tmpS32 = fformat("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     f = fopen("R:Test.txt", "w");
     if(f == NULL)
      tmpS32 = 4;
     else
      tmpS32 = fclose(f);
     // *********************************
     while(1)
     {
     };
    }
    

    Like adding fopen() function in turn adds some scatter code, not available for debug or trace. Mikhail

Reply
  • Hi Stefan,

    Thanks for the advice. I still have problem with flash file system. Followed code I can compile and run on STR912FW44.

    int main(void)
    {
     S32 tmpS32;
     FILE *f;
    
     f = NULL;
     // *********************************
     tmpS32 = fcheck("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     tmpS32 = fformat("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     while(1)
     {
     };
    }
    


    I set breakpoint to the fcheck() line and be able go trough by pressing F10. Both fcheck() and fformat() return zero. If I add few lines (fopen() and fclose()), I can compile, but program never reach main() function and lookup somewhere between startup file str91x.s and main() function. Followed is this code.

    int main(void)
    {
     S32 tmpS32;
     FILE *f;
    
     f = NULL;
     // *********************************
     tmpS32 = fcheck("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     tmpS32 = fformat("R:");
     if(tmpS32 == 0)
      tmpS32 +=1;           // to get a trace only
     else
      tmpS32 +=2;           // to get a trace only
     // *********************************
     f = fopen("R:Test.txt", "w");
     if(f == NULL)
      tmpS32 = 4;
     else
      tmpS32 = fclose(f);
     // *********************************
     while(1)
     {
     };
    }
    

    Like adding fopen() function in turn adds some scatter code, not available for debug or trace. Mikhail

Children
  • Hi Mikhail

    I'm sure the problem is the configuration. I had the same problem.

    Make sure <read/write area> (--> set in <options for target>)
    and
    <target device base address> (--> set in the file <file_config.c>)
    do not overlap each other.

    Example for my ARM:

    <read/write area> (--> set in <options for target>):
    Start=0x200000, Size=0x8000
    
    <target device base address>  (--> set in the file <file_config.c>):
    Target base address=0x208000
    Device size in bytes=0x8000
    

    Ckeck it and let me know about your memory layout. Best regards Stefan

  • Hi Stefan,
    my configuration:

    Read/Write Memory Areas
    on-chip:
    IRAM1 Start:0x4000000 Size:0x8000
    
    In the file "AFS_Config.c":
    #define RAM_DEV     1
    #define RAM_BADR    0x04008000
    #define RAM_SIZE    0x010000
    #define RAM_NSECT   8
    

    as you can see, there is no overlap. Stefan, are your test project work in simulator? Mikhail

  • Hi Mikhail

    Yes, application with RAM drive works on target and in simualtor.

    Have you tryed with smal RAM size configuartion yet?
    How is the memory layout of your ARM?

    Stefan

  • Hi Stefan,

    Memory layout for the STR912FW44 is:

    ROM bank0 0x0 0x7FFFF (size 0x80000)
    ROM bank1 0x80000 0x87FFF (size 0x8000)
    RAM 0x4000000 0x4017FFF (size 0x18000)
    

    Stefan, can you send me your test project with file system, so I can try it on simulator and compare with my project. Do not send lib files, just zip up your project with simple main() that you already post here. My address: mikhail.sokolov@baselineindustries.com

    thanks
    Mikhail