Update to coding standard document and to a README file.

This commit is contained in:
Gregory Nutt 2017-06-11 10:01:14 -06:00
parent b7ca90a721
commit 40f60d6da5
2 changed files with 54 additions and 9 deletions

View File

@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec">
<i>NuttX C Coding Standard</i>
</font></big></h1>
<p>Last Updated: June 9, 2017</p>
<p>Last Updated: June 11, 2017</p>
</td>
</tr>
</table>
@ -2150,12 +2150,24 @@ x++;
</td></tr>
</table></center>
<p>
<b>Forbidden Multicharacter Forms</b>.
Many operators are expressed as a character in combination with <code>=</code> such as <code>+=</code>, <code>>=</code>, <code>>>=</code>, etc.
Some compilers will accept the <code>=</code> at the beginning or the end of the sequence.
This standard, however, requires that the <code>=</code> always appear last in order to avoid amiguities that may arise if the <code>=</code> were to appear first. For example, <code>a =++ b;</code> could also be interpreted as <code>a =+ +b;</code> or <code>a = ++b</code> all of which are very different.
</p>
<p>
<h2>4.4 <a name="ifthenelse"></a><code>if then else</code> Statement</h2>
<p><b>Coding Standard:</b></p>
<ul>
<li>
<b><code>if</code> separated from <code>&lt;condition&gt;</code></b>.
The <code>if</code> keyword and the <code>&lt;condition&gt;</code> must appear on the same line.
The <code>if</code> keyword and the <code>&lt;condition&gt;</code> must be separated by a single space.
</li>
</li>
<b>Keywords on separate lines</b>.
<code>if &lt;condition&gt;</code> and <code>else</code> must lie on separate lines with nothing else present on the line.
</li>
@ -2185,7 +2197,7 @@ x++;
Use of braces must follow all other standard rules for <a href="#braces">braces and spacing</a>.
</li>
<li>
<b>Exception where there is no blank line</b>.
<b>Exception</b>.
That blank line must also be omitted for certain cases where the <code>if &lt;condition&gt;</code>-<code>else</code> statement is nested within another compound statement; there should be no blank lines between consecutive right braces as discussed in the standard rules for use of <a href="#braces">braces</a>.
</li>
</ul>
@ -2280,6 +2292,11 @@ x++;
<p><b>Coding Standard:</b></p>
<ul>
<li>
<b><code>switch</code> separated from <code>&lt;value&gt;</code></b>.
The <code>switch</code> keyword and the switch <code>&lt;value&gt;</code> must appear on the same line.
The <code>if</code> keyword and the <code>&lt;value&gt;</code> must be separated by a single space.
</li>
<li>
<b>Falling through</b>.
Falling through a case statement into the next case statement is be permitted as long as a comment is included.
@ -2298,6 +2315,14 @@ x++;
<code>break</code> statements are normally indented by two spaces.
When used conditionally with case logic, the placement of the break statement follows normal indentation rules.
</li>
<li>
<b>Followed by a single blank line</b>.
The final right brace that closes the <code>switch &lt;value&gt;</code> statement must be followed by a single blank line.
</li>
<li>
<b>Exception</b>.
That blank line must be omitted for certain cases where the <code>switch &lt;value&gt;</code> statement is nested within another compound statement; there should be no blank lines between consecutive right braces as discussed in the standard rules for use of <a href="#braces">braces</a>.
</li>
</ul>
<p>
<b>Other Applicable Coding Standards</b>.
@ -2333,6 +2358,11 @@ x++;
<h2>4.6 <a name="while"><code>while</code> Statement</a></h2>
<p><b>Coding Standard:</b></p>
<ul>
<li>
<b><code>while</code> separated from <code>&lt;condition&gt;</code></b>.
The <code>while</code> keyword and the <code>&lt;condition&gt;</code> must appear on the same line.
The <code>while</code> keyword and the <code>&lt;condition&gt;</code> must be separated by a single space.
</li>
<li>
<b>Keywords on separate lines</b>.
<code>while &lt;condition&gt;</code> must lie on a separate line with nothing else present on the line.
@ -2356,7 +2386,11 @@ x++;
</li>
<li>
<b>Followed by a single blank line</b>.
The final right brace must be followed by a blank line.
The final right brace that closes the <code>while &lt;condition&gt;</code> statment must be followed by a single blank line.
</li>
<li>
<b>Exception</b>.
That blank line must be omitted for certain cases where the <code>while &lt;condition&gt;</code> statement is nested within another compound statement; there should be no blank lines between consecutive right braces as discussed in the standard rules for use of <a href="#braces">braces</a>.
</li>
</ul>
<p>
@ -2404,15 +2438,20 @@ x++;
</li>
<li>
<b>Statements enclosed in braces</b>
Statement(s) following the <code>do</code> must always be enclosed in braces, even if only a single statement follows.
Statement(s) following the <code>do</code> must always be enclosed in braces, even if only a single statement (or no statement) follows.
</li>
<li>
<b>Braces and indentation</b>.
The placement of braces and statements must follow the standard rules for braces and indentation.
</li>
<li>
<b><code>while</code> separated from <code>&lt;condition&gt;</code></b>.
The <code>while</code> keyword and the <code>&lt;condition&gt;</code> must appear on the same line.
The <code>while</code> keyword and the <code>&lt;condition&gt;</code> must be separated by a single space.
</li>
<li>
<b>Followed by a single blank line</b>.
The final right brace must be followed by a blank line.
The concluding <code>while &lt;condition&gt;</code> must be followed by a single blank line.
</li>
</ul>
<p>
@ -2447,6 +2486,7 @@ x++;
ptr++;
}
while (*ptr != '\0');
</ul></pre></font>
</td></tr>
</table></center>

View File

@ -65,6 +65,7 @@ Board Features
(AWS) IoT platform.
NOTES:
1. The board usese Wi-Fi® module Inventek ISM43362-M3G-L44 (802.11 b/g/n
compliant), which consists of BCM43362 and STM32F205 host processor
that has a standard SPI or UART interface capability. It means you
@ -194,8 +195,12 @@ Configurations
1. The PATH environment variable include the correct path to the
directory than holds your toolchain binaries.
2. Make sure that the configuration is set for your build platform
and that the toolchain is set for the toolchain type you are using.
2. Check the .config file. Make sure that the configuration is set for
your build platform (e.g., Linux vs. Windows) and that the toolchain
is set for the toolchain type you are using.
The <subdir> that is provided above as an argument to the
tools/configure.sh must be is one of those listed below.
And then build NuttX by simply typing the following. At the conclusion of
the make, the nuttx binary will reside in an ELF file called, simply,
@ -204,8 +209,8 @@ Configurations
make oldconfig
make
The <subdir> that is provided above as an argument to the
tools/configure.sh must be is one of the following.
Where 'make oldconfig' brings the configuration up to data with the current configuration data and 'make' will compile all of the source
files and generate the final binary.
NOTES: