RFS on NVRAM (RTEMS 4.10.1)

VIRAL SHAH sva1978 at yahoo.com
Thu Feb 2 05:04:01 UTC 2012


Hi Chris,

Thanks for your response. Please see the complete code below. Drivers get registered correctly but after that if we try to mount or format it crashes.
It is Ok if it is necessary to erase the NVRAM disk for the first time but then it should return some appropriate errors to the application if the disk is not erased.

static const rtems_rfs_format_config nvram_rfs_format_request = 
{
    NVRAMDISK_BLOCK_SIZE,  //512
    0,
    0,
    0,
    0,
    0
};

#define NVRAM_MNT     "/mnt/nvram"
#define NVRAMDISK_DEV        RTEMS_NVDISK_DEVICE_BASE_NAME "a"

static const rtems_fstab_entry nvram_rfs_fs_table [] = 
{
  {
    (char *)NVRAMDISK_DEV,
    (char *)NVRAM_MNT, 
    RTEMS_FILESYSTEM_TYPE_RFS,
    RTEMS_FILESYSTEM_READ_WRITE,
    FSMOUNT_MNT_OK | FSMOUNT_MNTPNT_CRTERR | FSMOUNT_MNT_FAILED,
    FSMOUNT_MNT_OK | FSMOUNT_MNTPNT_CRTERR | FSMOUNT_MNT_FAILED
  }
};

rtems_nvdisk_device_desc rtems_nv_heap_device_descriptor[] =
{
  {
    flags:  0,
    base:  &_NVRAM_FS,
    size:  NVRAM_SIZE_64K,
    nv_ops: &rtems_nvdisk_sram_handlers
  }
};

const rtems_nvdisk_config rtems_nvdisk_configuration[] =
{
  {
    block_size:         NVRAMDISK_BLOCK_SIZE,
    device_count:       1,
    devices:            &rtems_nv_heap_device_descriptor[0],
    flags:              0,
    info_level:         0
  }
};

/**
 * The number of NV Disk configurations.
 */
size_t rtems_nvdisk_configuration_size = 1;

/**
 * Create the NV Disk Driver entry.
 */
rtems_driver_address_table rtems_nvdisk_io_ops = {
  initialization_entry: rtems_nvdisk_initialize,
  open_entry:           rtems_blkdev_generic_open,
  close_entry:          rtems_blkdev_generic_close,
  read_entry:           rtems_blkdev_generic_read,
  write_entry:          rtems_blkdev_generic_write,
  control_entry:        rtems_blkdev_generic_ioctl
};

void main(void)
{


    int rv = 0;
    rtems_device_major_number major;
    rtems_io_register_driver (0, &rtems_nvdisk_io_ops, &major);
    rv = rtems_rfs_format( NVRAMDISK_DEV, &nvram_rfs_format_request); // software crashes when this is called.
    rv = rtems_fsmount(nvram_rfs_fs_table, 1, NULL);

}


Thanks & Best Regards,
Viral.



------------------------------
On Wed 1 Feb, 2012 6:12 AM IST Chris Johns wrote:

>On 31/01/12 7:13 PM, VIRAL SHAH wrote:
>>
>> Hi All,
>>
>> When we try to mount the RFS on a NVRAM having non 0xFF data it crashes. We cannot see any error on MMI but the CPU gives bus exception indicating the software is trying to write to a write protected location.
>>
>>
>> We use the below configuration and have 256KB of NVRAM(actually SRAM).
>>
>> const rtems_nvdisk_config rtems_nvdisk_configuration[] =
>> {
>>    {
>>      block_size:         NVRAMDISK_BLOCK_SIZE, //512
>>      device_count:       1,
>>      devices:&rtems_nv_heap_device_descriptor[0],
>>      flags:              0,
>>      info_level:         0
>>    }
>> };
>>
>> If we manually intialize the NVRAM first with 0XFF and then mount RFS it works without any problem. Can anyone please guide us how to fix this problem?
>>
>
>What commands do you use to set up the NVRAM disk ?
>
>The RFS defaults to 0xff so if you are erasing and formatting the disk 
>correctly this would point to an initialisation type bug.
>
>Chris





More information about the users mailing list