O:31:"Drupal\Core\Render\HtmlResponse":8:{s:7:"headers";O:50:"Symfony\Component\HttpFoundation\ResponseHeaderBag":5:{s:23:"*computedCacheControl";a:2:{s:7:"max-age";s:3:"300";s:6:"public";b:1;}s:10:"*cookies";a:0:{}s:14:"*headerNames";a:14:{s:12:"content-type";s:12:"Content-Type";s:13:"cache-control";s:13:"Cache-Control";s:4:"date";s:4:"Date";s:22:"x-drupal-dynamic-cache";s:22:"X-Drupal-Dynamic-Cache";s:4:"link";s:4:"Link";s:15:"x-ua-compatible";s:15:"X-UA-Compatible";s:16:"content-language";s:16:"Content-language";s:22:"x-content-type-options";s:22:"X-Content-Type-Options";s:15:"x-frame-options";s:15:"X-Frame-Options";s:7:"expires";s:7:"Expires";s:13:"last-modified";s:13:"Last-Modified";s:4:"etag";s:4:"ETag";s:4:"vary";s:4:"Vary";s:11:"x-generator";s:11:"X-Generator";}s:10:"*headers";a:14:{s:12:"content-type";a:1:{i:0;s:24:"text/html; charset=UTF-8";}s:13:"cache-control";a:1:{i:0;s:19:"max-age=300, public";}s:4:"date";a:1:{i:0;s:29:"Thu, 26 Oct 2017 12:00:06 GMT";}s:22:"x-drupal-dynamic-cache";a:1:{i:0;s:4:"MISS";}s:4:"link";a:6:{i:0;s:43:"</documents/yaffs-vxworks>; rel="canonical"";i:1;s:28:"</node/479>; rel="shortlink"";i:2;s:42:"</documents/yaffs-vxworks>; rel="revision"";i:3;s:108:"</sites/default/files/css/css_YGKHk3qOgVcGqV_6s_kZUGJkGYQEouHb462Ja18qfRA.css?ovtedh>; rel=preload; as=style";i:4;s:108:"</sites/default/files/css/css_6qeLA6GBkZNPHWp9GdQIYovV3tYuKU-ts-HicZ-WeQQ.css?ovtedh>; rel=preload; as=style";i:5;s:99:"</sites/default/files/js/js_2l0lF4i9o3aztHULbfajMT_RTqGCEN_lVC8JI48SILw.js>; rel=preload; as=script";}s:15:"x-ua-compatible";a:1:{i:0;s:7:"IE=edge";}s:16:"content-language";a:1:{i:0;s:2:"en";}s:22:"x-content-type-options";a:1:{i:0;s:7:"nosniff";}s:15:"x-frame-options";a:1:{i:0;s:10:"SAMEORIGIN";}s:7:"expires";a:1:{i:0;s:29:"Sun, 19 Nov 1978 05:00:00 GMT";}s:13:"last-modified";a:1:{i:0;s:29:"Thu, 26 Oct 2017 12:00:01 GMT";}s:4:"etag";a:1:{i:0;s:12:""1509019201"";}s:4:"vary";a:1:{i:0;s:6:"Cookie";}s:11:"x-generator";a:1:{i:0;s:33:"Drupal 8 (https://www.drupal.org)";}}s:15:"*cacheControl";a:2:{s:7:"max-age";s:3:"300";s:6:"public";b:1;}}s:10:"*content";s:28845:"<!DOCTYPE html>
<html  lang="en" dir="ltr" prefix="content: http://purl.org/rss/1.0/modules/content/  dc: http://purl.org/dc/terms/  foaf: http://xmlns.com/foaf/0.1/  og: http://ogp.me/ns#  rdfs: http://www.w3.org/2000/01/rdf-schema#  schema: http://schema.org/  sioc: http://rdfs.org/sioc/ns#  sioct: http://rdfs.org/sioc/types#  skos: http://www.w3.org/2004/02/skos/core#  xsd: http://www.w3.org/2001/XMLSchema# ">
  <head>
    <meta charset="utf-8" />
<meta name="title" content="Yaffs for VxWorks | Yaffs - A Flash File System for embedded use" />
<meta name="news_keywords" content="Flash File System" />
<meta name="description" content="The purpose of this document is to describe the Yaffs-on-VxWorks wrapper and provide sufficient information to port Yaffs to the VxWorks BSP. It assumes a working knowledge of VxWorks.
It does not describe the inner workings of Yaffs, and study of other Yaffs documents is recommended. Documents shown below in Italics will be found at http://yaffs.net/documents . . .
The source and the definitive version of this document can be found in our git repository, together with other Yaffs documents." />
<meta name="abstract" content="Yaffs (Yet Another Flash File System) is an open-source file system specifically designed to be fast, robust and suitable for embedded use with NAND and NOR Flash. It is widely used with Linux, RTOSs, or no OS at all, in consumer devices and critical infrastructure. It is available under GNU Public License, GPL, or on commercial terms from Aleph One." />
<meta name="keywords" content="flash File System, flash, file System, flash storage, NAND flash, NOR flash, Yaffs" />
<meta name="Generator" content="Drupal 8 (https://www.drupal.org)" />
<meta name="MobileOptimized" content="width" />
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansRegular-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansItalic-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansBold-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifBold-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifBoldItalic-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifItalic-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifRegular-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="stylesheet" href="https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansBoldItalic-fontfacekit/fontyourface-stylesheet.css" media="all" />
<link rel="shortcut icon" href="/sites/default/files/yaffs_favicon.png" type="image/png" />
<link rel="canonical" href="/documents/yaffs-vxworks" />
<link rel="shortlink" href="/node/479" />
<link rel="revision" href="/documents/yaffs-vxworks" />

    <title>Yaffs for VxWorks | Yaffs - A Flash File System for embedded use</title>
    <link rel="stylesheet" href="/sites/default/files/css/css_YGKHk3qOgVcGqV_6s_kZUGJkGYQEouHb462Ja18qfRA.css?ovtedh" media="all" />
<link rel="stylesheet" href="/sites/default/files/css/css_6qeLA6GBkZNPHWp9GdQIYovV3tYuKU-ts-HicZ-WeQQ.css?ovtedh" media="all" />

    
<!--[if lte IE 8]>
<script src="/sites/default/files/js/js_VtafjXmRvoUgAzqzYTA3Wrjkx9wcWhjP0G4ZnnqRamA.js"></script>
<![endif]-->

  </head>
  <body class="fontyourface path-node page-node-type-paper navbar-is-fixed-top has-glyphicons">
    <a href="#main-content" class="visually-hidden focusable skip-link">
      Skip to main content
    </a>
    <div style="background-color: ; color: " id="environment-indicator">
  
    </div>

              <header class="navbar navbar-default navbar-fixed-top" id="navbar" role="banner">
              <div class="container">
            <div class="navbar-header">
          <div class="region region-navigation">
          <a class="logo navbar-btn pull-left" href="/" title="Home" rel="home">
      <img src="/themes/custom/yaffs/logo.svg" alt="Home" />
    </a>
      
  </div>

                          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
              </div>

                    <div id="navbar-collapse" class="navbar-collapse collapse">
            <div class="region region-navigation-collapsible">
    <nav role="navigation" aria-labelledby="block-mainnavigation-menu" id="block-mainnavigation">
            <h2 class="sr-only" id="block-mainnavigation-menu">Main navigation</h2>

      
              <ul class="menu nav navbar-nav">
                            <li>
        <a href="/" data-drupal-link-system-path="&lt;front&gt;">Home</a>
                  </li>
                        <li>
        <a href="/support" title="Help for Yaffs" data-drupal-link-system-path="node/380">Support</a>
                  </li>
                        <li>
        <a href="/documents" data-drupal-link-system-path="documents">Documents</a>
                  </li>
                        <li>
        <a href="/get-yaffs" data-drupal-link-system-path="node/382">Download</a>
                  </li>
                        <li>
        <a href="/about-us" data-drupal-link-system-path="node/325">About us</a>
                  </li>
                        <li>
        <a href="/contact" data-drupal-link-system-path="node/73">Contact</a>
                  </li>
        </ul>
  


  </nav>
<div class="search-block-form block block-search block-search-form-block" data-drupal-selector="search-block-form" id="block-searchform" role="search">
  
    
      <form action="/search/node" method="get" id="search-block-form" accept-charset="UTF-8">
  <div class="form-item js-form-item form-type-search js-form-type-search form-item-keys js-form-item-keys form-no-label form-group">
      <label for="edit-keys" class="control-label sr-only">Search</label>
  
  
  <div class="input-group"><input title="Enter the terms you wish to search for." data-drupal-selector="edit-keys" class="form-search form-control" placeholder="Search" type="search" id="edit-keys" name="keys" value="" size="15" maxlength="128" data-toggle="tooltip" /><span class="input-group-btn"><button type="submit" value="Search" class="button js-form-submit form-submit btn-primary btn icon-only" name=""><span class="sr-only">Search</span><span class="icon glyphicon glyphicon-search" aria-hidden="true"></span></button></span></div>

  
  
  </div>
<div class="form-actions form-group js-form-wrapper form-wrapper" data-drupal-selector="edit-actions" id="edit-actions"></div>

</form>

  </div>

  </div>

        </div>
                    </div>
          </header>
  
  <div role="main" class="main-container container js-quickedit-main-content">
    <div class="row">

            
            
                  <section class="col-sm-12">

                                      <div class="highlighted">  <div class="region region-highlighted">
        <ol class="breadcrumb">
          <li >
                  <a href="/documents">Documents</a>
              </li>
          <li  class="active">
                  Yaffs for VxWorks
              </li>
      </ol>



  </div>
</div>
                  
                
                
                                      
                  
                          <a id="main-content"></a>
            <div class="region region-content">
        <h1 class="page-header"><span>Yaffs for VxWorks</span>
</h1>

  <article role="article" about="/documents/yaffs-vxworks" class="paper is-promoted full clearfix">

  
    

      <footer>
      
      <div class="author">
        Submitted by <span><span lang="" about="/user/admin" typeof="schema:Person" property="schema:name" datatype="">Admin</span></span>
 on <span>11 January, 2016 - 3:28pm</span>
        
      </div>
    </footer>
  
  <div class="content">
    
            <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<p>The source and the definitive version of this document can be found in our git repository,&nbsp;<a href="http://www.aleph1.co.uk/gitweb/?p=yaffs-docs;a=tree;h=f4fcbdc9da052aa926c4bc2275547ca310eebbd8;hb=9d50c62a1c24f1b9dd00ec3eb6d0bddff0aed17d">together with other Yaffs documents</a>.</p>
<h2>1 Background</h2>
<p>The purpose of this document is to describe the Yaffs-for-VxWorks wrapper as well as provide sufficient information to port Yaffs to the VxWorks BSP. This document assumes a working knowledge of VxWorks.</p>
<p>This document does not describe the inner workings of Yaffs and a study of other Yaffs documents is recommended. Documents shown below in <em>italics</em> are available at <em><a href="http://www.yaffs.net/documents">http://www.yaffs.net/documents</a>...</em></p>
<h2>2 Licensing</h2>
<p>Yaffs was originally released for Linux under the GNU Public License (GPL). Various embedded developers soon identified that Yaffs would be ideal for their applications, but were not able to use GPL based code in their systems. Aleph One Ltd has alternative licensing arrangements to support such applications.</p>
<p>Since VxWorks is proprietary code that is incompatible with GPL, alternative licensing arrangements must be sought to use Yaffs with VxWorks or most other embedded RTOSs.</p>
<h2>3 What are Yaffs and Yaffs Direct Interface?</h2>
<p>Yaffs stands for Yet Another Flash File System and was the first file system designed from the ground up for NAND flash storage.</p>
<p>In 2002 Aleph One set out to identify file system options for using NAND Flash as a file system. Various file systems available at the time were evaluated and all were found lacking in one way or another. The need for a suitable NAND storage file system was identified and Yaffs was designed to fill that need.</p>
<p>Although Yaffs was originally designed for NAND flash, it has been used successfully with NOR flash systems and even as a RAM file system. This allows high reliability file systems to be constructed using NOR flash, with a future migration path to NAND flash for higher density and performance.</p>
<p>Yaffs was originally designed for use with the Linux operating system, but was designed in a very modular way. The operating-system-specific code was kept separate from the main Yaffs file system code. This allows Yaffs to be ported quite cleanly to other operating systems through operating system personality modules. One such personality module is the Yaffs Direct Interface (YDI) which allows Yaffs to be simply integrated with embedded systems, with or without an RTOS. See <a href="http://www.yaffs.net/documents/yaffs-direct-interface">http://www.yaffs.net/documents/yaffs-direct-interface</a></p>
<p>The current version is Yaffs2, which supports a wider range of NAND flash components including 2k/4k/8k or even 16k page devices and devices with multi-level cells (MLC), and produces equivalent or better performance. Yaffs2 include Yaffs1 compatibility code so Yaffs1 images still work and migration is quite simple. Yaffs1 or Yaffs2 mode of operation are simply selected by a run-time parameter.</p>
<p>As well as providing a NAND file system, YDI also provides a RAM emulation layer to allow Yaffs to operate as a RAM file system too. While the RAM emulation is perhaps not as efficient as a dedicated RAM file system, this does allow one well proven file system to use both RAM and flash.</p>
<p>Yaffs has been used for many products using various operating systems including Windows Embedded Compact (previously called Windows CE) and various RTOSs, including ThreadX, vXworks, pSOS to name just a few. Note that there is a native port of Yaffs to eCOS that does not use YDI. This is supported and distributed by eCocCentric.(<a href="http://www.ecoscentric.com/">http://www.ecoscentric.com/</a>).</p>
<h2>4 Why use Yaffs?</h2>
<p>For an in depth understanding of the advantages of Yaffs, please read <em><a href="http://www.yaffs.net/documents/considerations-choosing-flash-file-system">http://www.yaffs.net/documents/considerations-choosing-flash-file-system</a></em></p>
<p>For a brief overview: Yaffs is the first, and perhaps only, file system designed specifically for NAND flash. This means that Yaffs has been designed to work around the various limitations and quirks of NAND flash, as well as exploit the various features of NAND to achieve an effective file system.</p>
<p>Some features to consider:</p>
<ul>
<li>Yaffs has been well proven and has been used to ship in large volumes in several products using many different operating systems, compilers and processors.</li>
<li>Yaffs is written in portable C and is endian neutral.</li>
<li>Yaffs provides bad block handling and ECC algorithms to handle deficiencies in NAND flash.</li>
<li>Yaffs is a log-structured file system which makes it very robust to corruptions caused by power failures etc.</li>
<li>Yaffs has highly optimised and predictable garbage collection strategies. This makes it high performance and very deterministic when compared with similar file systems.</li>
<li>Yaffs has a lower memory footprint than most other log-structured flash file systems.</li>
<li>Yaffs provides a wide range of POSIX-style file system support including directories, symbolic and hard links etc. through standard file system interface calls.</li>
<li>Yaffs is highly configurable to work with various flash geometries, various ECC options, caching options etc.</li>
<li>Yaffs Direct Interface is simple to integrate in a system – only a few interface functions are required.</li>
<li>Yaffs can be used with a wide range of memory technologies.</li>
</ul>
<h2>5 What is Yaffs -for-VxWorks?</h2>
<p>Many organizations have used Yaffs on VxWorks with just Yaffs Direct Interface (YDI). So what benefit does Yaffs-for-VxWorks offer?</p>
<p>YDI provides a POSIX-like API, but with Yaffs specific names. For example: yaffs_open(), yaffs_read(), yaffs_close() etc.</p>
<p>While YDI provides a solution for many systems, and is very well proven, it has one major drawback. It is not a native file system. That means:</p>
<ul>
<li>Existing code that calls open(), read(), write() etc cannot be immediately used with YDI. The code needs to be rewritten to call the YDI functions: yaffs_open(), yaffs_read()... This porting is costly and error prone.</li>
<li>Code written for YDI is then locked to Yaffs and makes portability/testability problems.</li>
<li>Tools such as the VxWorks console shell cannot be used to access Yaffs files via YDI.</li>
</ul>
<p>Yaffs-for-VxWorks fixes these limitations..</p>
<p>Yaffs-for-VxWorks is a wrapper around YDI that plugs YDI in as a native file system (ie. Yaffs becomes a file system that is accessed no different from any of the other file systems on system. This makes it really easy to migrate existing VxWorks software, or develop new VxWorks software to get the benefits of Yaffs.</p>
<p>Yaffs-for-VxWorks follows the VxWorks operating system model used by other VxWorks file systems, so it is easy for VxWorks developers to integrate Yaffs and integrate it with their normal workflow.</p>
<p>As mentioned above, Yaffs-for-VxWorks is a wrapped version of YDI. That means all the testing and experience of using YDI since 2002 is incorporated into Yaffs-for-VxWorks.</p>
<p>Yaffs is already supported in u-boot, so if you're using u-boot as a boot loader then there is already seamless support for Yaffs file system access between the boot loader and VxWorks.</p>
<p>Some organizations have developed their own VxWorks wrappers for Yaffs, but using the Yaffs-for-VxWorks wrapper saves a lot of integration and testing effort.</p>
<p>Once the Yaffs-for-VxWorks file system code is loaded into the kernel, flash devices are added using yaffs_devAdd(). They are then available in the VxWorks file system for access just like any other files in the system.</p>
<p><img alt="Yaffs and VxWorks conceptual relationships" src="/sites/yaffs.net/files/images/yaffs-vxworks.png" /></p>
<p>&nbsp;</p>
<h2>6 Yaffs-for-VxWorks code</h2>
<p>Yaffs-for-VxWorks is supplied as a VxWorks Downloadable Kernel Module (DKM) project with full source code. This can then be modifies into a BSP layer or library and compiled directly into the kernel.</p>
<p>The code comprises Yaffs Direct Interface (YDI) plus two wrapper files:</p>
<ul>
<li>yaffs_drv.c: This file does all the iosLib interfacing (ie. plugs Yaffs in as a VxWorks file system and plugs in the flash devices as file system devices. This file provides one externally visible function call: yaffs_devAdd() which allows Yaffs devices (ie. Flash drivers) to be plugged in.</li>
<li>yaffx_vx_glue.c: This file provides all the OS resources that Yaffs needs from VxWorks. For example, it initialises a semaphore and does any error code routing.</li>
</ul>
<p>In addition, if the Yaffs filesystem driver is build as a DKM, a file called yaffs_dkm.c provides the dummy DKM start() function.</p>
<p>The code is provided as a DKM project. This includes the specification of the DEFINES needed to compile Yaffs under VxWorks. If the code is moved out of the DKM then it is important to make sure the correct DEFINES are set up.</p>
<h2>7 Example Simulated Flash Driver</h2>
<p>The Yaffs-for-VxWorks package provides an example Yaffs device that runs on a RAM simulator. This allows the file system to be tested in a simulation target without flash memory (eg the VxWorks simulator). This also provides an example for how to develop a flash driver and plug it in to Yaffs.</p>
<h2>8 Example Real Time Process(RTP)</h2>
<p>An example RTP is provided that performs some basic file system operations and demonstrates a working filesystem.</p>
<p>This RTP uses standard file system calls (open(), read(), write()...) demonstrating that the Yaffs-for-VxWorks layer is operating as a native file system.</p>
<h2>9 Integrating a Flash Device</h2>
<p>Integrating a flash device is a relatively straight-forward process.</p>
<p>The device is set up as a yaffs_device structure, which is then installed into Yaffs by calling the yaffs_devAdd() function.</p>
<p>The NAND simulator can serve as an example for how to do this. The following snippet outlines the requirements. For a better description of the params and drv sub-structures refer to <a href="http://www.yaffs.net/yaffs-tuning-and-configuration">http://www.yaffs.net/yaffs-tuning-and-configuration</a>.</p>
<p>&nbsp;</p>
<p><code>struct yaffs_dev *yramsim_CreateRamSim(...)<br />
{<br />
...<br />
&nbsp; dev = malloc(sizeof(*dev));<br />
...<br />
&nbsp; /* First set everything to NULL. */<br />
&nbsp; memset(dev, 0, sizeof(*dev));<br />
&nbsp;<br />
&nbsp; /*&nbsp;<br />
&nbsp; &nbsp;* There are three sections to the yaffs_dev structure<br />
&nbsp; &nbsp;* that needs to be initialised:<br />
&nbsp; &nbsp;* * The params sub-structure which are all the control<br />
&nbsp; &nbsp;* parameters.<br />
&nbsp; &nbsp;* * The drv sub-structure which holds the driver functions.<br />
&nbsp; &nbsp;* * The context which holds a private pointer (used to hold a<br />
&nbsp; &nbsp;* driver context).<br />
&nbsp; &nbsp;*/<br />
&nbsp; p = &amp;dev-&gt;param;<br />
&nbsp; p-&gt;name = strdup(name);<br />
&nbsp; p-&gt;start_block = start_block;<br />
&nbsp; p-&gt;end_block = end_block;<br />
&nbsp; p-&gt;total_bytes_per_chunk = DATA_SIZE;<br />
&nbsp; p-&gt;spare_bytes_per_chunk= SPARE_SIZE;<br />
&nbsp; p-&gt;chunks_per_block = PAGES_PER_BLOCK;<br />
&nbsp; p-&gt;n_reserved_blocks = 2;<br />
&nbsp; p-&gt;use_nand_ecc = 1;<br />
&nbsp; p-&gt;inband_tags = 0;<br />
&nbsp; p-&gt;is_yaffs2 = 1;<br />
&nbsp;<br />
&nbsp; d= &amp;dev-&gt;drv;<br />
&nbsp; d-&gt;drv_initialise_fn = yramsim_initialise;<br />
&nbsp; d-&gt;drv_deinitialise_fn = yramsim_deinitialise;<br />
&nbsp; d-&gt;drv_read_chunk_fn = yramsim_rd_chunk;<br />
&nbsp; d-&gt;drv_write_chunk_fn = yramsim_wr_chunk;<br />
&nbsp; d-&gt;drv_erase_fn = yramsim_erase;<br />
&nbsp; d-&gt;drv_check_bad_fn = yramsim_check_block_bad;<br />
&nbsp; d-&gt;drv_mark_bad_fn = yramsim_mark_block_bad;<br />
&nbsp;<br />
&nbsp; dev-&gt;driver_context= (void *)sim;<br />
&nbsp;<br />
&nbsp; return dev;<br />
}<br />
&nbsp;<br />
&nbsp;<br />
void start(void)<br />
{<br />
&nbsp; int result;<br />
&nbsp; struct yaffs_dev *dev;<br />
&nbsp;<br />
&nbsp; printf("Yaffs RAMSIM started\n");<br />
&nbsp;<br />
&nbsp; /* Create and add a RAM simulator device.<br />
&nbsp; &nbsp;* To add a different sort of device, set up the device<br />
&nbsp; &nbsp;* and call yaffs_devAdd.<br />
&nbsp; &nbsp;*&nbsp;<br />
&nbsp; &nbsp;*/<br />
&nbsp; dev = yramsim_CreateRamSim("/yramsim", 0, 400, 0, 399);<br />
&nbsp; printf("device is %p\n", dev);<br />
&nbsp;<br />
&nbsp; if (dev) {<br />
&nbsp; result = yaffs_devAdd(dev);<br />
&nbsp; printf("yaffs_devAdd() returned %d\n", result);<br />
&nbsp; printf("yaffs RAM simulator now available in file system as %s",<br />
&nbsp; dev-&gt;param.name);<br />
&nbsp;<br />
}<br />
}</code></p>
<p>&nbsp;</p>
<h2>10 Appendix: Running the examples on the VxWorks simulator</h2>
<p>Once you have built the Yaffs_filesystem_driver and Yaffs_RAMSIM_device projects, you can start up Yaffs on the simulator as follows:</p>
<ol>
<li>Start the simulator.</li>
<li>Load the Yaffs_filesystem_driver DKM by right clicking on the Yaffs_filesystem_driver project, then selecting Run/Debug Kernel Task...</li>
<li>Load the Yaffs_RAMSIM_device DKM by right clicking on the Yaffs_filesystem_driver project, then selecting Run/Debug Kernel Task...</li>
</ol>
<p>At this stage the VxWorks console should look something like:</p>
<pre>
 _________            _________

 \77777777\          /77777777/

  \77777777\        /77777777/

   \77777777\      /77777777/

    \77777777\    /77777777/

     \77777777\   \7777777/

      \77777777\   \77777/              VxWorks 7

       \77777777\   \777/

        \77777777\   \7/     Core Kernel version: 1.0.10.2

         \77777777\   -      Build date: Oct 13 2015 12:10:53

          \77777777\

           \7777777/         Copyright Wind River Systems, Inc.

            \77777/   -                 1984-2015

             \777/   /7\

              \7/   /777\

               -   -------


              Board: SIMLINUX board

     OS Memory Size: 511MB

   ED&amp;R Policy Mode: Deployed

        Debug Agent: Started (always)

    Stop Mode Agent: Not started


Loading symbol table from charlesqcore:/home/charles/WindRiver/workspace/VIP_1/default/vxWorks.sym ...done

-&gt; 

Yaffs file system DKM started

Yaffs flash devices can now be added by calling yaffs_devAdd()

Yaffs RAMSIM started

device is 0x8829e010

Adding Yaffs device 0x8829e010 (/yramsim)

yaffs_devAdd() returned 0

yaffs RAM simulator now available in file system as /yramsim</pre>
<p>&nbsp;</p>
<p>At this stage you should be able to see the yaffs file system is running:</p>
<pre>
-&gt; ls "/yramsim"

/yramsim/lost+found 

value = 0 = 0x0

-&gt; </pre>
<p>&nbsp;</p>
<p>If you have built the yaffs_test project, then try running that. This should show something like:</p>
<p>&nbsp;</p>
<pre>
Start running Yaffs test

…

dump directory from pwd

./lost+found inode 2 length 2048 mode 41B6 directory


fs size: 52297728 (51072k), free 51642368 (50432k), n files 4

write_check_test()

opening a

Open of a returned 3

write_stuff_to_file returned 100000

…

Finished running Yaffs test</pre>
<p>&nbsp;</p>
<p>Do a file listing &nbsp;again will show the file system state after running the test:</p>
<p>&nbsp;</p>
<pre>
-&gt; llr "/yramsim"


Listing Directory /yramsim:

drwxrwxrw-  1 0       0                 2048 Nov 25 14:07 level1/

-rw-rw-rw-  1 0       0                50505 Nov 25 14:07 seek-trunc 

-rw-rw-rw-  1 0       0               123000 Nov 25 14:07 s 

drw-rw-rw-  1 0       0                 2048 Nov 25 14:06 lost+found/


Listing Directory /yramsim/level1:

drwxrwxrw-  1 0       0                 2048 Nov 25 14:07 level2/


Listing Directory /yramsim/level1/level2:

drwxrwxrw-  1 0       0                 2048 Nov 25 14:07 level3/


Listing Directory /yramsim/level1/level2/level3:

drwxrwxrw-  1 0       0                 2048 Nov 25 14:07 level4/


Listing Directory /yramsim/level1/level2/level3/level4:


Listing Directory /yramsim/lost+found:

value = 0 = 0x0</pre>
<p>&nbsp;</p>
</div>
      
  </div>

</article>


  </div>

              </section>

                </div>
  </div>

      <footer class="footer container" role="contentinfo">
        <div class="primary_footer row">
            <div class="col-sm-3">
                  <div class="region region-footer-col1">
    <section id="block-yaffs-block-6" class="block block-block-content block-block-content6c2d4b45-4dba-4b2d-8b9f-76701bf27533 clearfix">
  
    

      
            <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<ul class="fa-ul">
<li><i class="fa-li fa fa-phone"></i>+44 (0)1223 811679</li>
<li><i class="fa-li fa fa-envelope"></i><a href="denied:mailto:info@aleph1.co.uk?Subject=Website contact" target="_top">info@aleph1.co.uk</a></li>
</ul>
</div>
      
  </section>


  </div>

            </div>
            <div class="col-sm-3">
                
            </div>
            <div class="col-sm-3">
                
            </div>
            <div class="col-sm-3">
                  <div class="region region-footer-col4">
    <section id="block-footerlegal" class="block block-block-content block-block-content78ab593d-35b6-4772-a141-30216e7fcbb2 clearfix">
  
    

      
            <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<p class="text-align-right">&nbsp;<a href="/legal">Legal &amp; Cookies</a></p>
</div>
      
  </section>

<section id="block-cookieinfo" class="block block-block-content block-block-content4848c58d-90df-4819-81d8-0f9568eeeaac clearfix">
  
    

      
            <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<p class="text-align-justify"><br />
We use <a href="/legal">cookies on this site</a>. By using it, you are giving us consent to set cookies.</p>
</div>
      
  </section>


  </div>

            </div>
        </div>
        <div class = "secondary_footer row">
            <div class="col-sm-12">
                <div class="region region-footer">
    <nav role="navigation" aria-labelledby="block-yaffs-account-menu-menu" id="block-yaffs-account-menu">
            <h2 class="sr-only" id="block-yaffs-account-menu-menu">User account menu</h2>

      
              <ul class="menu nav navbar-nav navbar-right">
                            <li>
        <a href="/user/login" data-drupal-link-system-path="user/login">Log in</a>
                  </li>
        </ul>
  


  </nav>

  </div>

            </div>
        </div>
    </footer>
  
    
    <script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/","scriptPath":null,"pathPrefix":"","currentPath":"node\/479","currentPathIsAdmin":false,"isFront":false,"currentLanguage":"en"},"pluralDelimiter":"\u0003","bootstrap":{"forms_has_error_value_toggle":1,"modal_animation":1,"modal_backdrop":"true","modal_keyboard":1,"modal_show":1,"modal_size":"","popover_enabled":1,"popover_animation":1,"popover_container":"body","popover_content":"","popover_delay":"0","popover_html":0,"popover_placement":"right","popover_selector":"","popover_title":"","popover_trigger":"click","popover_trigger_autoclose":1,"tooltip_enabled":1,"tooltip_animation":1,"tooltip_container":"body","tooltip_delay":"0","tooltip_html":0,"tooltip_placement":"auto left","tooltip_selector":"","tooltip_trigger":"hover"},"ajaxTrustedUrl":{"\/search\/node":true},"user":{"uid":0,"permissionsHash":"aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01"}}</script>
<script src="/sites/default/files/js/js_2l0lF4i9o3aztHULbfajMT_RTqGCEN_lVC8JI48SILw.js"></script>

  </body>
</html>
";s:10:"*version";s:3:"1.0";s:13:"*statusCode";i:200;s:13:"*statusText";s:2:"OK";s:10:"*charset";N;s:23:"*cacheabilityMetadata";O:35:"Drupal\Core\Cache\CacheableMetadata":3:{s:16:"*cacheContexts";a:18:{i:0;s:28:"languages:language_interface";i:1;s:5:"route";i:2;s:32:"route.menu_active_trails:account";i:3;s:29:"route.menu_active_trails:main";i:4;s:30:"route.menu_active_trails:tools";i:5;s:5:"theme";i:6;s:8:"timezone";i:7;s:3:"url";i:8;s:8:"url.path";i:9;s:17:"url.path.is_front";i:10;s:15:"url.path.parent";i:11;s:30:"url.query_args:_wrapper_format";i:12;s:4:"user";i:13;s:21:"user.node_grants:view";i:14;s:16:"user.permissions";i:15;s:10:"user.roles";i:16;s:20:"user.roles:anonymous";i:17;s:24:"user.roles:authenticated";}s:12:"*cacheTags";a:50:{i:0;s:16:"block_content:18";i:1;s:16:"block_content:23";i:2;s:15:"block_content:7";i:3;s:18:"block_content_view";i:4;s:10:"block_view";i:5;s:32:"config:block.block.choosingyaffs";i:6;s:29:"config:block.block.cookieinfo";i:7;s:32:"config:block.block.downloadyaffs";i:8;s:30:"config:block.block.footerlegal";i:9;s:39:"config:block.block.frontimagehighlight2";i:10;s:32:"config:block.block.frontpagehero";i:11;s:39:"config:block.block.frontpageprimeryaffs";i:12;s:33:"config:block.block.mainnavigation";i:13;s:35:"config:block.block.mainnavigation_2";i:14;s:29:"config:block.block.searchform";i:15;s:31:"config:block.block.sitebranding";i:16;s:66:"config:block.block.views_block__highlighted_yaffs_features_block_1";i:17;s:66:"config:block.block.views_block__yaffs_admin_recent_content_block_1";i:18;s:66:"config:block.block.views_block__yaffs_documents_highlights_block_1";i:19;s:56:"config:block.block.views_block__yaffs_user_logos_block_1";i:20;s:37:"config:block.block.yaffs_account_menu";i:21;s:33:"config:block.block.yaffs_block_10";i:22;s:32:"config:block.block.yaffs_block_5";i:23;s:32:"config:block.block.yaffs_block_6";i:24;s:32:"config:block.block.yaffs_block_8";i:25;s:32:"config:block.block.yaffs_block_9";i:26;s:36:"config:block.block.yaffs_breadcrumbs";i:27;s:32:"config:block.block.yaffs_content";i:28;s:29:"config:block.block.yaffs_help";i:29;s:36:"config:block.block.yaffs_local_tasks";i:30;s:33:"config:block.block.yaffs_messages";i:31;s:35:"config:block.block.yaffs_page_title";i:32;s:32:"config:block.block.yaffs_user_21";i:33;s:31:"config:block.block.yaffsinspace";i:34;s:17:"config:block_list";i:35;s:24:"config:color.theme.yaffs";i:36;s:30:"config:filter.format.full_html";i:37;s:29:"config:filter.format.raw_html";i:38;s:22:"config:search.settings";i:39;s:26:"config:system.menu.account";i:40;s:23:"config:system.menu.main";i:41;s:24:"config:system.menu.tools";i:42;s:18:"config:system.site";i:43;s:26:"config:user.role.anonymous";i:44;s:13:"http_response";i:45;s:8:"node:479";i:46;s:9:"node_view";i:47;s:8:"rendered";i:48;s:6:"user:0";i:49;s:6:"user:1";}s:14:"*cacheMaxAge";i:-1;}s:14:"*attachments";a:5:{s:7:"library";a:9:{i:0;s:14:"core/html5shiv";i:1;s:11:"system/base";i:2;s:15:"bootstrap/theme";i:3;s:20:"yaffs/global-styling";i:4;s:23:"yaffs/bootstrap-scripts";i:5;s:19:"yaffs/yaffs-helpers";i:6;s:17:"bootstrap/popover";i:7;s:17:"bootstrap/tooltip";i:8;s:50:"environment_indicator/drupal.environment_indicator";}s:9:"html_head";a:22:{i:0;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:5:"title";s:7:"content";s:64:"Yaffs for VxWorks | Yaffs - A Flash File System for embedded use";}}i:1;s:5:"title";}i:1;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:13:"news_keywords";s:7:"content";s:17:"Flash File System";}}i:1;s:13:"news_keywords";}i:2;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:11:"description";s:7:"content";s:499:"The purpose of this document is to describe the Yaffs-on-VxWorks wrapper and provide sufficient information to port Yaffs to the VxWorks BSP. It assumes a working knowledge of VxWorks.
It does not describe the inner workings of Yaffs, and study of other Yaffs documents is recommended. Documents shown below in Italics will be found at http://yaffs.net/documents . . .
The source and the definitive version of this document can be found in our git repository, together with other Yaffs documents.";}}i:1;s:11:"description";}i:3;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:8:"abstract";s:7:"content";s:352:"Yaffs (Yet Another Flash File System) is an open-source file system specifically designed to be fast, robust and suitable for embedded use with NAND and NOR Flash. It is widely used with Linux, RTOSs, or no OS at all, in consumer devices and critical infrastructure. It is available under GNU Public License, GPL, or on commercial terms from Aleph One.";}}i:1;s:8:"abstract";}i:4;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:8:"keywords";s:7:"content";s:82:"flash File System, flash, file System, flash storage, NAND flash, NOR flash, Yaffs";}}i:1;s:8:"keywords";}i:5;a:2:{i:0;a:3:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:1:{s:7:"charset";s:5:"utf-8";}s:7:"#weight";i:-1000;}i:1;s:24:"system_meta_content_type";}i:6;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:9:"Generator";s:7:"content";s:33:"Drupal 8 (https://www.drupal.org)";}}i:1;s:21:"system_meta_generator";}i:7;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:15:"MobileOptimized";s:7:"content";s:5:"width";}}i:1;s:15:"MobileOptimized";}i:8;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:16:"HandheldFriendly";s:7:"content";s:4:"true";}}i:1;s:16:"HandheldFriendly";}i:9;a:2:{i:0;a:2:{s:4:"#tag";s:4:"meta";s:11:"#attributes";a:2:{s:4:"name";s:8:"viewport";s:7:"content";s:37:"width=device-width, initial-scale=1.0";}}i:1;s:8:"viewport";}i:10;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:125:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansRegular-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1151";}i:11;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:124:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansItalic-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1152";}i:12;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:122:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansBold-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1153";}i:13;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:123:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifBold-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1149";}i:14;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:129:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifBoldItalic-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1150";}i:15;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:125:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifItalic-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1148";}i:16;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:126:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSerifRegular-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1147";}i:17;a:2:{i:0;a:3:{s:5:"#type";s:8:"html_tag";s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:10:"stylesheet";s:4:"href";s:128:"https://yaffs.net/sites/default/files/fontyourface/fontsquirrel/LiberationSansBoldItalic-fontfacekit/fontyourface-stylesheet.css";s:5:"media";s:3:"all";}}i:1;s:21:"fontsquirrel-api-1154";}i:18;a:2:{i:0;a:2:{s:4:"#tag";s:4:"link";s:11:"#attributes";a:3:{s:3:"rel";s:13:"shortcut icon";s:4:"href";s:38:"/sites/default/files/yaffs_favicon.png";s:4:"type";s:9:"image/png";}}i:1;s:67:"html_head_link:shortcut icon:/sites/default/files/yaffs_favicon.png";}i:19;a:2:{i:0;a:2:{s:4:"#tag";s:4:"link";s:11:"#attributes";a:2:{s:3:"rel";s:9:"canonical";s:4:"href";s:24:"/documents/yaffs-vxworks";}}i:1;s:49:"html_head_link:canonical:/documents/yaffs-vxworks";}i:20;a:2:{i:0;a:2:{s:4:"#tag";s:4:"link";s:11:"#attributes";a:2:{s:3:"rel";s:9:"shortlink";s:4:"href";s:9:"/node/479";}}i:1;s:34:"html_head_link:shortlink:/node/479";}i:21;a:2:{i:0;a:2:{s:4:"#tag";s:4:"link";s:11:"#attributes";a:2:{s:3:"rel";s:8:"revision";s:4:"href";s:24:"/documents/yaffs-vxworks";}}i:1;s:48:"html_head_link:revision:/documents/yaffs-vxworks";}}s:12:"placeholders";a:0:{}s:14:"drupalSettings";a:5:{s:4:"path";a:7:{s:7:"baseUrl";s:1:"/";s:10:"scriptPath";N;s:10:"pathPrefix";s:0:"";s:11:"currentPath";s:8:"node/479";s:18:"currentPathIsAdmin";b:0;s:7:"isFront";b:0;s:15:"currentLanguage";s:2:"en";}s:15:"pluralDelimiter";s:1:"";s:9:"bootstrap";a:25:{s:28:"forms_has_error_value_toggle";i:1;s:15:"modal_animation";i:1;s:14:"modal_backdrop";s:4:"true";s:14:"modal_keyboard";i:1;s:10:"modal_show";i:1;s:10:"modal_size";s:0:"";s:15:"popover_enabled";i:1;s:17:"popover_animation";i:1;s:17:"popover_container";s:4:"body";s:15:"popover_content";s:0:"";s:13:"popover_delay";s:1:"0";s:12:"popover_html";i:0;s:17:"popover_placement";s:5:"right";s:16:"popover_selector";s:0:"";s:13:"popover_title";s:0:"";s:15:"popover_trigger";s:5:"click";s:25:"popover_trigger_autoclose";i:1;s:15:"tooltip_enabled";i:1;s:17:"tooltip_animation";i:1;s:17:"tooltip_container";s:4:"body";s:13:"tooltip_delay";s:1:"0";s:12:"tooltip_html";i:0;s:17:"tooltip_placement";s:9:"auto left";s:16:"tooltip_selector";s:0:"";s:15:"tooltip_trigger";s:5:"hover";}s:14:"ajaxTrustedUrl";a:1:{s:12:"/search/node";b:1;}s:4:"user";a:2:{s:3:"uid";i:0;s:15:"permissionsHash";s:64:"aa7fc4c8fb40c7a8665ccd12fea07926dff0f59b9ee3346bc513c6399bee5b01";}}s:11:"http_header";a:3:{i:0;a:3:{i:0;s:4:"Link";i:1;s:43:"</documents/yaffs-vxworks>; rel="canonical"";i:2;b:0;}i:1;a:3:{i:0;s:4:"Link";i:1;s:28:"</node/479>; rel="shortlink"";i:2;b:0;}i:2;a:3:{i:0;s:4:"Link";i:1;s:42:"</documents/yaffs-vxworks>; rel="revision"";i:2;b:0;}}}}