| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| |
| <!-- This is broken by doc revisioning. |
| --> |
| <link rel="shortcut icon" href="../../../img/favicon.ico"> |
| |
| <title>Create Your First Project - Apache Mynewt</title> |
| |
| <link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet"> |
| <link rel="stylesheet" href="../../../css/highlight.css"> |
| <link href="../../../css/base.css" rel="stylesheet"> |
| <link href="../../../css/custom.css" rel="stylesheet"> |
| <link href="../../../css/v2.css" rel="stylesheet"> |
| <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet"> |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> |
| |
| <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> |
| <!--[if lt IE 9]> |
| <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> |
| <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> |
| <![endif]--> |
| |
| |
| <script> |
| (function(i, s, o, g, r, a, m) { |
| i["GoogleAnalyticsObject"] = r; |
| (i[r] = |
| i[r] || |
| function() { |
| (i[r].q = i[r].q || []).push(arguments); |
| }), |
| (i[r].l = 1 * new Date()); |
| (a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]); |
| a.async = 1; |
| a.src = g; |
| m.parentNode.insertBefore(a, m); |
| })(window, document, "script", "//www.google-analytics.com/analytics.js", "ga"); |
| |
| ga("create", "UA-72162311-1", "auto"); |
| ga("send", "pageview"); |
| </script> |
| |
| </head> |
| |
| |
| <body class="Create Your First Project"> |
| |
| |
| <div class="container"> |
| <div class="row v2-main-banner"> |
| <a class="logo-cell" href="/"> |
| <img class="logo" src="/img/logo.png"> |
| </a> |
| <div class="tagline-cell"> |
| <h4 class="tagline">An OS to build, deploy and securely manage billions of devices</h4> |
| </div> |
| <div class="news-cell"> |
| <div class="well"> |
| <h4>Latest News:</h4> <a href="/download">Apache Mynewt 1.12.0, Apache NimBLE 1.7.0 </a> released (April 4, 2024) |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| |
| |
| |
| |
| |
| |
| |
| <nav id="navbar" class="navbar navbar-inverse affix-top" data-spy="affix" data-offset-top="150" role="navigation"> |
| <div class="container"> |
| <!-- Collapsed navigation --> |
| <div class="navbar-header"> |
| <!-- Expander button --> |
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| |
| </div> |
| |
| <!-- Expanded navigation --> |
| <div class="navbar-collapse collapse"> |
| <!-- Main navigation --> |
| <ul class="nav navbar-nav navbar-right"> |
| <li |
| class="" |
| > |
| <a href="/"><i class="fa fa-home" style="font-size: larger;"></i></a> |
| </li> |
| <li |
| class="important" |
| > |
| <a href="/quick-start/">Quick Start</a> |
| </li> |
| <li |
| class="" |
| > |
| <a href="/about/">About</a> |
| </li> |
| <li |
| class="" |
| > |
| <a href="/talks/">Talks</a> |
| </li> |
| <li |
| class="active" |
| > |
| <a href="/documentation/">Documentation</a> |
| </li> |
| <li |
| class="" |
| > |
| <a href="/download/">Download</a> |
| </li> |
| <li |
| class="" |
| > |
| <a href="/community/">Community</a> |
| </li> |
| <li |
| class="" |
| > |
| <a href="/events/">Events</a> |
| </li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| |
| |
| <div class="container"> |
| |
| <div class="row"> |
| <div class="col-md-3 v2-sidebar sidebar-container"><div id="docSidebar" class="hidden-print" role="complementary"> |
| <div class="top"> |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> |
| <div class="form-group"> |
| <input type="text" name="q" class="form-control" placeholder="Search documentation" /> |
| </div> |
| </form> |
| </div> |
| </div> |
| <ul class="toc-nav"> |
| <li class="doc-version"><select class="form-control" onchange="if (this.value) window.location.href=this.value"> |
| <option value="/latest"> |
| Version: master |
| </option> |
| <option value="/v1_12_0/" > |
| Version: 1.12.0 |
| </option> |
| <option value="/v1_11_0/" > |
| Version: 1.11.0 |
| </option> |
| <option value="/v1_10_0/" > |
| Version: 1.10.0 |
| </option> |
| <option value="/v1_9_0/" > |
| Version: 1.9.0 |
| </option> |
| <option value="/v1_8_0/" > |
| Version: 1.8.0 |
| </option> |
| <option value="/v1_7_0/" > |
| Version: 1.7.0 |
| </option> |
| <option value="/v1_6_0/" > |
| Version: 1.6.0 |
| </option> |
| <option value="/v1_5_0/" > |
| Version: 1.5.0 |
| </option> |
| <option value="/v1_4_0/" > |
| Version: 1.4.0 |
| </option> |
| <option value="/v1_3_0/os/introduction" > |
| Version: 1.3.0 |
| </option> |
| <option value="/v1_2_0/os/introduction" selected="selected" > |
| Version: 1.2.0 |
| </option> |
| <option value="/v1_1_0/os/introduction" > |
| Version: 1.1.0 |
| </option> |
| <option value="/v1_0_0/os/introduction" > |
| Version: 1.0.0 |
| </option> |
| <option value="/v0_9_0/os/introduction" > |
| Version: 0.9.0 |
| </option> |
| </select></li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li ><a href="../../introduction/">Mynewt Documentation</a> |
| |
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| <li ><a href="../get_started/">Basic Setup</a> |
| |
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| <li ><a href="../native_install_intro/">Native Install Option</a> |
| |
| |
| </li> |
| |
| |
| |
| |
| |
| <li > |
| <a href="../docker/">Docker Container Option</a> |
| </li> |
| |
| |
| |
| |
| |
| <li class="active"> |
| <a href="./">Create Your First Project</a> |
| </li> |
| |
| |
| |
| |
| |
| <li > |
| <a href="../serial_access/">Serial Port Setup</a> |
| </li> |
| |
| |
| |
| </ul> |
| |
| </li> |
| |
| |
| |
| |
| |
| <li > |
| <a href="../vocabulary/">Concepts</a> |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| <li ><a href="../../tutorials/tutorials/">Tutorials</a> |
| |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| <li ><a href="../../os_user_guide/">OS User Guide</a> |
| |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| <li><a href=" |
| ../../../network/ble/ble_intro/ |
| ">BLE User Guide</a> |
| |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| <li ><a href="../../../newt/newt_intro/">Newt Tool Guide</a> |
| |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| <li ><a href="../../../newtmgr/overview/">Newt Manager Guide</a> |
| |
| |
| </li> |
| |
| |
| |
| |
| |
| <li > |
| <a href="../../../known_issues/">Known Issues</a> |
| </li> |
| |
| |
| |
| </ul> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| <li><a href=" |
| ../../../newt/install/prev_releases/ |
| ">Appendix</a> |
| |
| |
| </li> |
| |
| |
| |
| </ul> |
| </div></div> |
| |
| <div class="col-md-9" role="main"> |
| <div class="doc-header"> |
| <div role="navigation" aria-label="breadcrumbs navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="/documentation/">Docs</a></li> |
| |
| |
| |
| <li>» <a href="os/get_started/get_started/">Basic Setup</a></li> |
| |
| |
| |
| <li>» <a href="os/introduction/">Mynewt Documentation</a></li> |
| |
| |
| |
| <li>» Create Your First Project</li> |
| |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| <a href="https://github.com/apache/mynewt-site/blob/master/docs/os/get_started/project_create.md" |
| class="icon icon-github"> Edit on GitHub</a> |
| |
| </li> |
| |
| </ul> |
| </div> |
| </div> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <div class="alert alert-warning"> |
| <p> |
| Version 1.2.0 is not the most recent version of the Apache Mynewt |
| documentation. Click <a href="/latest">here</a> to read the latest |
| version. |
| </p> |
| </div> |
| |
| |
| |
| <h2 id="creating-your-first-mynewt-project">Creating Your First Mynewt Project</h2> |
| <p>This page shows you how to create a Mynewt project using the <code>newt</code> command-line tool. The project is a blinky application that toggles a pin. The application uses the Mynewt's simulated hardware and runs as a native application on Mac OS and Linux. </p> |
| <p><strong>Note:</strong> The Mynewt simulator is not yet supported on Windows. If you are using the native install option (not the Docker option), you will need to create the blinky application for a target board. We recommend that you read the section on creating a new project and fetching the source repository to understand the Mynewt repository structure, create a new project, and fetch the source dependencies before proceeding to one of the <a href="/os/tutorials/blinky.md">Blinky Tutorials</a>. </p> |
| <p>This guide shows you how to:</p> |
| <ol> |
| <li>Create a new project and fetch the source repository and dependencies.</li> |
| <li>Test the project packages. (Not supported on Windows.)</li> |
| <li>Build and run the simulated blinky application. (Not supported on Windows.) </li> |
| </ol> |
| <p><br></p> |
| <h3 id="prerequisites">Prerequisites</h3> |
| <ul> |
| <li>Have Internet connectivity to fetch remote Mynewt components.</li> |
| <li>Install the newt tool: <ul> |
| <li>If you have taken the native install option, see the installation instructions for <a href="../../../newt/install/newt_mac/">Mac OS</a>, <a href="../../../newt/install/newt_linux/">Linux</a>, or <a href="../../../newt/install/newt_windows/">Windows</a>. </li> |
| <li>If you have taken the Docker option, you have already installed Newt.</li> |
| </ul> |
| </li> |
| <li>Install the <a href="../native_tools/">native toolchain</a> to compile and build a Mynewt native application. </li> |
| </ul> |
| <p><br></p> |
| <h3 id="creating-a-new-project-and-fetching-the-source-repository">Creating a New Project and Fetching the Source Repository</h3> |
| <p>This section describes how to use the newt tool to create a new project and fetch the core mynewt source repository.</p> |
| <p><br></p> |
| <h4 id="creating-a-new-project">Creating a New Project</h4> |
| <p>Choose a name for your project. We name the project <code>myproj</code>. </p> |
| <p><br> |
| Run the <code>newt new myproj</code> command, from your <strong>dev</strong> directory, to create a new project:</p> |
| <p><strong>Note:</strong> This tutorial assumes you created a <strong>dev</strong> directory under your home directory. </p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$cd ~/dev |
| $ newt new myproj |
| Downloading project skeleton from apache/mynewt-blinky... |
| Installing skeleton in myproj... |
| Project myproj successfully created. |
| </code></pre></div> |
| |
| <p><br></p> |
| <p>The newt tool creates a project base directory name <strong>myproj</strong>. All newt tool commands are run from the project base directory. The newt tool populates this new project with a base skeleton of a new Apache Mynewt project in the project base directory. It has the following structure: </p> |
| <p><strong>Note</strong>: If you do not have <code>tree</code>, run <code>brew install tree</code> to install on Mac OS, <code>sudo apt-get install tree</code> to install on Linux, and <code>pacman -Su tree</code> from a MinGW terminal to install on Windows.</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ cd myproj |
| $ tree |
| . |
| ├── DISCLAIMER |
| ├── LICENSE |
| ├── NOTICE |
| ├── README.md |
| ├── apps |
| │ └── blinky |
| │ ├── pkg.yml |
| │ └── src |
| │ └── main.c |
| ├── project.yml |
| └── targets |
| ├── my_blinky_sim |
| │ ├── pkg.yml |
| │ └── target.yml |
| └── unittest |
| ├── pkg.yml |
| └── target.yml |
| |
| 6 directories, 11 files |
| </code></pre></div> |
| |
| <p><br></p> |
| <p>The newt tool installs the following files for a project in the project base directory:</p> |
| <ol> |
| <li>The file <code>project.yml</code> contains the repository list that the project uses to fetch |
| its packages. Your project is a collection of repositories. In this case, the project only |
| comprises the core mynewt repository. Later, you will add more repositories to include other mynewt components.</li> |
| <li>The file <code>apps/blinky/pkg.yml</code> contains the description of your application and its package dependencies.</li> |
| <li>A <code>target</code> directory that contains the <code>my_blinky_sim</code> directory. The <code>my_blinky_sim</code> directory |
| a target information to build a version of myproj. Use <code>newt target show</code> to see available build |
| targets.</li> |
| <li>A non-buildable target called <code>unittest</code>. This is used internally by <code>newt</code> and is not a formal build target.</li> |
| </ol> |
| <p><strong>Note:</strong> The actual code and package files are not installed (except the template for <code>main.c</code>). See the next step to install the packages.</p> |
| <p><br></p> |
| <h4 id="fetching-the-mynewt-source-repository-and-dependencies">Fetching the Mynewt Source Repository and Dependencies</h4> |
| <p>By default, Mynewt projects rely on a single repository: <strong>apache-mynewt-core</strong> and uses the source in the master branch. If you need to use a different branch, you need to change the <code>vers</code> value in the project.yml file: </p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>repository.apache-mynewt-core: |
| type: github |
| vers: 1-latest |
| user: apache |
| repo: mynewt-core |
| </code></pre></div> |
| |
| <p>Changing vers to 0-dev will put you on the latest master branch. <strong>This branch may not be stable and you may encounter bugs or other problems.</strong></p> |
| <p><strong>Note:</strong> On Windows platforms, you will need to change vers to 0-dev and use the latest master branch. Release 1.0.0 is not supported on Windows.</p> |
| <p><br> |
| Run the <code>newt install</code> command, from your project base directory (myproj), to fetch the source repository and dependencies.</p> |
| <p><strong>Note:</strong> It may take a while to download the apache-mynewt-core reposistory. Use the <em>-v</em> (verbose) option to see the installation progress.</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ newt install |
| apache-mynewt-core |
| </code></pre></div> |
| |
| <p><br> |
| <strong>Note:</strong> If you get the following error:</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>ReadDesc: No matching branch for apache-mynewt-core repo |
| Error: No matching branch for apache-mynewt-core repop |
| </code></pre></div> |
| |
| <p>You must edit the <code>project.yml</code> file and change the line <code>repo: incubator-mynewt-core</code> as shown in the following example to <code>repo: mynewt-core</code>: |
| <br></p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>repository.apache-mynewt-core: |
| type: github |
| vers: 1-latest |
| user: apache |
| <span style="background-color: #ffffcc"> repo: incubator-mynewt-core |
| </span></code></pre></div> |
| |
| <p><br></p> |
| <p>View the core of the Apache Mynewt OS that is downloaded into your local directory. </p> |
| <p>(The actual output will depend on what is in the latest 'master' branch)</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ tree -L 2 repos/apache-mynewt-core/ |
| |
| repos/apache-mynewt-core/ |
| ├── CODING_STANDARDS.md |
| ├── DISCLAIMER |
| ├── LICENSE |
| ├── NOTICE |
| ├── README.md |
| ├── RELEASE_NOTES.md |
| ├── apps |
| │ ├── blecent |
| │ ├── blehci |
| │ ├── bleprph |
| │ ├── bleprph_oic |
| │ ├── blesplit |
| │ ├── bletest |
| │ ├── bletiny |
| │ ├── bleuart |
| │ ├── boot |
| │ ├── fat2native |
| │ ├── ffs2native |
| │ ├── ocf_sample |
| │ ├── slinky |
| │ ├── slinky_oic |
| │ ├── spitest |
| │ ├── splitty |
| │ ├── test |
| │ ├── testbench |
| │ └── timtest |
| ├── boot |
| │ ├── boot_serial |
| │ ├── bootutil |
| │ ├── split |
| │ └── split_app |
| ├── compiler |
| │ ├── arm-none-eabi-m0 |
| │ ├── arm-none-eabi-m4 |
| │ ├── gdbmacros |
| │ ├── mips |
| │ ├── sim |
| │ └── sim-mips |
| ├── crypto |
| │ ├── mbedtls |
| │ └── tinycrypt |
| ├── docs |
| │ └── doxygen.xml |
| ├── encoding |
| │ ├── base64 |
| │ ├── cborattr |
| │ ├── json |
| │ └── tinycbor |
| ├── fs |
| │ ├── disk |
| │ ├── fatfs |
| │ ├── fcb |
| │ ├── fs |
| │ └── nffs |
| ├── hw |
| │ ├── bsp |
| │ ├── cmsis-core |
| │ ├── drivers |
| │ ├── hal |
| │ ├── mcu |
| │ └── scripts |
| ├── kernel |
| │ └── os |
| ├── libc |
| │ └── baselibc |
| ├── mgmt |
| │ ├── imgmgr |
| │ ├── mgmt |
| │ ├── newtmgr |
| │ └── oicmgr |
| ├── net |
| │ ├── ip |
| │ ├── nimble |
| │ ├── oic |
| │ └── wifi |
| ├── project.yml |
| ├── repository.yml |
| ├── sys |
| │ ├── config |
| │ ├── console |
| │ ├── coredump |
| │ ├── defs |
| │ ├── flash_map |
| │ ├── id |
| │ ├── log |
| │ ├── mfg |
| │ ├── reboot |
| │ ├── shell |
| │ ├── stats |
| │ └── sysinit |
| ├── targets |
| │ └── unittest |
| ├── test |
| │ ├── crash_test |
| │ ├── flash_test |
| │ ├── runtest |
| │ └── testutil |
| ├── time |
| │ └── datetime |
| └── util |
| ├── cbmem |
| ├── crc |
| └── mem |
| |
| 94 directories, 9 files |
| </code></pre></div> |
| |
| <p><br></p> |
| <h3 id="testing-the-project-packages">Testing the Project Packages</h3> |
| <p><strong>Note</strong>: This is not yet supported on Windows.</p> |
| <p>You can use the newt tool to execute the unit tests in a package. For example, run the following command to test the <code>sys/config</code> package in the <code>apache-mynewt-core</code> repo: </p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ newt test @apache-mynewt-core/sys/config |
| Testing package @apache-mynewt-core/sys/config/test-fcb |
| Compiling bootutil_misc.c |
| Compiling image_ec.c |
| Compiling image_rsa.c |
| Compiling image_validate.c |
| |
| ... |
| |
| Linking ~/dev/myproj/bin/targets/unittest/sys_config_test-fcb/app/sys/config/test-fcb/sys_config_test-fcb.elf |
| Executing test: ~/dev/myproj/bin/targets/unittest/sys_config_test-fcb/app/sys/config/test-fcb/sys_config_test-fcb.elf |
| Testing package @apache-mynewt-core/sys/config/test-nffs |
| Compiling repos/apache-mynewt-core/encoding/base64/src/hex.c |
| Compiling repos/apache-mynewt-core/fs/fs/src/fs_cli.c |
| Compiling repos/apache-mynewt-core/fs/fs/src/fs_dirent.c |
| Compiling repos/apache-mynewt-core/fs/fs/src/fs_mkdir.c |
| Compiling repos/apache-mynewt-core/fs/fs/src/fs_mount.c |
| Compiling repos/apache-mynewt-core/encoding/base64/src/base64.c |
| Compiling repos/apache-mynewt-core/fs/fs/src/fs_file.c |
| Compiling repos/apache-mynewt-core/fs/disk/src/disk.c |
| Compiling repos/apache-mynewt-core/fs/fs/src/fs_nmgr.c |
| Compiling repos/apache-mynewt-core/fs/fs/src/fsutil.c |
| Compiling repos/apache-mynewt-core/fs/nffs/src/nffs.c |
| |
| ... |
| |
| Linking ~/dev/myproj/bin/targets/unittest/sys_config_test-nffs/app/sys/config/test-nffs/sys_config_test-nffs.elf |
| Executing test: ~/dev/myproj/bin/targets/unittest/sys_config_test-nffs/app/sys/config/test-nffs/sys_config_test-nffs.elf |
| Passed tests: [sys/config/test-fcb sys/config/test-nffs] |
| All tests passed |
| </code></pre></div> |
| |
| <p><strong>Note:</strong> If you installed the latest gcc using homebrew on your Mac, you are probably running gcc-6. Make sure you change the compiler.yml configuration to specify that you are using gcc-6 (See <a href="../native_tools/">Native Install Option</a>). You can also downgrade your installation to gcc-5 and use the default gcc compiler configuration for MyNewt:</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ brew uninstall gcc-6 |
| $ brew link gcc-5 |
| </code></pre></div> |
| |
| <p><strong>Note:</strong> If you are running the standard gcc for 64-bit machines, it does not support 32-bit. In that case you will see compilation errors. You need to install multilib gcc (e.g. gcc-multilib if you running on a 64-bit Ubuntu).</p> |
| <p><br></p> |
| <p>To test all the packages in a project, specify <code>all</code> instead of the package name.</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ newt test all |
| Testing package @apache-mynewt-core/boot/boot_serial/test |
| Compiling repos/apache-mynewt-core/boot/boot_serial/test/src/boot_test.c |
| Compiling repos/apache-mynewt-core/boot/boot_serial/test/src/testcases/boot_serial_setup.c |
| |
| ... |
| |
| Linking ~/dev/myproj/bin/targets/unittest/boot_boot_serial_test/app/boot/boot_serial/test/boot_boot_serial_test.elf |
| |
| ...lots of compiling and testing... |
| |
| Linking ~/dev/myproj/bin/targets/unittest/util_cbmem_test/app/util/cbmem/test/util_cbmem_test.elf |
| Executing test: ~/dev/myproj/bin/targets/unittest/util_cbmem_test/app/util/cbmem/test/util_cbmem_test.elf |
| Passed tests: [boot/boot_serial/test boot/bootutil/test crypto/mbedtls/test encoding/base64/test encoding/cborattr/test encoding/json/test fs/fcb/test fs/nffs/test kernel/os/test net/ip/mn_socket/test net/nimble/host/test net/oic/test sys/config/test-fcb sys/config/test-nffs sys/flash_map/test sys/log/full/test util/cbmem/test] |
| All tests passed |
| </code></pre></div> |
| |
| <p><br></p> |
| <h3 id="building-and-running-the-simulated-blinky-application">Building and Running the Simulated Blinky Application</h3> |
| <p>The section shows you how to build and run the blinky application to run on Mynewt's simulated hardware.</p> |
| <p><strong>Note</strong>: This is not yet supported on Windows. Refer to the <a href="/os/tutorials/blinky.md">Blinky Tutorials</a> to create a blinky application for a target board.</p> |
| <p><br></p> |
| <h4 id="building-the-application">Building the Application</h4> |
| <p>To build the simulated blinky application, run <code>newt build my_blinky_sim</code>:</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ newt build my_blinky_sim |
| Building target targets/my_blinky_sim |
| Compiling repos/apache-mynewt-core/hw/hal/src/hal_common.c |
| Compiling repos/apache-mynewt-core/hw/drivers/uart/src/uart.c |
| Compiling repos/apache-mynewt-core/hw/hal/src/hal_flash.c |
| Compiling repos/apache-mynewt-core/hw/bsp/native/src/hal_bsp.c |
| Compiling repos/apache-mynewt-core/hw/drivers/uart/uart_hal/src/uart_hal.c |
| Compiling apps/blinky/src/main.c |
| |
| ... |
| |
| |
| Archiving sys_mfg.a |
| Archiving sys_sysinit.a |
| Archiving util_mem.a |
| Linking ~/dev/myproj/bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf |
| Target successfully built: targets/my_blinky_sim |
| </code></pre></div> |
| |
| <p><br></p> |
| <h4 id="running-the-blinky-application">Running the Blinky Application</h4> |
| <p>You can run the simulated version of your project and see the simulated LED blink. </p> |
| <p>If you natively install the toolchain execute the binary directly:</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ ./bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf |
| hal_gpio set pin 1 to 0 |
| </code></pre></div> |
| |
| <p><br> |
| If you are using newt docker, use <code>newt run</code> to run the simulated binary.</p> |
| <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>$ newt run my_blinky_sim |
| Loading app image into slot 1 |
| ... |
| Debugging ~/dev/myproj/bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf |
| ... |
| Reading symbols from /bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf...done. |
| (gdb) |
| </code></pre></div> |
| |
| <p>Type <code>r</code> at the <code>(gdb)</code> prompt to run the project. You will see an output indicating that the hal_gpio pin is toggling between 1 and 0 in a simulated blink.</p> |
| <p>Type <code>r</code> at the <code>(gdb)</code> prompt to run the project. You will see an output indicating that the <code>hal_gpio</code> pin is toggling between 1 and 0 in a simulated blink. </p> |
| <p><br></p> |
| <h3 id="exploring-other-mynewt-os-features">Exploring other Mynewt OS Features</h3> |
| <p>Congratulations, you have created your first project! The blinky application |
| is not terribly exciting when it is run in the simulator, as there is no LED to |
| blink. Apache Mynewt has a lot more functionality than just running simulated |
| applications. It provides all the features you'll need to cross-compile your |
| application, run it on real hardware and develop a full featured application.</p> |
| <p>If you're interested in learning more, a good next step is to dig in to one of |
| the <a href="../tutorials/tutorials">tutorials</a> and get a Mynewt project running on real hardware.</p> |
| <p>Happy Hacking!</p> |
| |
| <div class="row"> |
| |
| |
| |
| |
| <ul class="nav nav-pills" style="margin-bottom: 10px"> |
| <li> |
| |
| </li> |
| <li class="pull-right"> |
| |
| </li> |
| </ul> |
| </div> |
| <footer class="row"> |
| <div class="col-xs-12"> |
| |
| <p class="copyright">Apache Mynewt is available under Apache License, version 2.0.</p> |
| |
| </div> |
| <div class="col-xs-12"> |
| <div class="logos"> |
| <a href="https://www.apache.org/"> |
| <img src="/img/asf_logo_wide_small.png" alt="Apache" title="Apache"> |
| </a> |
| <p> |
| Copyright © 2015-2021 The Apache Software Foundation.<br> |
| <small class="footnote"> |
| Apache Mynewt, Mynewt, Apache, the Apache feather logo, and the Apache Mynewt |
| project logo are either registered trademarks or trademarks of the Apache |
| Software Foundation in the United States and other countries. |
| </small> |
| </p> |
| <a href=""> |
| <img src="https://www.countit.com/images/add_to_slack.png" alt="Slack Icon" title="Join our Slack Community" /> |
| </a> |
| </div> |
| </div> |
| <a href="https://www.apache.org/licenses/"> |
| <button class="button-footer-asf"> |
| License |
| </button> |
| </a> |
| <a href="https://www.apache.org/foundation/sponsorship.html"> |
| <button class="button-footer-asf"> |
| Sponsorship |
| </button> |
| </a> |
| <a href="https://www.apache.org/foundation/thanks.html"> |
| <button class="button-footer-asf"> |
| Thanks |
| </button> |
| </a> |
| <a href="https://www.apache.org/security/"> |
| <button class="button-footer-asf"> |
| Security |
| </button> |
| </a> |
| <a href="https://apache.org/events/current-event"> |
| <button class="button-footer-asf"> |
| ASF Events |
| </button> |
| </a> |
| </footer> |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| <script src="../../../js/jquery-1.10.2.min.js"></script> |
| <script src="../../../js/bootstrap-3.0.3.min.js"></script> |
| <script src="../../../js/highlight.pack.js"></script> |
| <script src="../../../js/base.js"></script> |
| <script src="../../../js/custom.js"></script> |
| <script src="search/main.js"></script> |
| |
| </body> |
| </html> |