Skip to content
Snippets Groups Projects
NuttxPortingGuide.html 141 KiB
Newer Older
patacongo's avatar
patacongo committed
<html>
<head>
<title>NuttX Porting Guide</title>
patacongo's avatar
patacongo committed
<meta name="author" content="Gregory Nutt">
</head>

patacongo's avatar
patacongo committed
<body background="backgd.gif">
patacongo's avatar
patacongo committed
<hr><hr>
<table width ="100%">
  <tr align="center" bgcolor="#e4e4e4">
    <td>
      <h1><big><font color="#3c34ec">
        <i>NuttX RTOS Porting Guide</i>
      </font></big></h1>
      <p>Last Updated: January 19, 2011</p>
    </td>
  </tr>
</table>
patacongo's avatar
patacongo committed
<hr><hr>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
    <td>
  <h1>Table of Contents</h1>
    </td>
  </tr>
</table>

patacongo's avatar
patacongo committed
<ul>
  <a href="#Introduction">1.0 Introduction</a><br>
  <a href="#DirectoryStructure">2.0 Directory Structure</a>
    <a href="#DirStructDocumentation">2.1 Documentation</a></br>
    <a href="#DirStructArch">2.2 arch/</a>
patacongo's avatar
patacongo committed
    <ul>
      <a href="#archdirectorystructure">2.2.1 Subdirectory Structure</a><br>
      <a href="#summaryofarchfiles">2.2.2 Summary of Files</a><br>
      <a href="#supportedarchitectures">2.2.3 Supported Architectures</a>
patacongo's avatar
patacongo committed
    </ul>
    <a href="#DirStructBinFmt">2.2 binfmt/</a><br>
    <a href="#DirStructConfigs">2.4 configs/</a>
    <ul>
      <a href="#configsdirectorystructure">2.3.1 Subdirectory Structure</a><br>
      <a href="#summaryofconfigfiles">2.3.2 Summary of Files</a>
      <ul>
        <a href="#boardlogic">2.4.2.1 Board Specific Logic</a><br>
        <a href="#boardconfigsubdirs">2.3.2.2 Board Specific Configuration Sub-Directories</a>
      </ul>
      <a href="#supportedboards">2.4.3 Supported Boards</a>
    </ul>
    <a href="#DirStructDrivers">2.5 drivers/</a><br>
    <a href="#DirStructExamples">2.6 examples/</a><br>
    <a href="#DirStructFs">2.7 fs/</a><br>
    <a href="#DirStructGraphics">2.8 graphics/</a><br>
    <a href="#DirStructInclude">2.9 include/</a><br>
    <a href="#DirStructLib">2.10 lib/</a><br>
    <a href="#DirStructLibXX">2.11 libxx/</a><br>
    <a href="#DirStructMm">2.12 mm/</a><br>
    <a href="#DirStructNet">2.13 net</a><br>
    <a href="#DirStructNetUtils">2.14 netutils</a><br>
    <a href="#DirStructSched">2.15 sched/</a><br>
    <a href="#DirStructTools">2.16 tools/</a><br>
    <a href="#topmakefile">2.17 Makefile</a>
  <a href="#configandbuild">3.0 Configuring and Building</a>
patacongo's avatar
patacongo committed
  <ul>
    <a href="#configuringnuttx">3.1 Configuring NuttX</a><br>
    <a href="#buildingnuttx">3.2 Building NuttX</a>
patacongo's avatar
patacongo committed
  </ul>
  <a href="#ArchAPIs">4.0 Architecture APIs</a>
patacongo's avatar
patacongo committed
  <ul>
    <a href="#imports">4.1 APIs Exported by Architecture-Specific Logic to NuttX</a>
    <ul>
      <a href="#upinitialize">4.1.1 <code>up_initialize()</code></a><br>
      <a href="#upidle">4.1.2 <code>up_idle()</code></a><br>
      <a href="#upinitialstate">4.1.3 <code>up_initial_state()</code></a><br>
      <a href="#upcreatestack">4.1.4 <code>up_create_stack()</code></a><br>
      <a href="#upusestack">4.1.5 <code>up_use_stack()</code></a><br>
      <a href="#upreleasestack">4.1.6 <code>up_release_stack()</code></a><br>
      <a href="#upunblocktask">4.1.7 <code>up_unblock_task()</code></a><br>
      <a href="#upblocktask">4.1.8 <code>up_block_task()</code></a><br>
      <a href="#upreleasepending">4.1.9 <code>up_release_pending()</code></a><br>
      <a href="#upreprioritizertr">4.1.10 <code>up_reprioritize_rtr()</code></a><br>
      <a href="#_exit">4.1.11 <code>_exit()</code></a><br>
      <a href="#upassert">4.1.12 <code>up_assert()</code></a><br>
      <a href="#upschedulesigaction">4.1.13 <code>up_schedule_sigaction()</code></a><br>
      <a href="#upallocateheap">4.1.14 <code>up_allocate_heap()</code></a><br>
      <a href="#upinterruptcontext">4.1.15 <code>up_interrupt_context()</code></a><br>
      <a href="#updisableirq">4.1.16 <code>up_disable_irq()</code></a><br>
      <a href="#upenableirq">4.1.17 <code>up_enable_irq()</code></a><br>
      <a href="#upprioritizeirq">4.1.18 <code>up_prioritize_irq()</code></a></br>
      <a href="#upputc">4.1.19 <code>up_putc()</code></a>
    </ul>
    <a href="#exports">4.2 APIs Exported by NuttX to Architecture-Specific Logic</a>
    <ul>
      <a href="#osstart">4.2.1 <code>os_start()</code></a><br>
      <a href="#listmgmt">4.2.2 OS List Management APIs</a><br>
      <a href="#schedprocesstimer">4.2.3 <code>sched_process_timer()</code></a><br>
      <a href="#irqdispatch">4.2.4 <code>irq_dispatch()</code></a>
    </ul>
patacongo's avatar
patacongo committed
    <a href="#demandpaging">4.3 On-Demand Paging</a><br>
    <a href="#ledsupport">4.4 LED Support</a>
    <ul>
      <a href="#ledheaders">4.3.1 Header Files</a><br>
      <a href="#leddefinitions">4.3.2 LED Definitions</a><br>
      <a href="#ledapis">4.3.3 Common LED interfaces</a>
    </ul>
patacongo's avatar
patacongo committed
  </ul>
  <a href="#NxFileSystem">5.0 NuttX File System</a><br>
  <a href="#DeviceDrivers">6.0 NuttX Device Drivers</a><br>
  <ul>
    <a href="#chardrivers">6.1 Character Device Drivers</a><br>
    <a href="#blockdrivers">6.2 Block Device Drivers</a><br>
    <a href="#blockdrivers">6.3 Specialized Device Drivers</a>
    <ul>
       <a href="#ethdrivers">6.3.1 Ethernet Device Drivers</a><br>
       <a href="#spidrivers">6.3.2 SPI Device Drivers</a><br>
       <a href="#i2cdrivers">6.3.3 I2C Device Drivers</a><br>
patacongo's avatar
patacongo committed
       <a href="#serialdrivers">6.3.4 Serial Device Drivers</a><br>
       <a href="#fbdrivers">6.3.5 Frame Buffer Drivers</a><br>
patacongo's avatar
patacongo committed
       <a href="#lcddrivers">6.3.6 LCD Drivers</a><br>
       <a href="#mtddrivers">6.3.7 Memory Technology Device Drivers</a><br>
       <a href="#sdiodrivers">6.3.8 SDIO Device Drivers</a><br>
       <a href="#usbhostdrivers">6.3.9 USB Host-Side Drivers</a><br>
       <a href="#usbdevdrivers">6.3.10 USB Device-Side Drivers</a><br>
  <a href="#apndxconfigs">Appendix A: NuttX Configuration Settings</a><br>
  <a href="#apndxtrademarks">Appendix B:  Trademarks</a>
patacongo's avatar
patacongo committed
</ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
    <td>
      <h1>1.0 <a name="Introduction">Introduction</a></h1>
    </td>
  </tr>
</table>
patacongo's avatar
patacongo committed

<p><b>Overview</b>
patacongo's avatar
patacongo committed
  This document provides and overview of the NuttX build and configuration
patacongo's avatar
patacongo committed
  logic and provides hints for the incorporation of new processor/board architectures
patacongo's avatar
patacongo committed
  into the build.
</p>
<p>
patacongo's avatar
patacongo committed
  See also <code>arch/README.txt</code> and <code>configs/README.txt</code>.
patacongo's avatar
patacongo committed
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
    <td>
      <h1>2.0 <a name="DirectoryStructure">Directory Structure</a></h1>
    </td>
  </tr>
</table>
patacongo's avatar
patacongo committed

patacongo's avatar
patacongo committed
<p>
  <b>Directory Structure</b>.
  The general directly layout for NuttX is very similar to the directory structure
  of the Linux kernel -- at least at the most superficial layers.
  At the top level is the main makefile and a series of sub-directories identified
  below and discussed in the following paragraphs:
</p>
patacongo's avatar
patacongo committed
<ul><pre>
.
patacongo's avatar
patacongo committed
|-- <a href="#topmakefile">Makefile</a>
patacongo's avatar
patacongo committed
|-- <a href="#DirStructDocumentation">Documentation</a>
patacongo's avatar
patacongo committed
|   `-- <i>(documentation files)</i>/
|-- <a href="#DirStructArch">arch</a>/
|   |-- <i>&lt;arch-name&gt;</i>/
|   |   |-- include/
|   |   |   |--<i>&lt;chip-name&gt;</i>/
|   |   |   |  `-- <i>(chip-specific header files)</i>
|   |   |   |--<i>&lt;other-chips&gt;</i>/
|   |   |   `-- <i>(architecture-specific header files)</i>
|   |   `-- src/
|   |       |--<i>&lt;chip-name&gt;</i>/
|   |       |  `-- <i>(chip-specific source files)</i>
|   |       |--<i>&lt;other-chips&gt;</i>/
|   |       `-- <i>(architecture-specific source files)</i>
patacongo's avatar
patacongo committed
|   `-- <i>&lt;other-architecture directories&gt;</i>/
|-- <a href="#DirStructBinFmt">binfmt</a>/
|   |-- Makefile
|   |-- <i>(binfmt-specific sub-directories)</i>/
|   |   `-- <i>(binfmt-specific source files)</i>
|   `-- <i>(common binfmt source files)</i>
patacongo's avatar
patacongo committed
|-- <a href="#DirStructConfigs">configs</a>/
|   |-- <i>&lt;board-name&gt;</i>/
|   |   |-- include/
|   |   |   `-- <i>(other board-specific header files)</i>
patacongo's avatar
patacongo committed
|   |   |-- src/
|   |   |   `-- <i>(board-specific source files)</i>
|   |   |---<i>&lt;config-name&gt;</i>/
|   |   |   `-- <i>(board configuration-specific source files)</i>
|   |   `---<i>(other configuration sub-directories for this board)</i>/
patacongo's avatar
patacongo committed
|   `-- <i>&lt;(other board directories)&gt;</i>/
patacongo's avatar
patacongo committed
|-- <a href="#DirStructDrivers">drivers</a>/
|   |-- Makefile
|   |-- <i>(driver-specific sub-directories)/</i>
|   |   `-- <i>(driver-specific source files)</i>
Loading
Loading full blame...