annotate packages/fs/yaffs/current/doc/yaffs.sgml @ 428:a386ed10401a ecos

Drop in eCos bridge work
author Ross Younger <wry@ecoscentric.com>
date Fri, 14 May 2010 17:01:32 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
1 <!-- {{{ Banner -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
2
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
3 <!-- =============================================================== -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
4 <!-- -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
5 <!-- yaffs.sgml -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
6 <!-- -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
7 <!-- Documentation for the eCos port of the YAFFS filesystem. -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
8 <!-- -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
9 <!-- =============================================================== -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
10 <!-- ####ECOSDOCCOPYRIGHTBEGIN#### -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
11 <!-- =============================================================== -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
12 <!-- Copyright (C) 2009 eCosCentric Ltd. -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
13 <!-- This material may be distributed only subject to the terms -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
14 <!-- and conditions set forth in the Open Publication License, v1.0 -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
15 <!-- or later (the latest version is presently available at -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
16 <!-- http://www.opencontent.org/openpub/) -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
17 <!-- Distribution of the work or derivative of the work in any -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
18 <!-- standard (paper) book form is prohibited unless prior -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
19 <!-- permission obtained from the copyright holder -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
20 <!-- =============================================================== -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
21 <!-- ####ECOSDOCCOPYRIGHTEND#### -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
22 <!-- =============================================================== -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
23 <!-- #####DESCRIPTIONBEGIN#### -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
24 <!-- -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
25 <!-- Author(s): wry -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
26 <!-- Date: 2009-05-28 -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
27 <!-- -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
28 <!-- ####DESCRIPTIONEND#### -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
29 <!-- =============================================================== -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
30
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
31 <!-- }}} -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
32
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
33 <!-- ### Uncomment to make a standalone book:
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
34 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
35 <book id="fs-yaffs-book">
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
36 <bookinfo>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
37 <title>The YAFFS filesystem for eCos</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
38 <copyright><year>2009</year><holder>eCosCentric Limited</holder></copyright>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
39 <legalnotice>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
40 <title>Documentation licensing terms</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
41 <para>This material may be distributed only subject to the terms
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
42 and conditions set forth in the Open Publication License, v1.0
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
43 or later (the latest version is presently available at
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
44 <ulink url="http://www.opencontent.org/openpub/">http://www.opencontent.org/openpub/</ulink>).
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
45 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
46 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
47 Distribution of the work or derivative of the work in any
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
48 standard (paper) book form is prohibited unless prior
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
49 permission is obtained from the copyright holder.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
50 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
51 </legalnotice>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
52 </bookinfo>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
53 ! /### -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
54
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
55 <part id="fs-yaffs">
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
56 <title>The YAFFS filesystem</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
57
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
58 <chapter id="yaffs-overview-c">
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
59 <title>What is YAFFS?</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
60
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
61 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
62 YAFFS is a filesystem for NAND flash chips.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
63 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
64
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
65 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
66 YAFFS is accessed through the FILEIO package which presents a standard
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
67 POSIX compatible IO interface through which applications use standard
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
68 open(), read(), write() and close() calls.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
69 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
70
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
71 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
72 YAFFS is a <emphasis>journalling</emphasis> filesystem
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
73 with <emphasis>wear-levelling</emphasis>. It is
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
74 particularly suited to NAND flash parts, having been
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
75 designed with their unique properties in mind.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
76 The use of traditional filesystems (FAT, ext2, etc) which do not have
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
77 these features is not recommended on such chips because their design
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
78 requires the use of fixed address on the underlying hardware.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
79 Such behaviour causes flash sectors to wear out, the consequence of
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
80 which would typically be to cause the whole device to become unbootable.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
81 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
82
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
83 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
84 YAFFS also provides a high degree of robustness, which is usually
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
85 a requirement of embedded devices.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
86 A power failure or other crash can leave a traditional filesystem
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
87 in an inconsistent state which is often difficult to repair,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
88 especially in the field.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
89 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
90
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
91 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
92 YAFFS can also be built into RedBoot, which allows you to store
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
93 application images on NAND flash and boot them with
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
94 RedBoot's usual flexible scripting system.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
95 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
96
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
97 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
98 For more information about NAND flash chips,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
99 how they differ from NOR flash parts
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
100 and other ways to access them, refer to the documentation for the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
101 <xref linkend="io-nand-overview" endterm="io-nand-short">.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
102 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
103
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
104 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
105 For more information about YAFFS itself, refer to
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
106 <ulink url="http://www.yaffs.net/">yaffs.net</ulink>.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
107 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
108 </chapter>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
109
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
110 <chapter id="yaffs-getstarted"><title>Getting started with YAFFS</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
111
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
112 <sect1 id="yaffs-licensing"><title>Licensing considerations</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
113 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
114 Before you can use YAFFS, you must accept its license.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
115 <emphasis>YAFFS is not covered by the standard eCos license.</emphasis>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
116 You will be reminded of your license to use YAFFS when you install it.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
117 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
118
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
119 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
120 Most users will only have access to YAFFS under the GNU GPL.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
121 This costs nothing to license. However this usually means that if you ever
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
122 distribute your application,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
123 you must do so under the GPL.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
124 This requires you to publish or otherwise make all of your application,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
125 eCos and everything else you link with it available as source code.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
126 For full details refer to the text of the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
127 <ulink url="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
128 (v2)</ulink>.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
129 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
130
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
131 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
132 If you cannot accept the restrictions and obligations of the GPL,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
133 YAFFS for eCos is available under a proprietary license, for a fee.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
134 Details are available on request from
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
135 <ulink url="http://www.ecoscentric.com/">eCosCentric</ulink> or
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
136 <ulink url="http://www.yaffs.net/yaffs-licences">Aleph One</ulink>.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
137 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
138 </sect1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
139
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
140 <sect1 id="yaffs-install"><title>Installation</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
141 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
142 YAFFS is supplied as an EPK (eCos Package) file.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
143 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
144
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
145 <sect2 id="yaffs-install-configtool"><title>Installation via the eCos
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
146 Configuration Tool</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
147 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
148 <orderedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
149 <listitem><para>Open up the eCos Configuration Tool.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
150 <listitem><para>Open up the <emphasis>Administration</emphasis> dialog,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
151 from the <emphasis>Tools</emphasis> menu.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
152 <listitem><para>Press the <emphasis>Add</emphasis> button.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
153 <listitem><para>A file browser windows opens. Navigate to the YAFFS EPK file.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
154 <listitem><para>The License screen shows. You must accept the license
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
155 in order to install the package. Press Yes if you do.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
156 </orderedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
157 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
158 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
159
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
160 <sect2 id="yaffs-install-commandline"><title>Installing from the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
161 command-line</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
162 <para> Advanced users may alternatively use the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
163 <filename>ecosadmin.tcl</filename> tool from the command line. You
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
164 will be prompted to accept the license at the appropriate time during
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
165 the procedure.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
166 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
167
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
168 <programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
169 tclsh $ECOS_REPOSITORY/ecosadmin.tcl add yaffs-v1_2_3.epk
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
170 </programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
171 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
172 </sect1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
173
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
174 <sect1 id="yaffs-config-build"><title>Configuration and Building</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
175 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
176 After installing the EPK, YAFFS is added to your eCos repository
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
177 and is configured and built in the normal way.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
178 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
179
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
180 <sect2 id="yaffs-pkg-deps"><title>Package dependencies</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
181 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
182 To link YAFFS into your application,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
183 add <filename>CYGPKG_FS_YAFFS</filename> to your eCos
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
184 configuration in the normal way, either using the eCos Configuration Tool
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
185 (<emphasis>Packages</emphasis> dialog on the <emphasis>Build</emphasis>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
186 menu), or the <filename>ecosconfig</filename> command-line tool.</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
187
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
188 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
189 You will also need to add <filename>CYGPKG_IO_NAND</filename> and
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
190 <filename>CYGPKG_IO_FILEIO</filename> to your configuration if they
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
191 are not already present.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
192 Your platform HAL should supply packages for all NAND device(s) present.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
193 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
194
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
195 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
196 If you started with a smaller template than <emphasis>default</emphasis>,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
197 you may also need to add some of the following:</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
198 <itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
199 <listitem><para><filename>CYGPKG_LIBC_STDLIB</filename></para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
200 <listitem><para><filename>CYGPKG_LIBC_STRING</filename> </para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
201 <listitem><para><filename>CYGPKG_MEMALLOC</filename> or something else
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
202 which provides <filename>CYGINT_ISO_MALLOC</filename></para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
203 <listitem><para><filename>CYGPKG_LIBC_I18N</filename> or something else
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
204 which provides <filename>CYGINT_ISO_CTYPE</filename></para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
205 </itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
206 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
207
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
208 <sect2 id="yaffs-pkg-options"><title>Configuration options</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
209 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
210 YAFFS provides a number of package options, including tuning parameters.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
211 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
212
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
213 <variablelist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
214 <varlistentry><term><constant>CYGPKG_FS_YAFFS_CFLAGS_ADD</constant></term>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
215 <term><constant>CYGPKG_FS_YAFFS_CFLAGS_REMOVE</constant></term><listitem><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
216 These settings allow specific build options to be added to or removed from the CFLAGS
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
217 list when building YAFFS.</para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
218 <varlistentry><term><constant>CYGSEM_FS_YAFFS_CACHE_SHORT_NAMES</constant></term><listitem><para>If
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
219 set, caches files' short names in RAM. This consumes more RAM but
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
220 improves performance.</para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
221 <varlistentry><term><constant>CYGPKG_FS_YAFFS_RET_DIRENT_DTYPE</constant></term><listitem><para>Controls
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
222 whether YAFFS supports setting the <structfield>d_type</structfield>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
223 field in a <structname>struct dirent</structname>. If you don't need
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
224 this, leave it switched off to save a little code size.</para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
225 <varlistentry><term><constant>CYGNUM_FS_YAFFS_RESERVED_BLOCKS</constant></term><listitem><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
226 The number of blocks to keep in reserve to allow for garbage collection
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
227 and block failures. The recommended value is 5, but you can tune it
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
228 for performance. <emphasis>This setting is a global default and may be
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
229 changed by a mount-time option.</emphasis></para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
230 <varlistentry><term><constant>CYGNUM_FS_YAFFS_SHORTOP_CACHES</constant></term><listitem><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
231 The number of page cache entries to use. Values of 10 to 20 are
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
232 recommended; increasing the number consumes more RAM, and 0 disables
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
233 it altogether. <emphasis>This setting is a global default and may be
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
234 changed by a mount-time option.</emphasis></para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
235 <varlistentry><term><constant>CYGNUM_FS_YAFFS_TRACEMASK</constant></term><listitem><para>This
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
236 is a 32-bit bitfield which controls diagnostic output. The bit definitions
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
237 are found in <filename>yportenv.h</filename>; they are only useful if
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
238 you are debugging YAFFS itself.</para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
239 <varlistentry><term><constant>CYGNUM_FS_YAFFS_TEMP_BUFFERS</constant></term>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
240 <listitem><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
241 YAFFS requires temporary buffers in many places throughout the code.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
242 To avoid the overhead of a dynamic malloc every time, a number of
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
243 buffers are preallocated at mount time. This setting controls how many;
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
244 should it not prove enough, YAFFS will call malloc on demand as required.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
245 The default setting is 6; most users will not need to change it.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
246 </para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
247 <varlistentry><term><constant>CYGSEM_FS_YAFFS_SMALLPAGE_MODE</constant></term>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
248 <listitem><para>This option only affects behaviour on so-called "small page" NAND devices
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
249 (those whose pages are 512 bytes long).
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
250 Such devices do not have enough space in their Out Of Band area to
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
251 store a full set of YAFFS metadata tags. There are two ways to work
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
252 around this: <itemizedlist><listitem><para><constant>YAFFS2</constant> mode -
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
253 the default - uses regular tags, but at
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
254 a price: it steals 16 bytes from the available space per page to store
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
255 them. <emphasis>This reduces the apparent available
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
256 size of your filesystem by 1/32!</emphasis></para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
257 <listitem><para><constant>YAFFS1</constant> mode places a smaller tagset
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
258 in the OOB area, but with a different side-effect: whenever a page is
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
259 deleted, one byte of the tags area has to be rewritten. Some devices
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
260 forbid rewrite-without-erase in this way, so it may not be safe for you
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
261 to use this option. <emphasis>You must refer to the spec sheet for the chip on
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
262 your board before selecting this option!</emphasis></para></listitem></itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
263 </para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
264 <varlistentry><term><constant>CYGSEM_FS_YAFFS_OMIT_YAFFS2_CODE</constant></term><listitem><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
265 This causes all YAFFS2 code to be omitted from the build. This option only makes sense when
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
266 all the devices on which YAFFS is to be used are small-page and operating in YAFFS1 mode.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
267 <note><para>There is no corresponding option to omit YAFFS1 code, because that code is only
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
268 compiled when <constant>CYGSEM_FS_YAFFS_SMALLPAGE_MODE</constant> is set to YAFFS1. </para></note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
269 </para></listitem></varlistentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
270 </variablelist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
271 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
272 </sect1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
273
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
274 <sect1 id="yaffs-using"><title>Using YAFFS</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
275 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
276 YAFFS appears in the eCos filesystem table.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
277 This means that you can mount a filesystem in the standard Unix-like way,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
278 then interact with it with calls to open, read, etc.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
279 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
280
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
281 <sect2 id="yaffs-mounting"><title>Mounting a filesystem</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
282
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
283 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
284 Before you can use a filesystem, it must be <emphasis>mounted</emphasis>.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
285 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
286
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
287 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
288 A NAND device is logically organised as one or more
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
289 <emphasis>partitions</emphasis>, which are
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
290 usually set up by the relevant platform HAL.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
291 You need to tell the mount command
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
292 which device and partition you wish to access. In the following example,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
293 we are mounting partition 0 of the <emphasis>onboard</emphasis> NAND device.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
294 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
295 <!-- FIXME: Update if partition naming is changed. -->
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
296
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
297 <programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
298 rv = mount("onboard/0", "/nand", "yaffs");
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
299 </programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
300
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
301 <note><para>The <emphasis>device</emphasis> argument to the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
302 <function>mount</function> call is a NAND-specific device name, not
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
303 an entry in /dev.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
304 Refer to the documentation for your platform HAL for details of how
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
305 the NAND device(s) are named, and to the NAND library documentation
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
306 for details of how partitions are addressed.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
307 </para></note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
308
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
309 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
310 You can, if you wish, make the filesystem mounting automatic at
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
311 static constructor time with the MTAB_ENTRY macro. (Your platform
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
312 HAL may already do this; check it carefully.)
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
313 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
314
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
315 <programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
316 MTAB_ENTRY(my_nand, "/nand", "yaffs", "onboard/0", "", 0);
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
317 </programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
318
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
319 <note><para>This example is for eCosPro. In eCos, the MTAB_ENTRY macro
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
320 takes only four arguments.</para></note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
321
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
322 <sect3 id="yaffs-mount-options"><title>Mount-time options</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
323 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
324 eCosPro allows various options to be passed to a filesystem at mount time,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
325 by combining them with the filesystem argument in a particular format.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
326 YAFFS understands the following options:
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
327 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
328
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
329 <itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
330 <listitem><para><constant>reserved</constant>=&lt;int&gt; The number of
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
331 physical NAND blocks to reserve for garbage collection and block failures
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
332 (minimum 2). The default is set in CDL as
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
333 <constant>CYGNUM_FS_YAFFS_RESERVED_BLOCKS</constant>.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
334 <listitem><para><constant>caches</constant>=&lt;int&gt; The number of
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
335 page cache entries to use.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
336 Values of 10 to 20 are recommended.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
337 The default is set in CDL as
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
338 <constant>CYGNUM_FS_YAFFS_SHORTOP_CACHES</constant>.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
339 <listitem><para><constant>skip-checkpoint-read</constant> Instructs YAFFS
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
340 to not attempt to reload the filesystem from a checkpoint, if one exists.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
341 In other words, this option forces a full filesystem scan whether or not
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
342 one is necessary.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
343 </itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
344 </sect3>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
345 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
346
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
347 <sect2 id="yaffs-sync"><title>Data flushing</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
348 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
349 YAFFS operates a cacheing layer in order to save undue wear on the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
350 NAND chip if many small writes are performed. Because of this,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
351 if you wish to ensure that any data written to a still-open file has
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
352 been fully flushed, you must make a synchronisation request. This is
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
353 done with the <function>fsync</function> function, which takes as its
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
354 argument the file descriptor of the file you wish to synchronise.</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
355 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
356
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
357 <sect2 id="yaffs-checkpointing"><title>Checkpointing</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
358 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
359 When mounting a filesystem, YAFFS has to scan the NAND chip to recreate
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
360 its internal state. This can be a slow process, but is made much
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
361 faster if there is a valid <emphasis>checkpoint</emphasis>.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
362 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
363
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
364 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
365 A checkpoint is written out automatically when you unmount the filesystem.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
366 At any other time, you can manually force a checkpoint to be written
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
367 with one of the following functions:
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
368 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
369
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
370 <itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
371 <listitem><para><function>cyg_fs_fssync(mountpoint)</function>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
372 synchronises a filesystem (automatically called on umount)</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
373 <listitem><para><function>sync</function> synchronises all mounted
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
374 filesystems.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
375 </itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
376
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
377 <note><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
378 A checkpoint becomes invalid as soon as there have been any other writes
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
379 to the filesystem. Finding a good place to sync is necessarily dependent
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
380 on your application logic.</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
381 </note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
382 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
383
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
384 <sect2 id="yaffs-limitations"><title>Limitations</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
385 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
386 Although YAFFS is a Unix-compatible filesystem, the eCos port does not
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
387 provide support for the full range of Unix attributes.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
388 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
389 <itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
390 <listitem><para> eCos does not check file or directory permissions;
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
391 everything it creates is given fixed user and group IDs of zero and
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
392 standard permissions (files rw-r--r--, directories rwxr-xr-x).</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
393 <listitem><para> It is not currently possible to change file ownership
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
394 or permissions.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
395 <listitem><para> It is not currently possible to create symbolic links,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
396 FIFOs (named pipes), sockets or device nodes.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
397 <listitem><para> Hard links to files work in the expected way. Hard
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
398 links to directories are forbidden.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
399 <listitem><para> It is not possible to unlink the '.', '..' or
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
400 'lost+found' special directories.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
401 </itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
402
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
403 <note><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
404 If you will be sharing a YAFFS filesystem between eCos and some other
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
405 operating system, you are advised to carefully check the other system's
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
406 definitions of mode (permission) bits and whether any translation may be
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
407 required.</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
408 </note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
409 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
410 </sect1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
411
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
412 <sect1 id="yaffs-mem-reqs"><title>Memory requirements</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
413 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
414 The amount of RAM required by YAFFS to hold its in-memory data structures
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
415 grows with the number of objects (files and directories) in your
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
416 filesystem.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
417 You are recommended to test your application thoroughly to ensure
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
418 that sufficient memory exists for YAFFS to operate with the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
419 most complicated filesystem it is likely to encounter.</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
420
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
421 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
422 If you wish to estimate your RAM usage, the YAFFS author provides the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
423 following calculation:</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
424
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
425 <itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
426 <listitem><para> The partition itself requires a yaffs_DeviceStruct of 3608
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
427 bytes.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
428 <listitem><para> If CYGNUM_FS_YAFFS_SHORTOP_CACHES is enabled, each
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
429 is the size of a NAND page plus 28 bytes.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
430 <listitem><para> Every object (file, directory or hardlink) in the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
431 filesystem takes a yaffs_Object struct, which is 124 bytes.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
432 <listitem><para> Every page of every file requires a Tnode entry, but
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
433 they are always allocated in groups of 16 at a time.</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
434 <itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
435 <listitem><para>The size of a single Tnode entry is the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
436 number of <emphasis>bits</emphasis> required to number all the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
437 pages in the NAND partition YAFFS is using, numbering from
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
438 <emphasis>one</emphasis>; this is rounded up to a multiple of 2,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
439 and has an absolute minimum of sixteen bits.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
440 <listitem><para>For example: on a partition with 65536 pages,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
441 seventeen bits are required for the numbering, which round up to
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
442 18. Therefore each file takes 288 bits (36 bytes) per group of Tnodes,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
443 and one group of Tnodes will cover up to sixteen pages of data.</para></listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
444 </itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
445 </listitem>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
446 </itemizedlist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
447
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
448 <note><para><emphasis>Actual memory consumption will be slightly
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
449 higher than suggested by the above.</emphasis> This arises from the
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
450 tree structure holding the Tnodes, overheads from the heap itself,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
451 and so on.</para></note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
452
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
453 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
454 YAFFS calls the standard <function>malloc</function> function to allocate
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
455 memory and <function>free</function> to release it. Normally, the eCos
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
456 heap occupies all spare RAM not needed for the program, its static
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
457 data or the stacks. Therefore, most applications will not need to do
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
458 anything special beyond ensuring there is enough spare RAM available on
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
459 the platform.</para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
460
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
461 <tip><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
462 If you wish to experiment with restricted-size heaps to determine
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
463 much memory your application actually uses under YAFFS,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
464 you may find the option
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
465 <constant>CYGSEM_MEMALLOC_INVOKE_OUT_OF_MEMORY</constant> of use.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
466 </para></tip>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
467
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
468 <sect2 id="yaffs-mem-reqs-example"><title>Worked example</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
469 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
470 Consider a YAFFS filesystem hosted by a NAND partition with 65536 pages,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
471 each of size 2k, using the default setting of ten short-op caches.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
472 On this filesystem we shall store 10000 files each of
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
473 size 10240 bytes, hence each requires a single group of Tnodes.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
474 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
475
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
476 <table frame=all pgwide=0><title>YAFFS RAM use worked example</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
477 <tgroup cols=2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
478 <colspec colname=c1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
479 <colspec colname=c2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
480 <thead><row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
481 <entry>Consumer</entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
482 <entry>RAM used (bytes)</entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
483 </row></thead>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
484 <tfoot><row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
485 <entry>Total</entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
486 <entry align=right> 1,624,368 </entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
487 </row></tfoot>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
488 <tbody>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
489 <row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
490 <entry> yaffs_DeviceStruct </entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
491 <entry align=right> 3,608 </entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
492 </row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
493 <row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
494 <entry> Short-op caches @ 10 x (2048+28)</entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
495 <entry align=right> 20,760 </entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
496 </row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
497 <row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
498 <entry> yaffs_Objects @ 10,000 x 124 </entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
499 <entry align=right> 1,240,000 </entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
500 </row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
501 <row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
502 <entry> Tnode groups @ 10,000 x 36 <emphasis>(see above)</emphasis></entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
503 <entry align=right> 360,000 </entry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
504 </row>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
505 </tbody>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
506 </tgroup>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
507 </table>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
508
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
509 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
510 This example is a close match to the actual consumption measured by
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
511 eCosCentric during testing. (The measured consumption as reported
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
512 by <function>mallinfo</function> was 1,681,112 bytes, which includes
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
513 the heap's own overheads.)
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
514 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
515 </sect2>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
516 </sect1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
517
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
518 <sect1 id="yaffs-testing"><title>Testing</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
519 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
520 YAFFS is supplied with a number of test programs, some of which are have been
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
521 adapted from tests for other filesystems in eCos.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
522 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
523
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
524 <glosslist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
525 <glossentry><glossterm>fops</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
526 This was the first basic test created for the port of the filesystem.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
527 It is believed to exercise all of the code paths (filesystem operations,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
528 file operations and directory operations) within the eCos-YAFFS
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
529 adaptation layer. </para> <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
530 This test was originally intended to run on a synthetic NAND filesystem.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
531 On real NAND chips, it deliberately omits the more stressful routines to
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
532 avoid undue wear on the hardware.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
533 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
534 <glossentry><glossterm>yaffs1</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
535 A number of filesystem edge-case semantic tests, including
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
536 file and directory creation and deletion,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
537 invalid open and rename operations, and
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
538 removing nonexistent files and directories.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
539 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
540 <glossentry><glossterm>yaffs2</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
541 Concurrent multi-threaded filesystem access and consistency checks.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
542 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
543 <glossentry><glossterm>yaffs4</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
544 Semantic and edge-case testing - like yaffs1 - but with long file names.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
545 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
546 <glossentry><glossterm>yaffs5</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
547 Tests that file reading and writing works over reasonably large files
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
548 (up to 1Mbyte) with different I/O chunk sizes. Some operation timings
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
549 are collected and reported, as is the data rate on large files.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
550 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
551 <glossentry><glossterm>yaffs6</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
552 Semantic and edge-case testing - like yaffs1 - but with Cyrillic filenames
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
553 in order to test UTF-8 correctness.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
554 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
555 <glossentry><glossterm>mounttime</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
556 A simple benchmark which repeatedly mounts and unmounts the filesystem
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
557 and measures how long this takes.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
558 You can optionally use the <filename>mkfiles</filename> routine - also
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
559 present in the tests directory - to create many short files so you can
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
560 test performance on a loaded filesystem.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
561 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
562 <glossentry><glossterm>hammer</glossterm><glossdef><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
563 A stress test designed to shake out corner cases.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
564 Repeatedly creates many files of varying sizes from multiple threads
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
565 until the filesystem fills up, then verifies their contents and removes
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
566 them. From time to time, all threads pause and the filesystem is
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
567 unmounted and remounted. </para><para>This test is particularly useful when
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
568 combined with the bad block injection functionality provided by
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
569 the synthetic NAND device. It has been used in this way by eCosCentric to
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
570 thoroughly test this package's stability under error conditions.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
571 <note><para>This test runs forever, until interrupted.</para></note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
572 </para></glossdef></glossentry>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
573 </glosslist>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
574 </sect1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
575 </chapter>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
576
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
577 <chapter id="yaffs-redboot"><title>Using YAFFS with RedBoot</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
578 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
579 It is possible to link YAFFS into RedBoot and use it to boot an
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
580 executable image stored on a NAND array.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
581 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
582
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
583 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
584 This is done by configuring and building RedBoot largely in the normal way.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
585 You will need to add <filename>CYGPKG_FS_YAFFS</filename> and
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
586 <filename>CYGPKG_IO_FILEIO</filename> to your configuration, plus their
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
587 attendant dependencies.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
588 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
589
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
590 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
591 The presence of CYGPKG_IO_FILEIO activates the <filename>fs</filename> series
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
592 of RedBoot commands. The following (edited) transcript illustrates how
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
593 they might
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
594 be used in concert with other RedBoot commands to store an ELF image on
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
595 a NAND partition, load it back and execute:
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
596 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
597
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
598 <programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
599 RedBoot> fs mount -d onboard/0 -t yaffs /nand
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
600 yaffs: restored from checkpoint
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
601 RedBoot> load -r -h my.tftp.ip.address -b %{freememlo} my.image
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
602 Using default protocol (TFTP)
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
603 Raw file loaded 0xa013f000-0xa01554b3, assumed entry at 0xa013f000
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
604 RedBoot> fs write /nand/myimg.elf
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
605 RedBoot> fs list /nand
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
606 1 drwxr-xr-x 0 size 0 .
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
607 1 drwxr-xr-x 0 size 0 ..
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
608 262 -rw-r--r-- 0 size 91316 myimg.elf
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
609 2 drwxr-xr-x 0 size 0 lost+found
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
610 RedBoot> load -m file /nand/myimg.elf
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
611 RedBoot> go
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
612 Hello, NAND world!
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
613 </programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
614
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
615 <note><para>When you command RedBoot to execute an image, it
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
616 first synchronises all mounted filesystems. Therefore,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
617 provided these filesystems support the synchronisation operation
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
618 (which YAFFS does), it is not always necessary to unmount them before
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
619 invoking an image.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
620 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
621 </note>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
622
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
623 <sect1 id="yaffs-rb-mem"><title>Memory considerations under RedBoot</title>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
624 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
625 RedBoot traditionally has very limited requirements for memory management;
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
626 the main need is for there to be free space in RAM at the correct
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
627 (physical) address to load an image before jumping to it.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
628 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
629
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
630 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
631 Introducing YAFFS brings with it not just the need to have dynamically
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
632 allocatable RAM (<filename>CYGPKG_MEMALLOC</filename>), but enough
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
633 to replay the filesystem journal. This must be balanced against the need
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
634 for RAM to load images into.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
635 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
636
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
637 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
638 When the <filename>CYGPKG_MEMALLOC</filename> package is present in
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
639 RedBoot, by default a small (64k) heap is set up so that the maximum RAM
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
640 possible is available for loading images. This is not enough to
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
641 support YAFFS in any circumstances, so the following definition has
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
642 been included in the <filename>yaffs.cdl</filename> file:
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
643 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
644
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
645 <programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
646 requires { CYGPKG_REDBOOT implies (CYGMEM_REDBOOT_WORKSPACE_HEAP_SIZE >= 0x00014000) }
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
647 </programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
648
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
649 <caution><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
650 This declaration only provideds the bare minimum heap required to mount a
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
651 trivial YAFFS filesystem. More will be required for all but the simplest
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
652 of cases and it is recommended that you test for typical use in your
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
653 environment. Refer also to <xref linkend="yaffs-mem-reqs">.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
654 </para></caution>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
655
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
656 <para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
657 It is recommended that, should you wish to make a filesystem usable by
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
658 RedBoot, your platform HAL should make a similar
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
659 declaration in its CDL to establish an appropriate heap size.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
660
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
661 For example, the platform HAL for the EA LPC2468 OEM board - which has
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
662 a 128MB NAND chip on-board - contains the following declaration:
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
663 </para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
664
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
665 <programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
666 requires { (CYGPKG_REDBOOT && CYGPKG_FS_YAFFS) implies (CYGMEM_REDBOOT_WORKSPACE_HEAP_SIZE >= 0x20000) }
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
667 </programlisting>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
668
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
669 <tip><para>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
670 If you wish to experiment with restricted heaps to determine
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
671 much memory your application actually uses under YAFFS,
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
672 you may find the option
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
673 <constant>CYGSEM_MEMALLOC_INVOKE_OUT_OF_MEMORY</constant> of use.
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
674 </para></tip>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
675 </sect1>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
676 </chapter>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
677 </part>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
678
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
679 <!-- ### Uncomment to make a standalone book:
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
680 </book>
a386ed10401a Drop in eCos bridge work
Ross Younger <wry@ecoscentric.com>
parents:
diff changeset
681 /### -->