<p dir="ltr">Alan,</p>
<p dir="ltr">Thanks very much for running this test, its given me quite a bit of confidence.</p>
<p dir="ltr">Did you have to memset the address space to 0xff before you could register/format the device ?, I found I had to do that to not get an error code.</p>
<p dir="ltr">I suppose the memset would rapidly throw up problems if I had addresses wrong. I can't think what the issue might be. I will try a mallocd area like your example though to see if I get a good result.</p>

<div class="gmail_quote">On 19 Mar 2013 21:05, "Cudmore, Alan P. (GSFC-5820)" <<a href="mailto:alan.p.cudmore@nasa.gov">alan.p.cudmore@nasa.gov</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">I took your code below and created an example that would build and run on my 4.10.2 setup. I ran this on the sparc-sis simulator, and it seems to work fine. <div><br></div><div>Are you sure you have valid memory for the nvramdisk device?</div>
<div><br></div><div>We rely on RFS on 4.10.2 and are giving a pretty good stress test right now.</div><div><br></div><div>Alan</div><div><br></div><div>------------------------------</div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#include <span style="color:#d12f1b"><errno.h></span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#include <span style="color:#d12f1b"><stdio.h></span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)">
<span style="color:#78492a">#include </span><stdlib.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><sys/stat.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#include <span style="color:#d12f1b"><fcntl.h></span></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#include <span style="color:#d12f1b"><rtems.h></span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><rtems/bdbuf.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)">
<span style="color:#78492a">#include </span><rtems/blkdev.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><rtems/diskdevs.h></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><rtems/error.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)">
<span style="color:#78492a">#include </span><rtems/flashdisk.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><rtems/fsmount.h></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><rtems/rtems-rfs.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)">
<span style="color:#78492a">#include </span><rtems/rtems-rfs-format.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><rtems/nvdisk-sram.h></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">uint32_t    rtems_nvdisk_configuration_size =<span style="color:#272ad8">1</span>;</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#bb2ca2">const</span><span style="color:#000000"> </span><span style="color:#bb2ca2">char</span><span style="color:#000000">* sram_driver = </span><span style="color:#d12f1b">"/dev/nvda"</span><span style="color:#000000">; </span>// RTEMS_NVDISK_DEVICE_BASE_NAME, 1st device</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:#bb2ca2">const</span> <span style="color:#bb2ca2">char</span>* sram_path = <span style="color:#d12f1b">"/sram"</span>;</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">/*</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
 * Let the IO system allocation the next available major number.</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">*/</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define RTEMS_DRIVER_AUTO_MAJOR (<span style="color:#272ad8">0</span>)</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
/*</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"> * The SRAM Device setup</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">*/</div><div style="margin:0px;font-size:11px;font-family:Menlo">
rtems_nvdisk_device_desc rtems_sram_device_descriptor[] =</div><div style="margin:0px;font-size:11px;font-family:Menlo">{</div><div style="margin:0px;font-size:11px;font-family:Menlo">    {</div><div style="margin:0px;font-size:11px;font-family:Menlo">
        flags:  <span style="color:#272ad8">0</span>,</div><div style="margin:0px;font-size:11px;font-family:Menlo">        base:   <span style="color:#272ad8">0</span>,</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
<span style="color:#000000">        size:   </span><span style="color:#272ad8">256</span><span style="color:#000000"> * </span><span style="color:#272ad8">1024</span><span style="color:#000000">, </span>// 256K (Adjust when ROM.ld, _IMFS_DiskSize is changed)</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">        nv_ops: &rtems_nvdisk_sram_handlers</div><div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">
};</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:#bb2ca2">const</span> rtems_nvdisk_config rtems_nvdisk_configuration[] =</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">{</div><div style="margin:0px;font-size:11px;font-family:Menlo">    {</div><div style="margin:0px;font-size:11px;font-family:Menlo">        block_size:         <span style="color:#272ad8">512</span>,</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">        device_count:       <span style="color:#272ad8">1</span>,</div><div style="margin:0px;font-size:11px;font-family:Menlo">        devices:            &rtems_sram_device_descriptor[<span style="color:#272ad8">0</span>],</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">        flags:              <span style="color:#272ad8">0</span>,</div><div style="margin:0px;font-size:11px;font-family:Menlo">        info_level:         <span style="color:#272ad8">0</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">};</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
/**</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"> * Create the SRAM Disk Driver entry.</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"> */</div><div style="margin:0px;font-size:11px;font-family:Menlo">
rtems_driver_address_table rtems_sram_ops = {</div><div style="margin:0px;font-size:11px;font-family:Menlo">    initialization_entry: rtems_nvdisk_initialize,</div><div style="margin:0px;font-size:11px;font-family:Menlo">
    open_entry:           rtems_blkdev_generic_open,</div><div style="margin:0px;font-size:11px;font-family:Menlo">    close_entry:          rtems_blkdev_generic_close,</div><div style="margin:0px;font-size:11px;font-family:Menlo">
    read_entry:           rtems_blkdev_generic_read,</div><div style="margin:0px;font-size:11px;font-family:Menlo">    write_entry:          rtems_blkdev_generic_write,</div><div style="margin:0px;font-size:11px;font-family:Menlo">
    control_entry:        rtems_blkdev_generic_ioctl</div><div style="margin:0px;font-size:11px;font-family:Menlo">};</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:#bb2ca2">void</span> setup_sram_disk (<span style="color:#bb2ca2">int</span> cold_boot)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
{</div><div style="margin:0px;font-size:11px;font-family:Menlo">    rtems_device_major_number major;</div><div style="margin:0px;font-size:11px;font-family:Menlo">    rtems_status_code         sc;</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000">    </span>// settings</div><div style="margin:0px;font-size:11px;font-family:Menlo">    rtems_sram_device_descriptor[<span style="color:#272ad8">0</span>].base = (uint32_t *) malloc (<span style="color:#272ad8">256</span>*<span style="color:#272ad8">1024</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">if</span> (cold_boot)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
    {</div><div style="margin:0px;font-size:11px;font-family:Menlo">        memset(rtems_sram_device_descriptor[<span style="color:#272ad8">0</span>].base, <span style="color:#272ad8">0xff</span>, rtems_sram_device_descriptor[<span style="color:#272ad8">0</span>].size );</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#008400">/*</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">    * Register the NV Disk driver.</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">    */</div><div style="margin:0px;font-size:11px;font-family:Menlo">
    sc = rtems_io_register_driver (RTEMS_DRIVER_AUTO_MAJOR, &rtems_sram_ops, &major);</div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">if</span> ( sc < <span style="color:#272ad8">0</span> )</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    {</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000">       printf(</span>"RTEMS Register IO driver failed\n"<span style="color:#000000">);</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">else</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">
    {</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000">       printf(</span>"RTEMS register IO driver OK\n"<span style="color:#000000">);</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">}</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">/*</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"> *</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
 * RFS on SRAM</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"> *</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"> */</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:#bb2ca2">void</span> mount_rfs_on_sram(<span style="color:#bb2ca2">int</span> cold_boot)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
{</div><div style="margin:0px;font-size:11px;font-family:Menlo">    rtems_rfs_format_config config;</div><div style="margin:0px;font-size:11px;font-family:Menlo">    rtems_status_code         rc;</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo">    setup_sram_disk (cold_boot);</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
<span style="color:#000000">    </span>// zero is a good set of defaults</div><div style="margin:0px;font-size:11px;font-family:Menlo">    memset (&config, <span style="color:#272ad8">0</span>, <span style="color:#bb2ca2">sizeof</span> (rtems_rfs_format_config));</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">if</span> (rtems_rfs_format (sram_driver, &config) < <span style="color:#272ad8">0</span>)</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    {</div><div style="margin:0px;font-size:11px;font-family:Menlo">        printf(<span style="color:#d12f1b">"error: format of %s failed: %s\n"</span>, sram_driver, strerror (errno));</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">else</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">
    {</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000">       printf(</span>"RTEMS RFS format OK\n"<span style="color:#000000">);</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">
    }</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">if</span> (mount_and_make_target_path(</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">        sram_driver,</div><div style="margin:0px;font-size:11px;font-family:Menlo">        sram_path,</div><div style="margin:0px;font-size:11px;font-family:Menlo">
        RTEMS_FILESYSTEM_TYPE_RFS,</div><div style="margin:0px;font-size:11px;font-family:Menlo">        RTEMS_FILESYSTEM_READ_WRITE,</div><div style="margin:0px;font-size:11px;font-family:Menlo">        <span style="color:#bb2ca2">NULL</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">      ) != <span style="color:#272ad8">0</span>)</div><div style="margin:0px;font-size:11px;font-family:Menlo">    {</div><div style="margin:0px;font-size:11px;font-family:Menlo">
        printf(<span style="color:#d12f1b">"error: mount of %s to %s failed: %s\n"</span>, sram_driver, sram_path, strerror (errno));</div><div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">
    <span style="color:#bb2ca2">else</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">    {</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000">       printf(</span>"mount and make target path OK\n"<span style="color:#000000">);</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">    <br></p><div style="margin:0px;font-size:11px;font-family:Menlo">    rc = rtems_mkdir(<span style="color:#d12f1b">"sram/DB"</span>, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">if</span> ( rc < <span style="color:#272ad8">0</span> )</div><div style="margin:0px;font-size:11px;font-family:Menlo">    {</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000">       printf(</span>"rtems_mkdir failed\n"<span style="color:#000000">);</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">
    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#bb2ca2">else</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">    {</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)">
<span style="color:#000000">       printf(</span>"mkdir sdram/DB OK\n"<span style="color:#000000">);</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">    }</div><div style="margin:0px;font-size:11px;font-family:Menlo">
}</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">rtems_task Init(</div><div style="margin:0px;font-size:11px;font-family:Menlo">
  rtems_task_argument ignored</div><div style="margin:0px;font-size:11px;font-family:Menlo">)</div><div style="margin:0px;font-size:11px;font-family:Menlo">{</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)">
<span style="color:#000000">  printf( </span>"\n\n*** Starting NVRAM Disk Test ***\n"<span style="color:#000000"> );</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">  mount_rfs_on_sram(<span style="color:#272ad8">1</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000">  printf( </span>"*** END OF TEST ***\n"<span style="color:#000000"> );</span></div><div style="margin:0px;font-size:11px;font-family:Menlo">
  exit( <span style="color:#272ad8">0</span> );</div><div style="margin:0px;font-size:11px;font-family:Menlo">}</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_EXTRA_TASK_STACKS         (CONFIGURE_MAXIMUM_TASKS * RTEMS_MINIMUM_STACK_SIZE)</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_MAXIMUM_DRIVERS           <span style="color:#272ad8">6</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">/* NOTICE: the clock driver is explicitly disabled */</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_MAXIMUM_TASKS <span style="color:#272ad8">40</span>                <span style="color:#008400">// TX MAX_THREAD</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_MAXIMUM_TIMERS <span style="color:#272ad8">40</span>                <span style="color:#008400">// TX MAX_TIMER</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_MAXIMUM_SEMAPHORES <span style="color:#272ad8">40</span>            <span style="color:#008400">// TX MAX_MUTEX</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES <span style="color:#272ad8">40</span>        <span style="color:#008400">// TX MAX_MSG_QUEUE</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_MAXIMUM_PARTITIONS <span style="color:#272ad8">5</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_MAXIMUM_REGIONS <span style="color:#272ad8">5</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_MAXIMUM_PORTS <span style="color:#272ad8">0</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_MAXIMUM_PERIODS <span style="color:#272ad8">0</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_MAXIMUM_BARRIERS <span style="color:#272ad8">0</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_MICROSECONDS_PER_TICK   <span style="color:#272ad8">10000</span> <span style="color:#008400">/* 10 milliseconds */</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_TICKS_PER_TIMESLICE       <span style="color:#272ad8">50</span> <span style="color:#008400">/* 50 milliseconds */</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br>
</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS  <span style="color:#272ad8">2</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS       <span style="color:#272ad8">8</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_SWAPOUT_TASK_PRIORITY        <span style="color:#272ad8">15</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">
#define CONFIGURE_FILESYSTEM_RFS</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS <span style="color:#272ad8">10</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_RTEMS_INIT_TASKS_TABLE</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(120,73,42)">#define CONFIGURE_INIT</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#78492a">#include </span><rtems/confdefs.h></div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></div></div><div>-------------------------------</div><div><br></div><div><br></div><div><br><div><div>On Mar 18, 2013, at 2:35 PM, Matthew J Fletcher <<a href="mailto:amimjf@gmail.com" target="_blank">amimjf@gmail.com</a>> wrote:</div>
<br><blockquote type="cite">Hi,<br><br><br>Alas the mkdir() is the first filesystem operation i am doing. I am not sure if i can send attachments to the list so i've cut and pasted the relivant functions below. I guess the following would run on any BSP, its just a 256k block of sram. If there is a BSP with enough memory the base pointer for the filesystem could just be a big malloc().<br>

<br>------------------- snip -------------------------<br><br><br>#define CONFIGURE_IDLE_TASK_BODY rtems_idle<br>#define CONFIGURE_EXTRA_TASK_STACKS         (CONFIGURE_MAXIMUM_TASKS * RTEMS_MINIMUM_STACK_SIZE)<br><br>#define CONFIGURE_MAXIMUM_DRIVERS           6<br>

<br>/* NOTICE: the clock driver is explicitly disabled */<br>#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER<br>#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br><br>#define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS<br>

#define CONFIGURE_MAXIMUM_TASKS 40                // TX MAX_THREAD<br>#define CONFIGURE_MAXIMUM_TIMERS 40                // TX MAX_TIMER<br>#define CONFIGURE_MAXIMUM_SEMAPHORES 40            // TX MAX_MUTEX<br>#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 40        // TX MAX_MSG_QUEUE<br>

#define CONFIGURE_MAXIMUM_PARTITIONS 5<br>#define CONFIGURE_MAXIMUM_REGIONS 5<br>#define CONFIGURE_MAXIMUM_PORTS 0<br>#define CONFIGURE_MAXIMUM_PERIODS 0<br>#define CONFIGURE_MAXIMUM_BARRIERS 0<br><br>#define CONFIGURE_MICROSECONDS_PER_TICK   10000 /* 10 milliseconds */<br>

#define CONFIGURE_TICKS_PER_TIMESLICE       50 /* 50 milliseconds */<br><br>#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK<br>#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS  2<br>#define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS       8<br>

#define CONFIGURE_SWAPOUT_TASK_PRIORITY        15<br>#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM<br>#define CONFIGURE_FILESYSTEM_RFS<br>#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 10<br><br>#define CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>

#define CONFIGURE_INIT<br>#include <rtems/confdefs.h><br><br><br>uint32_t rtems_flashdisk_configuration_size =1;<br>const char* flash_driver = "/dev/fdda";    // RTEMS_FLASHDISK_DEVICE_BASE_NAME, 1st device<br>

const char* flash_path = "/flash";<br><br>uint32_t rtems_nvdisk_configuration_size =1;<br>const char* sram_driver = "/dev/nvda"; // RTEMS_NVDISK_DEVICE_BASE_NAME, 1st device<br>const char* sram_path = "/sram";<br>

<br><br>/**<br> * Let the IO system allocation the next available major number.<br> */<br>#define RTEMS_DRIVER_AUTO_MAJOR (0)<br><br>#define FLASHDISK_SEGMENT_COUNT 8 /* 128*/    // Spansion S29GL128S, 128Mbit part<br>#define FLASHDISK_SEGMENT_SIZE (128 * 1024)    // Spansion S29GL128S, 128k sized sectors<br>

#define FLASHDISK_BLOCK_SIZE 512<br>#define FLASHDISK_BLOCKS_PER_SEGMENT (FLASHDISK_SEGMENT_SIZE / FLASHDISK_BLOCK_SIZE)<br>#define FLASHDISK_SIZE (FLASHDISK_SEGMENT_COUNT * FLASHDISK_SEGMENT_SIZE)<br><br><br>/**<br> * The SRAM Device setup<br>

 */<br>rtems_nvdisk_device_desc rtems_sram_device_descriptor[] =<br>{<br>    {<br>        flags:  0,<br>        base:   0,<br>        size:   256 * 1024, // 256K (Adjust when ROM.ld, _IMFS_DiskSize is changed)<br>        nv_ops: &rtems_nvdisk_sram_handlers<br>

    }<br>};<br><br>const rtems_nvdisk_config rtems_nvdisk_configuration[] =<br>{<br>    {<br>        block_size:         512,<br>        device_count:       1,<br>        devices:            &rtems_sram_device_descriptor[0],<br>

        flags:              0,<br>        info_level:         0<br>    }<br>};<br><br><br><br><br>/**<br> * Create the SRAM Disk Driver entry.<br> */<br>rtems_driver_address_table rtems_sram_ops = {<br>    initialization_entry: rtems_nvdisk_initialize,<br>

    open_entry:           rtems_blkdev_generic_open,<br>    close_entry:          rtems_blkdev_generic_close,<br>    read_entry:           rtems_blkdev_generic_read,<br>    write_entry:          rtems_blkdev_generic_write,<br>

    control_entry:        rtems_blkdev_generic_ioctl<br>};<br><br><br><br>int setup_sram_disk (int cold_boot)<br>{<br>    rtems_device_major_number major;<br>    rtems_status_code         sc;<br><br>    // settings<br>    rtems_sram_device_descriptor[0].base = (unsigned long)eTalus_IMFS_start;<br>

<br>    if (cold_boot)<br>    {<br>        memset(rtems_sram_device_descriptor[0].base, 0xff, rtems_sram_device_descriptor[0].size );<br>    }<br><br>    /*<br>    * Register the NV Disk driver.<br>    */<br>    sc = rtems_io_register_driver (RTEMS_DRIVER_AUTO_MAJOR, &rtems_sram_ops, &major);<br>

}<br><br><br>/*<br> *<br> * RFS on SRAM<br> *<br> */<br><br>void mount_rfs_on_sram(int cold_boot)<br>{<br>    rtems_rfs_format_config config;<br><br>    setup_sram_disk (cold_boot);<br><br>    // zero is a good set of defaults<br>

    memset (&config, 0, sizeof (rtems_rfs_format_config));<br><br>    if (rtems_rfs_format (sram_driver, &config) < 0)<br>    {<br>        sprintf(inital_print_buffer,"error: format of %s failed: %s\n", sram_driver, strerror (errno));<br>

        UART0_SendStr(inital_print_buffer);<br>    }<br><br>    if (mount_and_make_target_path(<br>        sram_driver,<br>        sram_path,<br>        RTEMS_FILESYSTEM_TYPE_RFS,<br>        RTEMS_FILESYSTEM_READ_WRITE,<br>

        NULL<br>      ) != 0)<br>    {<br>        sprintf(inital_print_buffer,"error: mount of %s to %s failed: %s\n", sram_driver, sram_path, strerror (errno));<br>        UART0_SendStr(inital_print_buffer);<br>

    }<br>    <br>    rc = rtems_mkdir("sram/DB", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);<br>}<br><br><br><br>------------------- end ------------------------<br><br><br><br><br><br><div class="gmail_quote">

On 18 March 2013 17:42, Joel Sherrill <span dir="ltr"><<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Is this reproducible with something you can share?<br>
<br>
Looking at the source, I think this case is that you<br>
filled the filesystem and there were no free blocks.<br>
But I am looking at the head and not that familiar<br>
with this filesystem.<br>
<br>
--joel<div><div><br>
On 3/18/2013 12:20 PM, Matthew J Fletcher wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I have an RFS filesystem using the nvram device, its formatted ok and mount_and_make_target_path() also worked ok. But attempting to mkdir() causes a really lowlevel issue.<br>
<br>
The callstack;<br>
<br>
rtems_rfs_block_map_find() at rtems-rfs-block.c:246 0x81198bd8<br>
rtems_rfs_block_map_next_<u></u>block() at rtems-rfs-block.c:353 0x81198d1e<br>
rtems_rfs_dir_lookup_ino() at rtems-rfs-dir.c:204 0x8119951c<br>
rtems_rfs_rtems_eval_for_make(<u></u>) at rtems-rfs-rtems.c:440 0x8118e142<br>
IMFS_evaluate_for_make() at imfs_eval.c:435 0x81190718<br>
mknod() at mknod.c:64 0x81183d5c<br>
mkdir() at mkdir.c:29 0x81183cf0<br>
build() at rtems_mkdir.c:101 0x811843a0<br>
rtems_mkdir() at rtems_mkdir.c:136 0x811843a0<br>
<br>
<br>
the rtems_rfs_block_pos_block_<u></u>past_end macro is failing and causing the return of ENXIO.<br>
<br>
The two arguments to the macro are;<br>
<br>
bpos->bno = 1<br>
bpos->boff = 0<br>
bpos->block = 0<br>
<br>
map->size->count = 1<br>
map->size->offset = 0<br>
<br>
Which seems to me the cause of ENXIO being returned, but i dont know how my BSP could affect this.<br>
<br>
Do people use RFS in production systems ? i am using the 4.10.2 sources.<br>
<br>
<br>
regards<br>
---<br>
Matthew J Fletcher<br>
<br>
</blockquote>
<br>
<br></div></div><span><font color="#888888">
-- <br>
Joel Sherrill, Ph.D.             Director of Research & Development<br>
<a href="mailto:joel.sherrill@OARcorp.com" target="_blank">joel.sherrill@OARcorp.com</a>        On-Line Applications Research<br>
Ask me about RTEMS: a free RTOS  Huntsville AL 35805<br>
Support Available                (256) 722-9985<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div><br>regards</div><div>---</div><div>Matthew J Fletcher</div><br>
_______________________________________________<br>rtems-users mailing list<br><a href="mailto:rtems-users@rtems.org" target="_blank">rtems-users@rtems.org</a><br><a href="http://www.rtems.org/mailman/listinfo/rtems-users" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-users</a><br>
</blockquote></div><br></div></div></blockquote></div>