You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2016/03/23 19:27:45 UTC
[1/7] incubator-mynewt-site git commit: Broke NimBLE tutorial into
multiple sections. Added Newt tutorial and theory of ops. Rearranged
tutorials for better flow. This is work in progress.
Repository: incubator-mynewt-site
Updated Branches:
refs/heads/asf-site 74365365d -> 6dba32a6d
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/create_repo/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/create_repo/index.html b/os/tutorials/create_repo/index.html
new file mode 100644
index 0000000..89433e0
--- /dev/null
+++ b/os/tutorials/create_repo/index.html
@@ -0,0 +1,703 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/tutorials/create_repo/">
+ <link rel="shortcut icon" href="../../../img/favicon.ico">
+
+ <title>Create a repo - Apache Mynewt</title>
+
+ <link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Create a repo">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../tutorials/">Tutorials</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../arduino_zero/">Blinky on Arduino Zero</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../olimex/">Blinky on Olimex</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../STM32F303/">Blinky on STM32F303</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../nRF52/">Blinky on nRF52</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Create a repo
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../unit_test/">Write a Test Suite for a Package</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../air_quality_sensor/">Air-quality Sensor project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../event_queue/">Add task to manage multiple events</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../../network/ble/ble_intro/
+
+">Networking User Guide</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../get_started/introduction/">Mynewt OS Manual</a></li>
+
+
+
+ <li>» <a href="../tutorials/">Tutorials</a></li>
+
+
+
+ <li>» Create a repo</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="create-a-repo-out-of-a-project">Create a Repo out of a Project<a class="headerlink" href="#create-a-repo-out-of-a-project" title="Permanent link">¶</a></h2>
+<p>In order to create a repository out of a project, all you need to do is create a <code>repository.yml</code> file, and check it into the master branch of your project.</p>
+<p><strong>NOTE:</strong> Currently only github source control service is supported by our package management system, but support for plain git will be added soon.</p>
+<p>The repository.yml defines all versions of the repository and the corresponding source control tags that these versions correspond to. As an example, if the repository.yml file has the following content, it means there is one version of the apache-mynewt-core operating system available, which is <code>0.0.0</code> (implying we haven't released yet!). Such a version number corresponds to the "develop" branch in this repository. <code>0-latest</code> would also resolved to this same <code>0.0.0</code> version. The next section explains the versioning system a bit more.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ more repository.yml
+repo.name: apache-mynewt-core
+repo.versions:
+ "0.0.0": "develop"
+ "0-latest": "0.0.0"
+</pre></div>
+
+
+<p><br></p>
+<h3 id="where-should-the-repositoryyml-file-be">Where should the repository.yml file be?<a class="headerlink" href="#where-should-the-repositoryyml-file-be" title="Permanent link">¶</a></h3>
+<p>The <code>repository.yml</code> file lives only in the master branch of the git
+repository. <code>Newt</code> will always fetch this file from the master branch and then
+use that to resolve the actual branch required depending on the version
+specified in the project. <strong>Special care should be taken to ensure that this
+file exists only in the master branch.</strong></p>
+<p>Here is the <code>repository.yml</code> file from a certain snapshot of apache-Mynewt-core:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">repo.name: apache-mynewt-core
+repo.versions:
+ "0.7.9": "Mynewt_0_8_0_b2_tag"
+ "0-latest": "0.7.9"
+ "0.8-latest": "0.7.9"
+</pre></div>
+
+
+<p><br></p>
+<p>It contains the following:</p>
+<ul>
+<li><strong>repo.name</strong> The external name that is used to include the library in
+your <code>project.yml</code> file. This is the name you in include in the <code>project.repositories</code> variable when adding this repository to your project.</li>
+<li><strong>repo.versions</strong> A description of what versions to give the user depending
+on the settings in their <code>project.yml</code> file. See below for a thorough description
+on versioning. Its a flexible mapping between version numbers and git branches.</li>
+</ul>
+<p><br></p>
+<h3 id="repo-version-specification">Repo Version Specification<a class="headerlink" href="#repo-version-specification" title="Permanent link">¶</a></h3>
+<p>The version field argument for a repo has the following format:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><major_num>.<minor_num>.<revision_num>
+</pre></div>
+
+
+<p>or</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><major_num>.<minor_num>-<stability string>
+</pre></div>
+
+
+<p>or </p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><major_num>-<stability string>
+</pre></div>
+
+
+<p><br></p>
+<p>The stability string can be one of 3 pre-defined stability values.</p>
+<ol>
+<li>stable -- A stable release version of the repository</li>
+<li>dev -- A development version from the repository</li>
+<li>latest -- The latest from the repository</li>
+</ol>
+<p>In your <code>project.yml</code> file you can specify different combinations of
+the version number and stability value. For example:</p>
+<ul>
+<li><code>0-latest</code> -- The latest version with major number 0</li>
+<li><code>1.2-stable</code> -- The latest stable version with major and minor number 1.2</li>
+<li><code>1.2-dev</code> -- The development version from 1.2</li>
+<li><code>1.1.1</code> -- a specific version 1.1.1</li>
+</ul>
+<p>You <strong>cannot</strong> specify a stability string with a fully numbered version, e.g.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">1.2.8-stable
+</pre></div>
+
+
+<p><br></p>
+<h3 id="repo-version-resolution">Repo Version Resolution<a class="headerlink" href="#repo-version-resolution" title="Permanent link">¶</a></h3>
+<p>A <code>repository.yml</code> file contains information to match this version request
+into a git branch to fetch for your project.</p>
+<p>It's up to you as the repository maintainer to map these to actual github branches of the repository. For example, let's say in a fictitious repository the following are defined.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">repo.versions:
+ "0.8.0": "xxx_branch_0_8_0"
+ "1.0.0": "xxx_branch_1_0_0"
+ "1.0.2": "xxx_branch_1_0_2"
+ "1.1.1": "xxx_branch_1_1_0"
+ "1.1.2": "xxx_branch_1_1_2"
+ "1.2.0": "xxx_branch_1_2_0"
+ "1.2.1": "xxx_branch_1_2_1"
+ "1.2-dev": "1.2.1"
+ "1-dev": "1.2-dev"
+ "1.2-stable": "1.2.0"
+ "0-latest": "0.8.0"
+ "1-latest": "1-dev"
+ ....
+</pre></div>
+
+
+<p>When the <code>project.yml</code> file asks for <code>1.2-stable</code> it will be resolved to version
+<code>1.2.0</code> which in turn will resolve to a specific branch <code>xxx_branch_1_2_0</code>. This is the branch that <code>newt</code> will fetch into the project with that <code>project.yml</code> file.</p>
+<p><br></p>
+<h3 id="dependencies-on-other-repos">Dependencies on other repos<a class="headerlink" href="#dependencies-on-other-repos" title="Permanent link">¶</a></h3>
+<p>Repositories can also have dependencies on other repositories. These
+dependencies should be listed out on a per-tag basis. So, for example,
+if apache-mynewt-core were to depend on sterlys-little-repo, you might
+have the following directives in the repository.yml:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">develop.repositories:
+ sterlys-little-repo:
+ type: github
+ vers: 0.8-latest
+ user: sterlinghughes
+ repo: sterlys-little-repo
+</pre></div>
+
+
+<p><br></p>
+<p>This would tell Newt that for anything that resolves to the develop
+branch, this repository requires the sterlys-little-repo repository. </p>
+<p>Dependencies are resolved circularly by the newt tool, and every dependent repository is placed as a sibling in the repos directory. Currently, if two repositories have the same name, they will conflict and bad things will happen.</p>
+<p>When a repository is installed to the repos/ directory, the current
+version of that repository is written to the "project.state" file. The
+project state file contains the currently installed version of any given
+repository. This way, the current set of repositories can be recreated
+from the project.state file reliably, whereas the project.yml file can
+have higher level directives (i.e. include 0.8-stable.)</p>
+<h3 id="resolving-dependencies">Resolving dependencies<a class="headerlink" href="#resolving-dependencies" title="Permanent link">¶</a></h3>
+<p>At the moment, all dependencies must match, otherwise newt will provide
+an error. As an example, if you have a set of dependencies such that:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">apache-mynewt-core depends on sterlys-little-repo 0.6-stable
+apache-mynewt-core depends on sterlys-big-repo 0.5.1
+sterlys-big-repo-0.5.1 depends on sterlys-little-repo 0.6.2
+</pre></div>
+
+
+<p><br></p>
+<p>where 0.6-stable is 0.6.3, the newt tool will try and resolve the dependency to
+sterlys-little-repo. It will notice that there are two conflicting
+versions of the same repository, and not perform installation.</p>
+<p>In the future Newt will be smarter about loading in all dependencies,
+and then looking to satisfy those dependencies to the best match of all
+potential options.</p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../add_repos/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Add repo to project
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../upgrade_repo/>
+ Next: Upgrade a repo
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/define_target/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/define_target/index.html b/os/tutorials/define_target/index.html
new file mode 100644
index 0000000..ce7018a
--- /dev/null
+++ b/os/tutorials/define_target/index.html
@@ -0,0 +1,566 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/tutorials/define_target/">
+ <link rel="shortcut icon" href="../../../img/favicon.ico">
+
+ <title>Define a target - Apache Mynewt</title>
+
+ <link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Define a target">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../tutorials/">Tutorials</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../arduino_zero/">Blinky on Arduino Zero</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../olimex/">Blinky on Olimex</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../STM32F303/">Blinky on STM32F303</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../nRF52/">Blinky on nRF52</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Define a target
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../unit_test/">Write a Test Suite for a Package</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../air_quality_sensor/">Air-quality Sensor project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../event_queue/">Add task to manage multiple events</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../../network/ble/ble_intro/
+
+">Networking User Guide</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../get_started/introduction/">Mynewt OS Manual</a></li>
+
+
+
+ <li>» <a href="../tutorials/">Tutorials</a></li>
+
+
+
+ <li>» Define a target</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="how-to-define-a-target">How to Define a Target<a class="headerlink" href="#how-to-define-a-target" title="Permanent link">¶</a></h2>
+<p>What newt commands to use?</p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../nRF52/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Blinky on nRF52
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../add_repos/>
+ Next: Add repo to project
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/event_queue/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/event_queue/index.html b/os/tutorials/event_queue/index.html
index 700f009..ea36f97 100644
--- a/os/tutorials/event_queue/index.html
+++ b/os/tutorials/event_queue/index.html
@@ -9,7 +9,7 @@
<link rel="canonical" href="http://mynewt.apache.org/os/tutorials/event_queue/">
<link rel="shortcut icon" href="../../../img/favicon.ico">
- <title>A task to manage multiple events - Apache Mynewt</title>
+ <title>Add task to manage multiple events - Apache Mynewt</title>
<link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
<link href="../../../css/font-awesome-4.0.3.css" rel="stylesheet">
@@ -40,7 +40,7 @@
</head>
- <body class="A task to manage multiple events">
+ <body class="Add task to manage multiple events">
<div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li class="active">
- A task to manage multiple events
+ Add task to manage multiple events
</li>
@@ -446,7 +486,7 @@
- <li>» A task to manage multiple events</li>
+ <li>» Add task to manage multiple events</li>
@@ -774,9 +814,9 @@ pkg.deps:
<ul class="nav nav-pills" style="margin-bottom: 10px">
<li>
- <a href=../add_repos/>
+ <a href=../bletiny_project/>
<span class="fa fa-arrow-left"></span>
- Previous: Additional Repositories
+ Previous: Enable BLE using nimBLE
</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/nRF52/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/nRF52/index.html b/os/tutorials/nRF52/index.html
index fcab3f0..59979fa 100644
--- a/os/tutorials/nRF52/index.html
+++ b/os/tutorials/nRF52/index.html
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
@@ -543,8 +583,8 @@ for the nrf52 evaluation board.</p>
</li>
<li class="pull-right">
- <a href=../unit_test/>
- Next: Write a Test Suite for a Package
+ <a href=../define_target/>
+ Next: Define a target
<span class="fa fa-arrow-right"></span>
</a>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/olimex/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/olimex/index.html b/os/tutorials/olimex/index.html
index aa52ad0..38719b9 100644
--- a/os/tutorials/olimex/index.html
+++ b/os/tutorials/olimex/index.html
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/tutorials/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/tutorials/index.html b/os/tutorials/tutorials/index.html
index 985564d..5d758a9 100644
--- a/os/tutorials/tutorials/index.html
+++ b/os/tutorials/tutorials/index.html
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/unit_test/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/unit_test/index.html b/os/tutorials/unit_test/index.html
index dc42f28..72fd5ae 100644
--- a/os/tutorials/unit_test/index.html
+++ b/os/tutorials/unit_test/index.html
@@ -273,6 +273,46 @@
+ <li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
<li class="active">
Write a Test Suite for a Package
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
@@ -633,9 +673,9 @@ the message shown below.</p>
<ul class="nav nav-pills" style="margin-bottom: 10px">
<li>
- <a href=../nRF52/>
+ <a href=../upgrade_repo/>
<span class="fa fa-arrow-left"></span>
- Previous: Blinky on nRF52
+ Previous: Upgrade a repo
</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/upgrade_repo/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/upgrade_repo/index.html b/os/tutorials/upgrade_repo/index.html
new file mode 100644
index 0000000..794fccc
--- /dev/null
+++ b/os/tutorials/upgrade_repo/index.html
@@ -0,0 +1,575 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/tutorials/upgrade_repo/">
+ <link rel="shortcut icon" href="../../../img/favicon.ico">
+
+ <title>Upgrade a repo - Apache Mynewt</title>
+
+ <link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Upgrade a repo">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../tutorials/">Tutorials</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../arduino_zero/">Blinky on Arduino Zero</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../olimex/">Blinky on Olimex</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../STM32F303/">Blinky on STM32F303</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../nRF52/">Blinky on nRF52</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Upgrade a repo
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../unit_test/">Write a Test Suite for a Package</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../air_quality_sensor/">Air-quality Sensor project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../event_queue/">Add task to manage multiple events</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../../network/ble/ble_intro/
+
+">Networking User Guide</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../get_started/introduction/">Mynewt OS Manual</a></li>
+
+
+
+ <li>» <a href="../tutorials/">Tutorials</a></li>
+
+
+
+ <li>» Upgrade a repo</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="upgrade-a-repo">Upgrade a repo<a class="headerlink" href="#upgrade-a-repo" title="Permanent link">¶</a></h2>
+<p>In order to upgrade a previously installed repository, the "newt upgrade" command should be issued:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ newt upgrade
+</pre></div>
+
+
+<p><br></p>
+<p>Newt upgrade will look at the current desired version in <code>project.yml</code>,
+and compare it to the version in <code>project.state</code>. If these two differ, it
+will upgrade the dependency. Upgrade works not just for the dependency
+in <code>project.yml</code>, but for all the sub-dependencies that they might have.</p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../create_repo/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Create a repo
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../unit_test/>
+ Next: Write a Test Suite for a Package
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/sitemap.xml
----------------------------------------------------------------------
diff --git a/sitemap.xml b/sitemap.xml
index d4b43d2..241c29f 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -4,7 +4,7 @@
<url>
<loc>http://mynewt.apache.org/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -12,7 +12,7 @@
<url>
<loc>http://mynewt.apache.org/about/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -20,7 +20,7 @@
<url>
<loc>http://mynewt.apache.org/documentation/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -28,7 +28,7 @@
<url>
<loc>http://mynewt.apache.org/download/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -36,7 +36,7 @@
<url>
<loc>http://mynewt.apache.org/community/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -44,7 +44,7 @@
<url>
<loc>http://mynewt.apache.org/events/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -53,7 +53,7 @@
<url>
<loc>http://mynewt.apache.org/os/get_started/introduction/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -93,7 +93,7 @@
<url>
<loc>http://mynewt.apache.org/newt/newt_intro/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -104,8 +104,8 @@
</url>
<url>
- <loc>http://mynewt.apache.org</loc>
- <lastmod></lastmod>
+ <loc>http://mynewt.apache.org/newt/newt_operation/</loc>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -121,13 +121,13 @@
<url>
<loc>http://mynewt.apache.org/newtmgr/overview/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://mynewt.apache.org/newtmgr/installing/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -149,13 +149,13 @@
<url>
<loc>http://mynewt.apache.org/os/tutorials/how_to_edit_docs/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://mynewt.apache.org/faq/answers/</loc>
- <lastmod>2016-03-21</lastmod>
+ <lastmod>2016-03-23</lastmod>
<changefreq>daily</changefreq>
</url>
[4/7] incubator-mynewt-site git commit: Broke NimBLE tutorial into
multiple sections. Added Newt tutorial and theory of ops. Rearranged
tutorials for better flow. This is work in progress.
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_host_ini/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_host_ini/index.html b/network/ble/ini_stack/ble_host_ini/index.html
new file mode 100644
index 0000000..4121cfc
--- /dev/null
+++ b/network/ble/ini_stack/ble_host_ini/index.html
@@ -0,0 +1,651 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_host_ini/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>Initialize host - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Initialize host">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../ble_add_cpu/">Add cputime</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_mempool/">Create mem pool</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_devadd/">Initialize device addr</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_statpkg/">Initialize stats pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_consolepkg/">Initialize console pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_controller_ini/">Initialize controller</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Initialize host
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» <a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+
+ <li>» Initialize host</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="initialize-the-nimble-host">Initialize the NimBLE host<a class="headerlink" href="#initialize-the-nimble-host" title="Permanent link">¶</a></h2>
+<p>The Nimble host is initialized via a call to <code>ble_hs_init()</code>. This function is declared as follows:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">int</span> <span style="color: #000000">ble_hs_init</span>(<span style="color: #A90D91">uint8_t</span> <span style="color: #000000">prio</span>, <span style="color: #A90D91">struct</span> <span style="color: #000000">ble_hs_cfg</span> <span style="color: #000000">*cfg</span>)
+</pre></div>
+
+
+<p>The parameters are documented below.</p>
+<table>
+<thead>
+<tr>
+<th><strong>Parameter</strong></th>
+<th><strong>Description</strong></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><em>prio</em></td>
+<td>The priority of the Nimble host task. A lower number corresponds to higher priority.</td>
+</tr>
+<tr>
+<td><em>cfg</em></td>
+<td>A pointer to the desired host configuration, or <em>NULL</em> if you want to use the default settings.</td>
+</tr>
+</tbody>
+</table>
+<p><strong>prio</strong>:</p>
+<p>Unlike the controller, the host does not have any strict timing requirements.
+This number should be greater than the priority of any time-critical tasks in
+your application (remember, bigger number = lower priority!). There are no
+restrictions with regards to the host task's priority relative to its client
+tasks. In the below example, the host is assigned a priority of 1.</p>
+<p><strong>cfg</strong>:</p>
+<p>As mentioned above, passing a <em>cfg</em> value of <em>NULL</em> will initialize the Nimble
+host with the default configuration. This is convenient while familiarizing
+yourself with the Nimble stack, but ultimately you will probably want to use a
+custom configuration. For more information on configuring the host, see the
+Nimble Configuration Guide (TBD).</p>
+<p>Continuing with our running example, we now add Nimble host initialization to the <em>main()</em> function. This application uses the default host configuration, so it specifies <em>NULL</em> as the second argument to <code>ble_hs_init()</code>.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "host/ble_hs.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">ble_hs_cfg</span> <span style="color: #000000">cfg</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+ <span style="color: #177500">/* Initialize the statistics package */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize the BLE LL */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">ble_ll_init</span>(<span style="color: #1C01CE">0</span>, <span style="color: #1C01CE">7</span>, <span style="color: #1C01CE">260</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize the BLE host. */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">ble_hs_init</span>(<span style="color: #000000">BLE_HS_TASK_PRI</span>, <span style="color: #A90D91">NULL</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_controller_ini/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Initialize controller
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../../../../newt/newt_intro/>
+ Next: Introduction
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_ini_intro/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_ini_intro/index.html b/network/ble/ini_stack/ble_ini_intro/index.html
new file mode 100644
index 0000000..24dcff7
--- /dev/null
+++ b/network/ble/ini_stack/ble_ini_intro/index.html
@@ -0,0 +1,577 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_ini_intro/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>toc - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="toc">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li class="active"><a href="./">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../ble_add_cpu/">Add cputime</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_mempool/">Create mem pool</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_devadd/">Initialize device addr</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_statpkg/">Initialize stats pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_consolepkg/">Initialize console pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_controller_ini/">Initialize controller</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_host_ini/">Initialize host</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» Initialize stack</li>
+
+
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="nimble-stack-initialization">Nimble stack initialization<a class="headerlink" href="#nimble-stack-initialization" title="Permanent link">¶</a></h2>
+<p>We are now going to explain how to setup your application to initialize the nimble stack and to get the basic stack, and its required modules, initialized and up and running. Note that the code shown here is an example of what is required for nimble stack operation; it is not intended to dictate to the developer exactly how to organize/setup your code. For example, the code sample shows modification of main.c in the application /src folder. The developer has the flexibility to organize the code as they see fit so this code does not need to reside in /src/main.c nor in the main() function itself. The only possible issue is the order of some of the initializations. Where this order is important it is indicated in the tutorial.</p>
+<p>A note about the code samples: the main() function in each code sample builds upon the previous example. However, code outside of main() shows only what we add for each step. The last code sample shows the entire main.c that we created.</p>
+<p>Let's start with a very basic main() function (shown below). In this main all we are doing is initializing the Mynewt OS and starting it.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #633820">#include "os/os.h"</span>
+
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p>The Nimble stack requires a number of packages/modules to be initialized prior to being initialized. We are going to add these one by one to the application and describe each.</p>
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../../nimble_setup/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Set up application
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ble_add_cpu/>
+ Next: Add cputime
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_mempool/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_mempool/index.html b/network/ble/ini_stack/ble_mempool/index.html
new file mode 100644
index 0000000..b32da69
--- /dev/null
+++ b/network/ble/ini_stack/ble_mempool/index.html
@@ -0,0 +1,604 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_mempool/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>Create mem pool - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Create mem pool">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../ble_add_cpu/">Add cputime</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Create mem pool
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_devadd/">Initialize device addr</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_statpkg/">Initialize stats pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_consolepkg/">Initialize console pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_controller_ini/">Initialize controller</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_host_ini/">Initialize host</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» <a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+
+ <li>» Create mem pool</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="create-the-system-memory-buffer-pool">Create the System Memory Buffer Pool<a class="headerlink" href="#create-the-system-memory-buffer-pool" title="Permanent link">¶</a></h2>
+<p>The Nimble stack allocates packet buffers (called mbufs) from the system memory buffer pool (msys). The system memory buffer pool and mbufs are described in the OS manual; we suggest reading that section in order to become familiar with mbufs if you are not already familiar with them. Note that the application itself (the unique application code that you are writing) does not need to use mbufs and none of the BLE host API exposed to the application developer uses them. However, the Nimble stack does require the existence of the system memory pool.</p>
+<p>Creating the memory pool and registering it with the system memory buffer pool can be a bit tricky the first time. However, using the template provided below it should be much easier. The header file /net/nimble/include/nimble/ble.h, which should be included in main.c, contains some MBUF macros that you will need to create the memory pool used by msys. The macro <code>BLE_MBUF_PAYLOAD_SIZE</code> defines the maximum amount of user payload, plus overhead, that a link layer BLE PDU can contain. The macro <code>BLE_MBUF_MEMBLOCK_OVERHEAD</code> is the amount of overhead required by the Nimble stack in each memory block used by the mbuf pool. The macro <code>MBUF_NUM_MBUFS</code> defines the number of mbufs in the mbuf pool and is defined locally. The user must determine, based on application requirements and platform memory size, how many mbufs are required. For example, if your application expects to have many simultaneous connections you may want to increase the size of the mbuf p
ool. In the example below, we assume you are only using a small number of active connections (2 to 3).</p>
+<p>A note about the size of the mbufs and <code>BLE_MBUF_PAYLOAD_SIZE</code>. Msys allows for multiple mbuf pools of various size. Currently, the Nimble stack requires that msys has an mbuf pool registered that can accommodate the maximum size BLE LL PDU. Thus, we only show the creation of one mbuf pool of maximum size mbufs which gets registered to the system mbuf memory pool. We plan on modifying the Nimble stack so that smaller mbufs can be used (to conserve memory) but at this point in time you cannot modify <code>BLE_MBUF_PAYLOAD_SIZE</code>. Furthermore, you cannot add a mbuf pool of smaller size elements to the msys pool as the msys code might then allocate a mbuf that is too small for the nimble stack.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #177500">/* Create a mbuf pool of BLE mbufs */</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_NUM_MBUFS (8)</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)</span>
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf_pool</span> <span style="color: #000000">g_mbuf_pool</span>;
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">struct</span> <span style="color: #000000">os_mempool</span> <span style="color: #000000">g_mbuf_mempool</span>;
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">os_membuf_t</span> <span style="color: #000000">g_mbuf_buffer</span>[<span style="color: #000000">MBUF_MEMPOOL_SIZE</span>];
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_add_cpu/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Add cputime
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ble_devadd/>
+ Next: Initialize device addr
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_statpkg/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_statpkg/index.html b/network/ble/ini_stack/ble_statpkg/index.html
new file mode 100644
index 0000000..86dd430
--- /dev/null
+++ b/network/ble/ini_stack/ble_statpkg/index.html
@@ -0,0 +1,606 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_statpkg/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>Initialize stats pkg - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Initialize stats pkg">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../ble_add_cpu/">Add cputime</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_mempool/">Create mem pool</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_devadd/">Initialize device addr</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Initialize stats pkg
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_consolepkg/">Initialize console pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_controller_ini/">Initialize controller</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_host_ini/">Initialize host</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» <a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+
+ <li>» Initialize stats pkg</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="initialize-the-statistics-package">Initialize the statistics package<a class="headerlink" href="#initialize-the-statistics-package" title="Permanent link">¶</a></h2>
+<p>The NimBLE stack uses the statistics package and this must be initialized prior to initializing the Nimble stack. Initializing the statistics package is quite simple; all you need to do is call the initialization function <code>stats_module_init()</code>.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "stats/stats.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize the statistics package */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_devadd/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Initialize device addr
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ble_consolepkg/>
+ Next: Initialize console pkg
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
[5/7] incubator-mynewt-site git commit: Broke NimBLE tutorial into
multiple sections. Added Newt tutorial and theory of ops. Rearranged
tutorials for better flow. This is work in progress.
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ble_intro/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ble_intro/index.html b/network/ble/ble_intro/index.html
index bdee5b7..71393e3 100644
--- a/network/ble/ble_intro/index.html
+++ b/network/ble/ble_intro/index.html
@@ -259,13 +259,34 @@
- <li class="active"><a href="./">BLE Stack</a></li>
+ <li class="active"><a href="./">NimBLE - Mynewt BLE Stack</a></li>
<ul class="current-toc">
+
+
+
+ <li>
+ <a href="../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ini_stack/ble_ini_intro/">Initialize stack</a></li>
+
+
+ </li>
+
+
+
</ul>
</li>
@@ -377,7 +398,7 @@
- <li>» BLE Stack</li>
+ <li>» NimBLE - Mynewt BLE Stack</li>
@@ -406,8 +427,8 @@
</li>
<li class="pull-right">
- <a href=../../../newt/newt_intro/>
- Next: Introduction
+ <a href=../nimble_setup/>
+ Next: Set up application
<span class="fa fa-arrow-right"></span>
</a>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_add_cpu/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_add_cpu/index.html b/network/ble/ini_stack/ble_add_cpu/index.html
new file mode 100644
index 0000000..d1f1031
--- /dev/null
+++ b/network/ble/ini_stack/ble_add_cpu/index.html
@@ -0,0 +1,593 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_add_cpu/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>Add cputime - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Add cputime">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li class="active">
+ Add cputime
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_mempool/">Create mem pool</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_devadd/">Initialize device addr</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_statpkg/">Initialize stats pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_consolepkg/">Initialize console pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_controller_ini/">Initialize controller</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_host_ini/">Initialize host</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» <a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+
+ <li>» Add cputime</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="add-cputime">Add cputime<a class="headerlink" href="#add-cputime" title="Permanent link">¶</a></h2>
+<p>The NimBLE stack requires "cputime". This is provided by the Mynewt HAL of the
+same name. The cputime HAL provides a high resolution timer that is used by the
+nimble stack (as the BLE specification requires a fairly high resolution timer
+and has fairly tight timing requirements). The cputime HAL allows the user to
+specify the timer resolution as different applications may require a different
+resolution. While the Nimble stack does not require a specific timer resolution
+per se, a resolution that is too large may affect performance and power
+efficiency. A suggested clock rate for HAL cputime for the nimble stack is 1
+MHz, or 1 microsecond per cputime tick. This provides enough resolution for
+most needs while providing the Nimble stack enough resolution to implement the
+BLE specification.</p>
+<p>Add the initialization of cputime to your application:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "hal/hal_cputime.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_ini_intro/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Initialize stack
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ble_mempool/>
+ Next: Create mem pool
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_consolepkg/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_consolepkg/index.html b/network/ble/ini_stack/ble_consolepkg/index.html
new file mode 100644
index 0000000..6abe1ba
--- /dev/null
+++ b/network/ble/ini_stack/ble_consolepkg/index.html
@@ -0,0 +1,610 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_consolepkg/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>Initialize console pkg - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Initialize console pkg">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../ble_add_cpu/">Add cputime</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_mempool/">Create mem pool</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_devadd/">Initialize device addr</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_statpkg/">Initialize stats pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Initialize console pkg
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_controller_ini/">Initialize controller</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_host_ini/">Initialize host</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» <a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+
+ <li>» Initialize console pkg</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="initializing-the-console-package">Initializing the console package<a class="headerlink" href="#initializing-the-console-package" title="Permanent link">¶</a></h2>
+<p>The console is also required by the Nimble stack. The console is currently used for log output so it needs to be initialized. For this example, we are not going to use a console receive callback. All this means is that input from the console will not be accepted by default; the developer will have to install their own handler or use one provided by another package (the shell, for example). Just like statistics, the console is initialized by calling the console initialization function <code>console_init()</code>.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "console/console.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+ <span style="color: #177500">/* Initialize the statistics package */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Init the console */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">console_init</span>(<span style="color: #A90D91">NULL</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_statpkg/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Initialize stats pkg
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ble_controller_ini/>
+ Next: Initialize controller
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_controller_ini/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_controller_ini/index.html b/network/ble/ini_stack/ble_controller_ini/index.html
new file mode 100644
index 0000000..f792f9e
--- /dev/null
+++ b/network/ble/ini_stack/ble_controller_ini/index.html
@@ -0,0 +1,656 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_controller_ini/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>Initialize controller - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Initialize controller">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../ble_add_cpu/">Add cputime</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_mempool/">Create mem pool</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_devadd/">Initialize device addr</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_statpkg/">Initialize stats pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_consolepkg/">Initialize console pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Initialize controller
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_host_ini/">Initialize host</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» <a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+
+ <li>» Initialize controller</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="initialize-the-nimble-controller">Initialize the NimBLE controller<a class="headerlink" href="#initialize-the-nimble-controller" title="Permanent link">¶</a></h2>
+<p>The NimBLE controller is initialized via a call to <code>ble_ll_init()</code>. This function is declared as follows:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">int</span> <span style="color: #000000">ble_ll_init</span>(<span style="color: #A90D91">uint8_t</span> <span style="color: #000000">ll_task_prio</span>, <span style="color: #A90D91">uint8_t</span> <span style="color: #000000">num_acl_pkts</span>, <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">acl_pkt_size</span>)
+</pre></div>
+
+
+<p>This function's parameters are documented below.</p>
+<table>
+<thead>
+<tr>
+<th><strong>Parameter</strong></th>
+<th><strong>Description</strong></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><em>prio</em></td>
+<td>The priority of the NimBLE controller task. A lower number corresponds to higher priority.</td>
+</tr>
+<tr>
+<td><em>num_acl_pkts</em></td>
+<td>The maximum number of outstanding data packets that the controller will accept from the host.</td>
+</tr>
+<tr>
+<td><em>acl_pkt_size</em></td>
+<td>The maximum data packet size that the controller will accept from the host.</td>
+</tr>
+</tbody>
+</table>
+<p><strong>prio</strong>:</p>
+<p>If you are not familiar with multitasking, preemptive operating systems we
+highly encourage you to read the Core OS section of Mynewt OS manual. It is up
+to the application developer to decide the priority of tasks in the system.
+Note that the lower the priority number the higher the priority in the OS. For
+example, if a task is running at priority 5 and a task at priority 3 wants to
+run, the task at priority 5 gets preempted as the other task is a higher
+proiority.</p>
+<p>In the example shown below, the LL task is configured to have the highest
+priority (priority 0). We recommend making the BLE LL task the highest priority
+task in your application as it has fairly rigorous timing requirements and
+allowing other tasks to preempt the LL task could cause undesirable behavior.
+Note that we do not force this to be the case as an application may require a
+task to be even higher priority than the LL task. Just be warned: a task
+higher in priority than the LL task should not perform actions that take too
+long; even a few milliseconds could cause undesirable behavior.</p>
+<p><strong>num_acl_pkts</strong> and <strong>acl_pkt_size</strong>:</p>
+<p>These two parameters are used to limit the amount of data the host tries to send through the controller. NimBLE uses the msys facility for allocating data packets, so the product of these arguments must not be larger than the total amount of memory allocated for msys. The below example uses some values that are reasonable for most uses.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "controller/ble_ll.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">ble_hs_cfg</span> <span style="color: #000000">cfg</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for NimBLE packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+ <span style="color: #177500">/* Initialize the statistics package */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize the BLE LL */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">ble_ll_init</span>(<span style="color: #1C01CE">0</span>, <span style="color: #1C01CE">7</span>, <span style="color: #1C01CE">260</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_consolepkg/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Initialize console pkg
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ble_host_ini/>
+ Next: Initialize host
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/ini_stack/ble_devadd/index.html
----------------------------------------------------------------------
diff --git a/network/ble/ini_stack/ble_devadd/index.html b/network/ble/ini_stack/ble_devadd/index.html
new file mode 100644
index 0000000..ab6a21b
--- /dev/null
+++ b/network/ble/ini_stack/ble_devadd/index.html
@@ -0,0 +1,607 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/ini_stack/ble_devadd/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>Initialize device addr - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Initialize device addr">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../../nimble_setup/">Set up application</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../ble_add_cpu/">Add cputime</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_mempool/">Create mem pool</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Initialize device addr
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_statpkg/">Initialize stats pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_consolepkg/">Initialize console pkg</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_controller_ini/">Initialize controller</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../ble_host_ini/">Initialize host</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» <a href="../ble_ini_intro/">Initialize stack</a></li>
+
+
+
+ <li>» Initialize device addr</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="initialize-the-device-address">Initialize the Device Address<a class="headerlink" href="#initialize-the-device-address" title="Permanent link">¶</a></h2>
+<p>The BLE specification requires that devices have an address (called a device address). This address can be either a public device address or a random device address. The current Nimble stack implementation requires that these addresses be defined somewhere in the application; they are not defined within the Nimble stack itself. This was done so that the entire application could have access to these addresses. We expect that we will move these addresses into the Nimble stack in a future release.</p>
+<p>The two variables that must be defined are named <code>g_dev_addr</code> (public device address) and <code>g_random_addr</code> (static random address). The device address must be initialized prior to initializing the Nimble stack. The random address does not have to be initialized ahead of time as it is possible to set the random address in the Nimble controller when it is running. In this example, we only initialize the device address. The company OUI in this example is 0a:bb:cc; the unique portion is 11:22:33 for a device address equal to 0a:bb:cc:11:22:33. Note that we store the address in little endian order as BLE expects the OUI to be in the most significant bytes.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #177500">/* Our global device address (public) */</span>
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">uint8_t</span> <span style="color: #000000">g_dev_addr</span>[<span style="color: #000000">BLE_DEV_ADDR_LEN</span>];
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"><span style="color: #177500">/* Our random address (static) */</span>
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">uint8_t</span> <span style="color: #000000">g_random_addr</span>[<span style="color: #000000">BLE_DEV_ADDR_LEN</span>];
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize our device address */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_mempool/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Create mem pool
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ble_statpkg/>
+ Next: Initialize stats pkg
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
[2/7] incubator-mynewt-site git commit: Broke NimBLE tutorial into
multiple sections. Added Newt tutorial and theory of ops. Rearranged
tutorials for better flow. This is work in progress.
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/newt_operation/index.html
----------------------------------------------------------------------
diff --git a/newt/newt_operation/index.html b/newt/newt_operation/index.html
new file mode 100644
index 0000000..8db1343
--- /dev/null
+++ b/newt/newt_operation/index.html
@@ -0,0 +1,664 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/newt/newt_operation/">
+ <link rel="shortcut icon" href="../../img/favicon.ico">
+
+ <title>Newt Theory of Ops - Apache Mynewt</title>
+
+ <link href="../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Newt Theory of Ops">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li >
+ <a href="../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li class="active">
+ <a href="../newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../newt_intro/
+">Newt Tool Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../newt_intro/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../install/newt_mac/
+">Install</a>
+
+
+ </li>
+
+
+
+
+
+
+ <li class="active">
+ Newt Theory of Ops
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../newt_ops/">User Guide</a></li>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li role="presentation"><a href="../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li class="active" role="presentation"><a href="../newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../newt_intro/">Newt Tool Manual</a></li>
+
+
+
+ <li>» Newt Theory of Ops</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="newt-tool-theory-of-operations">Newt Tool - Theory of Operations<a class="headerlink" href="#newt-tool-theory-of-operations" title="Permanent link">¶</a></h2>
+<p>Newt has a fairly smart package manager that can read a directory tree, build a dependency tree, and emit the right build artifacts.</p>
+<h3 id="building-dependencies">Building dependencies<a class="headerlink" href="#building-dependencies" title="Permanent link">¶</a></h3>
+<p>Newt can read a directory tree, build a dependency tree, and emit the right build artifacts. An example newt source tree is in incubator-mynewt-blinky/develop:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ tree -L 3
+.
+├── DISCLAIMER
+├── LICENSE
+├── NOTICE
+├── README.md
+<span style="background-color: #ffffcc">├── apps
+</span>│ └── blinky
+│ ├── pkg.yml
+│ └── src
+├── project.yml
+<span style="background-color: #ffffcc">└── targets
+</span> ├── my_blinky_sim
+ │ ├── pkg.yml
+ │ └── target.yml
+ └── unittest
+ ├── pkg.yml
+ └── target.yml
+
+6 directories, 10 files
+</pre></div>
+
+
+<p><br></p>
+<p>When Newt sees a directory tree that contains a "project.yml" file it knows that it is in the base directory of a project, and automatically builds a package tree. You can see that there are two essential package directories, "apps" and "targets." </p>
+<p><br></p>
+<h4 id="apps-package-directory">"apps" Package Directory<a class="headerlink" href="#apps-package-directory" title="Permanent link">¶</a></h4>
+<p><code>apps</code> is where applications are stored, and applications are where the main() function is contained. Along with the <code>targets</code> directory, <code>apps</code> represents the top-level of the build tree, and define the dependencies and features for the rest of the system.</p>
+<p>The app definition is contained in a <code>pkg.yml</code> file. An example of blinky's <code>pkg.yml</code> file is:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ more apps/blinky/pkg.yml
+<snip>
+pkg.name: apps/blinky
+pkg.vers: 0.8.0
+pkg.description: Basic example application which blinks an LED.
+pkg.author: "Apache Mynewt <dev@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.repository:
+pkg.keywords:
+
+pkg.deps:
+ - "@apache-mynewt-core/libs/os"
+ - "@apache-mynewt-core/hw/hal"
+ - "@apache-mynewt-core/libs/console/full"
+</pre></div>
+
+
+<p><br></p>
+<p>This file says that the name of the package is apps/blinky, and it
+depends on libs/os, hw/hal and libs/console/full packages.</p>
+<p><strong>NOTE:</strong> @apache-mynewt-core is a repository descriptor, and this will be
+covered in the "repository" section. </p>
+<p><br></p>
+<h4 id="targets-package-directory">"targets" Package Directory<a class="headerlink" href="#targets-package-directory" title="Permanent link">¶</a></h4>
+<p><code>targets</code> is where targets are stored, and each target is a collection of parameters that must be passed to Newt in order to generate a reproducible build. Along with the <code>apps</code> directory, <code>targets</code> represents the top of the build tree. Any packages or parameters specified at the target level cascades down to all dependencies.</p>
+<p>Most targets consist of:</p>
+<ul>
+<li>app: The application to build</li>
+<li>bsp: The board support package to combine with that application</li>
+<li>build_profile: Either debug or optimized.</li>
+</ul>
+<p>The <code>my_blinky_sim</code> target in the example below has the following settings:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ newt target show
+targets/my_blinky_sim
+ app=apps/blinky
+ bsp=@apache-mynewt-core/hw/bsp/native
+ build_profile=debug
+$ ls my_blinky_sim/
+pkg.yml target.yml
+</pre></div>
+
+
+<p>In general, the three basic parameters of a target (<code>app</code>, <code>bsp</code>, and <code>build_profile</code>) are stored in the <code>target.yml</code> file in that target's build directory under <code>targets</code>. You will also see a <code>pkg.yml</code> file in the same directory. Since targets are packages, a <code>pkg.yml</code> is expected. It contains typical package descriptors, dependencies, and additional parameters such as the following:</p>
+<ul>
+<li>Cflags: Any additional compiler flags you might want to specify to the build</li>
+<li>Aflags: Any additional assembler flags you might want to specify to the build</li>
+<li>Lflags: Any additional linker flags you might want to specify to the build</li>
+<li>features: Any system level features you want to enable.</li>
+</ul>
+<p><br></p>
+<h3 id="resolving-dependencies">Resolving dependencies<a class="headerlink" href="#resolving-dependencies" title="Permanent link">¶</a></h3>
+<p>When newt is told to build a project, it will:</p>
+<ul>
+<li>find the top-level project.yml file</li>
+<li>recurse the packages in the package tree, and build a list of all
+source packages</li>
+</ul>
+<p>Newt then looks at the target that the user set, for example, blinky_sim:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ more targets/my_blinky_sim/
+pkg.yml target.yml
+$ more targets/my_blinky_sim/target.yml
+### Target: targets/my_blinky_sim
+target.app: "apps/blinky"
+target.bsp: "@apache-mynewt-core/hw/bsp/native"
+target.build_profile: "debug"
+</pre></div>
+
+
+<p><br></p>
+<p>The target specifies two major things:</p>
+<ul>
+<li>Application (target.app): The application to build</li>
+<li>Board Support Package (target.bsp): The board support package to build
+along with that application.</li>
+</ul>
+<p>Newt goes and builds the dependency tree specified by all the packages. While building this tree, it does a few other things:</p>
+<ul>
+<li>Any package that depends on another package, automatically gets the include directories from the package it includes. Include directories in the
+newt structure must always be prefixed by the package name. For example, libs/os has the following include tree and its include directory files contains the package name "os" before any header files. This is so in order to avoid any header file conflicts.</li>
+</ul>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ tree
+.
+├── README.md
+├── include
+│ └── os
+│ ├── arch
+│ │ ├── cortex_m0
+│ │ │ └── os
+│ │ │ └── os_arch.h
+│ │ ├── cortex_m4
+│ │ │ └── os
+│ │ │ └── os_arch.h
+│ │ └── sim
+│ │ └── os
+│ │ └── os_arch.h
+│ ├── endian.h
+│ ├── os.h
+│ ├── os_callout.h
+│ ├── os_cfg.h
+│ ├── os_eventq.h
+│ ├── os_heap.h
+│ ├── os_malloc.h
+│ ├── os_mbuf.h
+│ ├── os_mempool.h
+│ ├── os_mutex.h
+│ ├── os_sanity.h
+│ ├── os_sched.h
+│ ├── os_sem.h
+│ ├── os_task.h
+│ ├── os_test.h
+│ ├── os_time.h
+│ └── queue.h
+├── pkg.yml
+└── src
+ ├── arch
+<snip>
+</pre></div>
+
+
+<p><br></p>
+<ul>
+<li>
+<p>API requirements are validated. Packages can export APIs they
+implement, (i.e. pkg.api: hw-hal-impl), and other packages can require
+those APIs (i.e. pkg.req_api: hw-hal-impl).</p>
+</li>
+<li>
+<p>"Features" options are supported. Packages can change what dependencies
+they have, or what flags they are using based upon what features are enabled in the system. As an example, many packages will add additional software, based on whether the shell package is present. To do this, they can overwrite cflags or deps based upon the shell "feature."</p>
+</li>
+</ul>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">pkg.cflags.SHELL: -DSHELL_PRESENT
+</pre></div>
+
+
+<p><br></p>
+<p>In order to properly resolve all dependencies in the build system, Newt recursively processes the package dependencies until there are no new dependencies or features (because features can add dependencies.) And it builds a big list of all the packages that need to be build.</p>
+<p>Newt then goes through this package list, and builds every package into
+an archive file.</p>
+<p><strong>NOTE:</strong> The Newt tool generates compiler dependencies for all of these packages, and only rebuilds the packages whose dependencies have changed. Changes in package & project dependencies are also taken into account. It is smart, after all!</p>
+<h3 id="producing-artifacts">Producing artifacts<a class="headerlink" href="#producing-artifacts" title="Permanent link">¶</a></h3>
+<p>Once Newt has built all the archive files, it then links the archive files together. The linkerscript to use is specified by the board support package (BSP.)</p>
+<p>NOTE: One common use of the "features" option above is to overwrite
+which linkerscript is used, based upon whether or not the BSP is being
+build for a raw image, bootable image or bootloader itself.</p>
+<p>The newt tool places all of it's artifacts into the bin/ directory at
+the top-level of the project, prefixed by the target name being built,
+for example:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ tree -L 4 bin/
+bin/
+└── my_blinky_sim
+ ├── apps
+ │ └── blinky
+ │ ├── blinky.a
+ │ ├── blinky.a.cmd
+ │ ├── blinky.elf
+ │ ├── blinky.elf.cmd
+ │ ├── blinky.elf.dSYM
+ │ ├── blinky.elf.lst
+ │ ├── main.d
+ │ ├── main.o
+ │ └── main.o.cmd
+ ├── hw
+ │ ├── bsp
+ │ │ └── native
+ │ ├── hal
+ │ │ ├── flash_map.d
+ │ │ ├── flash_map.o
+<snip>
+</pre></div>
+
+
+<p><br></p>
+<p>As you can see, a number of files are generated:</p>
+<ul>
+<li>Archive File</li>
+<li>*.cmd: The command use to generate the object or archive file</li>
+<li>*.lst: The list file where symbols are located</li>
+<li>*.o The object files that get put into the archive file</li>
+</ul>
+<h3 id="downloaddebug-support">Download/Debug Support<a class="headerlink" href="#downloaddebug-support" title="Permanent link">¶</a></h3>
+<p>Once a target has been build, there are a number of helper functions
+that work on the target. These are:</p>
+<ul>
+<li><strong>download</strong> Download built target to board</li>
+<li><strong>debug</strong> Open debugger session to target</li>
+<li>size Size of target components</li>
+<li>create-image Add image header to target binary</li>
+</ul>
+<p>Download and debug handles driving GDB and the system debugger. These
+commands call out to scripts that are defined by the BSP.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ more repos/apache-mynewt-core/hw/bsp/nrf52pdk/nrf52pdk_debug.sh
+<snip>
+#
+if [ $# -lt 1 ]; then
+ echo "Need binary to download"
+ exit 1
+fi
+
+FILE_NAME=$2.elf
+GDB_CMD_FILE=.gdb_cmds
+
+echo "Debugging" $FILE_NAME
+
+# Monitor mode. Background process gets it's own process group.
+set -m
+JLinkGDBServer -device nRF52 -speed 4000 -if SWD -port 3333 -singlerun &
+set +m
+
+echo "target remote localhost:3333" > $GDB_CMD_FILE
+
+arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+
+rm $GDB_CMD_FILE
+</pre></div>
+
+
+<p>The idea is that every BSP will add support for the debugger environment
+for that board. That way common tools can be used across various development boards and kits.</p>
+<p><strong>NOTE:</strong> Both for compiler definitions and debugger scripts, the plan is to
+create Dockerizable containers of these toolchains. This should make
+things much easier to support across Mac OS X, Linux and Windows. Newt
+will know how to call out to Docker to perform these processes.</p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../install/newt_linux/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Install Newt on Linux
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../newt_ops/>
+ Next: User Guide
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/newt_ops/index.html
----------------------------------------------------------------------
diff --git a/newt/newt_ops/index.html b/newt/newt_ops/index.html
index 8b8f184..a2305e3 100644
--- a/newt/newt_ops/index.html
+++ b/newt/newt_ops/index.html
@@ -9,7 +9,7 @@
<link rel="canonical" href="http://mynewt.apache.org/newt/newt_ops/">
<link rel="shortcut icon" href="../../img/favicon.ico">
- <title>Command structure - Apache Mynewt</title>
+ <title>toc - Apache Mynewt</title>
<link href="../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
<link href="../../css/font-awesome-4.0.3.css" rel="stylesheet">
@@ -40,7 +40,7 @@
</head>
- <body class="Command structure">
+ <body class="toc">
<div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,22 +237,12 @@
- <li><a href="
- ./
-">Manual</a>
+ <li class="active"><a href="./">User Guide</a></li>
<ul class="current-toc">
-
-
- <li class="active">
- Command structure
- </li>
-
-
-
@@ -362,12 +349,10 @@
- <li>» Manual</li>
+ <li>» User Guide</li>
- <li>» Command structure</li>
-
</ul>
@@ -422,9 +407,9 @@
<ul class="nav nav-pills" style="margin-bottom: 10px">
<li>
- <a href=../tutorials/define_target/>
+ <a href=../newt_operation/>
<span class="fa fa-arrow-left"></span>
- Previous: Define a target
+ Previous: Newt Theory of Ops
</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/tutorials/define_target/index.html
----------------------------------------------------------------------
diff --git a/newt/tutorials/define_target/index.html b/newt/tutorials/define_target/index.html
deleted file mode 100644
index a4f3ab9..0000000
--- a/newt/tutorials/define_target/index.html
+++ /dev/null
@@ -1,433 +0,0 @@
-<!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">
-
-
- <link rel="canonical" href="http://mynewt.apache.org/newt/tutorials/define_target/">
- <link rel="shortcut icon" href="../../../img/favicon.ico">
-
- <title>Define a target - Apache Mynewt</title>
-
- <link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
- <link href="../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
- <link href="../../../extra.css" rel="stylesheet">
-
- <!-- 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', 'mynewt.incubator.apache.org');
- ga('send', 'pageview');
- </script>
-
- </head>
-
-
- <body class="Define a target">
-
-
- <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
- <div class="logo-container">
- <img src="/img/logo.svg">
- </div>
- <div class="container-fluid">
- <!-- 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>
- <a href="/">Home</a>
- </li>
- <li>
- <a href="/about/">About</a>
- </li>
- <li class="dropdown">
- <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
- <ul class="dropdown-menu">
-
-
-
-
-
-
- <li >
- <a href="../../../documentation/">
- Overview
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li >
- <a href="../../../os/get_started/introduction/">
- Mynewt OS Manual
- </a>
- </li>
-
-
-
- <li class="active">
- <a href="../../newt_intro/">
- Newt Tool Manual
- </a>
- </li>
-
-
-
- <li >
- <a href="../../../newtmgr/overview/">
- Newt Manager Manual
- </a>
- </li>
-
-
-
- <li >
- <a href="../../../os/tutorials/how_to_edit_docs/">
- Appendix
- </a>
- </li>
-
-
- </ul>
- </li>
- <li>
- <a href="/download/">Download</a>
- </li>
- <li>
- <a href="/community/">Community</a>
- </li>
- <li>
- <a href="/events/">Events</a>
- </li>
- </ul>
-
- <!-- Search, Navigation and Repo links -->
- <ul class="nav navbar-nav navbar-right">
-
- </ul>
- </div>
- </div>
-</div>
-
-
-
- <div class="container-fluid">
-
- <div class="row sm-extra-padding">
- <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
- <div class="sidebar-top">
- <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
- <div class="small" role="search">
- <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
- <div class="form-group">
- <input type="text" name="q" placeholder="Search documentation" />
- <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
- </div>
- </form>
- </div>
- </div>
- <ul class="nav bs-sidenav">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li><a href="
- ../../../os/get_started/introduction/
-">Mynewt OS Manual</a>
-
-
- </li>
-
-
-
-
-
-
-
- <li><a href="
- ../../newt_intro/
-">Newt Tool Manual</a>
-
-
- <ul class="current-toc">
-
-
-
-
- <li>
- <a href="../../newt_intro/">Introduction</a>
- </li>
-
-
-
-
-
-
-
-
- <li><a href="
- ../../install/newt_mac/
-">Install</a>
-
-
- </li>
-
-
-
-
-
-
-
- <li><a href="
- ./
-">Tutorials</a>
-
-
- <ul class="current-toc">
-
-
-
-
- <li class="active">
- Define a target
- </li>
-
-
-
-
- </ul>
-
- </li>
-
-
-
-
-
-
-
- <li><a href="
- ../../newt_ops/
-">Manual</a>
-
-
- </li>
-
-
-
- </ul>
-
- </li>
-
-
-
-
-
-
-
- <li><a href="
- ../../../newtmgr/overview/
-">Newt Manager Manual</a>
-
-
- </li>
-
-
-
-
-
-
-
- <li><a href="
- ../../../os/tutorials/how_to_edit_docs/
-">Appendix</a>
-
-
- </li>
-
-
-
- </ul>
-</div></div>
-
- <div class="show-sidebar-container">
- <button class="show-sidebar">Docs Menu</button>
- </div>
-
- <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
- <div class="row doc-header">
- <div class="col-sm-6">
-
-<ul class="nav nav-pills">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li role="presentation"><a href="../../../os/get_started/introduction/">Mynewt OS</a></li>
-
-
-
- <li class="active" role="presentation"><a href="../../newt_intro/">Newt Tool</a></li>
-
-
-
- <li role="presentation"><a href="../../../newtmgr/overview/">Newt Mgr</a></li>
-
-
-
-
-</ul>
- </div>
- <div class="col-sm-6">
- <div role="navigation" aria-label="breadcrumbs navigation">
- <ul class="wy-breadcrumbs">
- <li><a href="/documentation/">Docs</a></li>
-
-
-
- <li>» <a href="../../newt_intro/">Newt Tool Manual</a></li>
-
-
-
- <li>» Tutorials</li>
-
-
-
- <li>» Define a target</li>
-
-
-
- </ul>
-</div>
- </div>
- </div>
-
- <h2 id="how-to-define-a-target">How to Define a Target<a class="headerlink" href="#how-to-define-a-target" title="Permanent link">¶</a></h2>
-<p>What newt commands to use?</p>
-
- <div class="row">
-
-
-
-
-<ul class="nav nav-pills" style="margin-bottom: 10px">
- <li>
-
- <a href=../../install/newt_linux/>
- <span class="fa fa-arrow-left"></span>
- Previous: Install Newt on Linux
- </a>
-
- </li>
- <li class="pull-right">
-
- <a href=../../newt_ops/>
- Next: Command structure
- <span class="fa fa-arrow-right"></span>
- </a>
-
- </li>
-</ul>
- </div>
- <div class="row">
- <footer>
- <div class="row">
- <div class="col-md-12">
-
- <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
-
- </div>
- </div>
- <div class="copyright-logos">
- <div class="row">
- <div class="col-xs-6 text-right">
- <img src="/img/apache-feather.png" alt="Apache" title="Apache">
- </div>
- <div class="col-xs-6 text-left">
- <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <small class="footnote">
- MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
- </small>
- </div>
- </div>
-</footer>
- </div>
- </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>
-
- </body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newtmgr/project-slinky/index.html
----------------------------------------------------------------------
diff --git a/newtmgr/project-slinky/index.html b/newtmgr/project-slinky/index.html
index cf0b02a..6c4980c 100644
--- a/newtmgr/project-slinky/index.html
+++ b/newtmgr/project-slinky/index.html
@@ -412,7 +412,7 @@
<h3 id="setting-up-your-target-build">Setting up your target build<a class="headerlink" href="#setting-up-your-target-build" title="Permanent link">¶</a></h3>
<p>Create a target for <code>slinky</code> using the native bsp. See
-<a href="../../newt/tutorials/define_target/">How to Define a Target</a> for a detailed
+<a href="../newt/tutorials/define_target.md">How to Define a Target</a> for a detailed
description. We will list only the steps and suppress the tool output
here for brevity.</p>
<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target create sim_slinky
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newtmgr/project-target-slinky/index.html
----------------------------------------------------------------------
diff --git a/newtmgr/project-target-slinky/index.html b/newtmgr/project-target-slinky/index.html
index b553a1b..f797d64 100644
--- a/newtmgr/project-target-slinky/index.html
+++ b/newtmgr/project-target-slinky/index.html
@@ -420,7 +420,7 @@ Repos successfully installed
<p><br></p>
<h3 id="set-up-your-target-builds">Set up your target builds<a class="headerlink" href="#set-up-your-target-builds" title="Permanent link">¶</a></h3>
<p>Create a target for <code>stm32_slinky</code> using the native bsp. See
-<a href="../../newt/tutorials/define_target/">How to Define a Target</a> for a detailed
+<a href="../newt/tutorials/define_target.md">How to Define a Target</a> for a detailed
description. The tool output is suppressed below for brevity.</p>
<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ newt target create stm32_slinky
$ newt target set stm32_slinky bsp=@apache-mynewt-core/hw/bsp/olimex_stm32-e407_devboard
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/modules/logs/logs/index.html
----------------------------------------------------------------------
diff --git a/os/modules/logs/logs/index.html b/os/modules/logs/logs/index.html
index 88bca22..5b1e4fe 100644
--- a/os/modules/logs/logs/index.html
+++ b/os/modules/logs/logs/index.html
@@ -691,7 +691,7 @@ structure. </p>
<li class="pull-right">
<a href=../../../../network/ble/ble_intro/>
- Next: BLE Stack
+ Next: NimBLE - Mynewt BLE Stack
<span class="fa fa-arrow-right"></span>
</a>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/os_user_guide/index.html
----------------------------------------------------------------------
diff --git a/os/os_user_guide/index.html b/os/os_user_guide/index.html
index 3d6c0fc..d04bcd2 100644
--- a/os/os_user_guide/index.html
+++ b/os/os_user_guide/index.html
@@ -548,7 +548,7 @@
<a href=../tutorials/event_queue/>
<span class="fa fa-arrow-left"></span>
- Previous: A task to manage multiple events
+ Previous: Add task to manage multiple events
</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/STM32F303/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/STM32F303/index.html b/os/tutorials/STM32F303/index.html
index be2f8be..587e7bb 100644
--- a/os/tutorials/STM32F303/index.html
+++ b/os/tutorials/STM32F303/index.html
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/add_repos/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/add_repos/index.html b/os/tutorials/add_repos/index.html
index 1dca5de..3570bfd 100644
--- a/os/tutorials/add_repos/index.html
+++ b/os/tutorials/add_repos/index.html
@@ -9,7 +9,7 @@
<link rel="canonical" href="http://mynewt.apache.org/os/tutorials/add_repos/">
<link rel="shortcut icon" href="../../../img/favicon.ico">
- <title>Additional Repositories - Apache Mynewt</title>
+ <title>Add repo to project - Apache Mynewt</title>
<link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
<link href="../../../css/font-awesome-4.0.3.css" rel="stylesheet">
@@ -40,7 +40,7 @@
</head>
- <body class="Additional Repositories">
+ <body class="Add repo to project">
<div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Add repo to project
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -293,8 +333,8 @@
- <li class="active">
- Additional Repositories
+ <li>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
@@ -446,7 +486,7 @@
- <li>» Additional Repositories</li>
+ <li>» Add repo to project</li>
@@ -455,22 +495,17 @@
</div>
</div>
- <h2 id="additional-repositories">Additional Repositories<a class="headerlink" href="#additional-repositories" title="Permanent link">¶</a></h2>
+ <h2 id="adding-repositories-to-your-project">Adding Repositories to your Project<a class="headerlink" href="#adding-repositories-to-your-project" title="Permanent link">¶</a></h2>
<h3 id="what-is-a-repository">What is a Repository<a class="headerlink" href="#what-is-a-repository" title="Permanent link">¶</a></h3>
-<p>A repository is a version-ed Mynewt project, which is a
-collection of Mynewt packages organized in a specific
-way. </p>
+<p>A repository is a version-ed Mynewt project, which is a collection of Mynewt packages organized in a specific way for redistribution. </p>
<p>What differentiates a repository from a Mynewt project is the presence of a
<code>repository.yml</code> file describing the repository. This will be described
-below. <strong>Note:</strong> For the remainder of this document we'll use the term repo as shorthand for a
-Mynewt repository.</p>
-<p>Repos are useful because they are an organized way for the community
-to share Mynewt packages and projects. In fact, the Mynewt-core is
-distributed as a repo.</p>
+below. For a basic understanding of repositories you may read the <a href="../../../newt/newt_intro/">Newt Tool Manual</a> and <a href="../../newt/create_repo.md">How to create repos</a>.</p>
+<p><strong>Note:</strong> For the remainder of this document we'll use the term repo as shorthand for a Mynewt repository.</p>
+<p>Repos are useful because they are an organized way for the community to share Mynewt packages and projects. In fact, the Mynewt-core is distributed as a repo.</p>
<p><br></p>
<h3 id="why-does-mynewt-need-additional-repos">Why does Mynewt need additional repos?<a class="headerlink" href="#why-does-mynewt-need-additional-repos" title="Permanent link">¶</a></h3>
-<p>Repos add functionality not included in the Mynewt core. New repos might be created for
-several reasons.</p>
+<p>Repos add functionality not included in the Mynewt core. New repos might be created for several reasons.</p>
<ul>
<li><strong>Expertise</strong>. Individuals or organizations may have expertise that they want
to share in the form of repos. For example a chip vendor may
@@ -507,8 +542,8 @@ $ cd myproj
additional lines to the <code>project.repositories</code> variable like this.</p>
<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">project.repositories:
- apache-Mynewt-core
- - another_repo_named_x
-</pre></div>
+<span style="background-color: #ffffcc"> - another_repo_named_x
+</span></pre></div>
<p><br></p>
@@ -569,7 +604,7 @@ section includes information on the field required in your repo descriptor.</p>
variable with the name of the repo you are adding. </p>
</li>
</ul>
-<p>An example if a <code>project.yml</code> file with two repositories is shown below:</p>
+<p>An example of a <code>project.yml</code> file with two repositories is shown below:</p>
<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">project.name: "my_project"
project.repositories:
@@ -605,19 +640,14 @@ please use <code>0-latest</code> in the <code>vers</code> field in your repo des
</pre></div>
-<p>See below for a description of the version system.</p>
+<p>See <a href="../../../newt/create_repo">Create a Repo</a> for a description of the versioning system and all the possible ways to specify a version to use.</p>
<p><br></p>
-<h3 id="what-is-in-a-repo">What is in a Repo<a class="headerlink" href="#what-is-in-a-repo" title="Permanent link">¶</a></h3>
-<p>A repo is a collection of Mynewt packages organized in a specific
-way and stored in one of the supported code storage methods described above. </p>
-<p>A repo is a Mynewt project with an additional file <code>repository.yml</code>
-which describes the repo for use by <code>newt</code> (and humans browsing them).</p>
-<p>There is one key consideration for this <code>repository.yml</code> file. The
-<code>repository.yml</code> file only lives in the master branch of the git
+<h3 id="identifying-a-repo">Identifying a Repo<a class="headerlink" href="#identifying-a-repo" title="Permanent link">¶</a></h3>
+<p>A repo contains Mynewt packages organized in a specific way and stored in one of the supported code storage methods described above. In other words, it is a Mynewt project with an additional file <code>repository.yml</code> which describes the repo for use by <code>newt</code> (and humans browsing them). It contains a mapping of version numbers to the actual github branches containing the source code.</p>
+<p>Note that the <code>repository.yml</code> file lives only in the master branch of the git
repository. <code>Newt</code> will always fetch this file from the master branch and then
-use that to resolve the actual branch required depending on the version
-specified in the project. Special care should be taken to ensure that this
-file exists only in the master branch.</p>
+use that to determine the actual branch required depending on the version
+specified in your <code>project.yml</code> file. Special care should be taken to ensure that this file exists only in the master branch.</p>
<p>Here is the <code>repository.yml</code> file from the apache-Mynewt-core:</p>
<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">repo.name: apache-mynewt-core
repo.versions:
@@ -633,12 +663,11 @@ repo.versions:
<li><strong>repo.name</strong> The external name that is used to include the library in
your <code>project.yml</code> file. This is the name you in include in the <code>project.repositories</code> variable when adding this repository to your project.</li>
<li><strong>repo.versions</strong> A description of what versions to give the user depending
-on the settings in their <code>project.yml</code> file. See below for a thorough description
-on versioning. Its a flexible mapping between version numbers and git branches.</li>
+on the settings in their <code>project.yml</code> file. </li>
</ul>
<p><br></p>
<h3 id="repo-version">Repo Version<a class="headerlink" href="#repo-version" title="Permanent link">¶</a></h3>
-<p>The version field argument in your <code>project.yml</code> file has the following format:</p>
+<p>The repo version number resolves to an actual git branch depending on the mapping specified in <code>repository.yml</code> for that repo. The version field argument in your <code>project.yml</code> file supports multiple formats for flexibility:</p>
<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><major_num>.<minor_num>.<revision_num>
</pre></div>
@@ -674,9 +703,10 @@ the version number and stability value. For example:</p>
<p><br></p>
-<p>A <code>repository.yml</code> file contains information to match this version request
+<h3 id="repo-versions-available">Repo Versions Available<a class="headerlink" href="#repo-versions-available" title="Permanent link">¶</a></h3>
+<p>A <code>repository.yml</code> file contains information to match a version request
into a git branch to fetch for your project.</p>
-<p>Its up to the repository maintainer to map these to branches of the
+<p>It's up to the repository maintainer to map these to branches of the
repository. For example, let's say in a fictitious repository the following are
defined.</p>
<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">repo.versions:
@@ -696,10 +726,11 @@ defined.</p>
</pre></div>
-<p>When the <code>project.yml</code> file asks for <code>1.2-stable</code> its resolved to version
-<code>1.2.0</code> (perhaps <code>1.2.1</code> is not stable yet), which resolves to a specific
+<p>When the <code>project.yml</code> file asks for <code>1.2-stable</code> it is resolved to version
+<code>1.2.0</code> (perhaps <code>1.2.1</code> is not stable yet), which in turn resolves to a specific
branch <code>xxx_branch_1_2_0</code>. This is the branch that <code>newt</code> fetches into
-your project.</p>
+your project. </p>
+<p><strong>Note:</strong> Make sure a repo version exists in the <code>repository.yml</code> file of a repo you wish to add. Otherwise Newt will not be able to resolve the version and will fail to fetch the repo into your project.</p>
<p><br></p>
<h3 id="how-to-find-out-what-repos-are-available-for-mynewt-components">How to find out what Repos are available for Mynewt components<a class="headerlink" href="#how-to-find-out-what-repos-are-available-for-mynewt-components" title="Permanent link">¶</a></h3>
<p>Currently, there is no <code>newt</code> command to locate/search Mynewt package
@@ -722,16 +753,16 @@ should give you all the information to add it to your <code>project.yml</code> f
<ul class="nav nav-pills" style="margin-bottom: 10px">
<li>
- <a href=../air_quality_sensor/>
+ <a href=../define_target/>
<span class="fa fa-arrow-left"></span>
- Previous: Air-quality Sensor project
+ Previous: Define a target
</a>
</li>
<li class="pull-right">
- <a href=../event_queue/>
- Next: A task to manage multiple events
+ <a href=../create_repo/>
+ Next: Create a repo
<span class="fa fa-arrow-right"></span>
</a>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/air_quality_sensor/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/air_quality_sensor/index.html b/os/tutorials/air_quality_sensor/index.html
index b855f25..cd7fa20 100644
--- a/os/tutorials/air_quality_sensor/index.html
+++ b/os/tutorials/air_quality_sensor/index.html
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
@@ -1228,8 +1268,8 @@ targets/air_q
</li>
<li class="pull-right">
- <a href=../add_repos/>
- Next: Additional Repositories
+ <a href=../bletiny_project/>
+ Next: Enable BLE using nimBLE
<span class="fa fa-arrow-right"></span>
</a>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/arduino_zero/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/arduino_zero/index.html b/os/tutorials/arduino_zero/index.html
index 3e2ec5a..6dec9d5 100644
--- a/os/tutorials/arduino_zero/index.html
+++ b/os/tutorials/arduino_zero/index.html
@@ -274,6 +274,46 @@
<li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
<a href="../unit_test/">Write a Test Suite for a Package</a>
</li>
@@ -294,7 +334,7 @@
<li>
- <a href="../add_repos/">Additional Repositories</a>
+ <a href="../bletiny_project/">Enable BLE using nimBLE</a>
</li>
@@ -304,7 +344,7 @@
<li>
- <a href="../event_queue/">A task to manage multiple events</a>
+ <a href="../event_queue/">Add task to manage multiple events</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/os/tutorials/bletiny_project/index.html
----------------------------------------------------------------------
diff --git a/os/tutorials/bletiny_project/index.html b/os/tutorials/bletiny_project/index.html
new file mode 100644
index 0000000..b5722ae
--- /dev/null
+++ b/os/tutorials/bletiny_project/index.html
@@ -0,0 +1,566 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/tutorials/bletiny_project/">
+ <link rel="shortcut icon" href="../../../img/favicon.ico">
+
+ <title>Enable BLE using nimBLE - Apache Mynewt</title>
+
+ <link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Enable BLE using nimBLE">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../tutorials/">Tutorials</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li>
+ <a href="../arduino_zero/">Blinky on Arduino Zero</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../olimex/">Blinky on Olimex</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../STM32F303/">Blinky on STM32F303</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../nRF52/">Blinky on nRF52</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../define_target/">Define a target</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../add_repos/">Add repo to project</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../create_repo/">Create a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../upgrade_repo/">Upgrade a repo</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../unit_test/">Write a Test Suite for a Package</a>
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../air_quality_sensor/">Air-quality Sensor project</a>
+ </li>
+
+
+
+
+
+
+
+ <li class="active">
+ Enable BLE using nimBLE
+ </li>
+
+
+
+
+
+
+
+ <li>
+ <a href="../event_queue/">Add task to manage multiple events</a>
+ </li>
+
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../../network/ble/ble_intro/
+
+">Networking User Guide</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» <a href="../../get_started/introduction/">Mynewt OS Manual</a></li>
+
+
+
+ <li>» <a href="../tutorials/">Tutorials</a></li>
+
+
+
+ <li>» Enable BLE using nimBLE</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="nimble-project">NimBLE project<a class="headerlink" href="#nimble-project" title="Permanent link">¶</a></h2>
+<p>This tutorial explains how to start BLE 4.2 on a board and start seeing some BLE related statistics. </p>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../air_quality_sensor/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: Air-quality Sensor project
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../event_queue/>
+ Next: Add task to manage multiple events
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
[6/7] incubator-mynewt-site git commit: Broke NimBLE tutorial into
multiple sections. Added Newt tutorial and theory of ops. Rearranged
tutorials for better flow. This is work in progress.
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/mkdocs/search_index.json
----------------------------------------------------------------------
diff --git a/mkdocs/search_index.json b/mkdocs/search_index.json
index 3e9356b..342b95c 100644
--- a/mkdocs/search_index.json
+++ b/mkdocs/search_index.json
@@ -516,6 +516,121 @@
"title": "Congratulations"
},
{
+ "location": "/os/tutorials/define_target/",
+ "text": "How to Define a Target\n\n\nWhat newt commands to use?",
+ "title": "Define a target"
+ },
+ {
+ "location": "/os/tutorials/define_target/#how-to-define-a-target",
+ "text": "What newt commands to use?",
+ "title": "How to Define a Target"
+ },
+ {
+ "location": "/os/tutorials/add_repos/",
+ "text": "Adding Repositories to your Project\n\n\nWhat is a Repository\n\n\nA repository is a version-ed Mynewt project, which is a collection of Mynewt packages organized in a specific way for redistribution. \n\n\nWhat differentiates a repository from a Mynewt project is the presence of a\n\nrepository.yml\n file describing the repository. This will be described \nbelow. For a basic understanding of repositories you may read the \nNewt Tool Manual\n and \nHow to create repos\n.\n\n\nNote:\n For the remainder of this document we'll use the term repo as shorthand for a Mynewt repository.\n\n\nRepos are useful because they are an organized way for the community to share Mynewt packages and projects. In fact, the Mynewt-core is distributed as a repo.\n\n\n\n\nWhy does Mynewt need additional repos?\n\n\nRepos add functionality not included in the Mynewt core. New repos might be created for several reasons.\n\n\n\n\nExpertise\n. Individuals or organizations may have expe
rtise that they want\nto share in the form of repos. For example a chip vendor may\ncreate a repo to hold the Mynewt support for their chips.\n\n\nNon-Core component\n. Some components, although very useful to Mynewt users\nare not core to all Mynewt users. These are likely candidates to be held in \ndifferent repos.\n\n\nSoftware licensing\n. Some software have licenses that make them incompatible\nwith the ASF (Apache Software Foundation) license policies. These may be \nvaluable components to some Mynewt users, but cannot be contained in the \napache-Mynewt-core\n.\n\n\n\n\n\n\nWhat Repos are in my Project\n\n\nThe list of repos used by your project are contained within the \n\nproject.yml\n file. An example can be seen by creating a new project:\n\n\n$ mkdir ~/dev\n$ cd ~/dev\n$ newt new myproj\n$ cd myproj\n\n\n\n\n\n\n\nView the \nproject.yml\n section and you will see a line describing the repos:\n\n\nproject.repositories:\n - apache-Mynewt-core\n\n\n\n\n\n \n\n\nBy d
efault, this newly created project uses a single repo called \n\napache-Mynewt-core\n. \n\n\nIf you wish to add additional repos, you would add \nadditional lines to the \nproject.repositories\n variable like this.\n\n\nproject.repositories:\n - apache-Mynewt-core\n\n - another_repo_named_x\n\n\n\n\n\n\n\nRepo Descriptors\n\n\nIn addition to the repo name, the \nproject.yml\n file must also contain\na repo descriptor for each repository you include that gives \nnewt\n \ninformation on obtaining the repo.\n\n\nIn the same \nmyproj\n above you will see the following repo descriptor.\n\n\nrepository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubator-mynewt-core\n\n\n\n\n\nA repo descriptor starts with \nrepository.\nname\n.\n. In this example, the \ndescriptor specifies the information for the \napache-Mynewt-core\n.\n\n\n\n\nThe fields within the descriptor have the following definitions:\n\n\n\n\n\n\ntype\n -- The type of code sto
rage the repo uses. The current version\nof \nnewt\n only supports github. Future versions may support generic git or other\ncode storage mechanisms.\n\n\n\n\n\n\nvers\n -- The version of the repo to use for your project. A source\ncode repository contains many versions of the source. This field is used to \nspecify the one to use for this project. See the section on versions below \nfor a detailed description of the format of this field.\n\n\n\n\n\n\nuser\n -- The username for the repo. On github, this is the name\nafter \ngithub.com\n in the repo path. Consider the repository \n\nhttps://github.com/apache/incubator-mynewt-core\n. It has username \napache\n. \n\n\n\n\n\n\nrepo\n -- The name of the repo. On github, this is the name after\nthe username described above. Consider the repository \n\nhttps://github.com/apache/incubator-mynewt-core\n. It has username \n\nincubator-mynewt-core\n. This is a path to the source control\nand should not be confused with the name of th
e repo that you used in the \n\nrepository.\nname\n declaration above. That name is contained elsewhere\nwithin the repo. See Below.\n\n\n\n\n\n\n\n\nAdding Existing Repos to my Project\n\n\nTo add a new repo to your project, you have to complete two steps.\n\n\n\n\n\n\nEdit the \nproject.yml\n file and add a new repo descriptor. The previous\nsection includes information on the field required in your repo descriptor.\n\n\n\n\n\n\nEdit the \nproject/yml\n file and add a new line to the \nproject.repositories\n\nvariable with the name of the repo you are adding. \n\n\n\n\n\n\nAn example of a \nproject.yml\n file with two repositories is shown below:\n\n\nproject.name: \nmy_project\n\n\nproject.repositories:\n - apache-Mynewt-core\n - Mynewt_arduino_zero\n\n# Use github\ns distribution mechanism for core ASF libraries.\n# This provides mirroring automatically for us.\n#\nrepository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubat
or-mynewt-core\n\n# a special repo to hold hardware specific stuff for arduino zero\nrepository.Mynewt_arduino_zero:\n type: github\n vers: 0-latest\n user: runtimeinc\n repo: Mynewt_arduino_zero\n\n\n\n\n\n\n\nWhat Version of the Repo to use\n\n\nMynewt repos are version-ed artifacts. They are stored in source control \nsystems like github. The repo descriptor in your \nproject.yml\n file must\nspecify the version of the repo you will accept into your project.\n\n\nFor now, we are at the beginnings of Mynewt. For testing and evaluation\nplease use \n0-latest\n in the \nvers\n field in your repo descriptor.\n\n\n vers:0-latest\n\n\n\n\n\nSee \nCreate a Repo\n for a description of the versioning system and all the possible ways to specify a version to use.\n\n\n\n\nIdentifying a Repo\n\n\nA repo contains Mynewt packages organized in a specific way and stored in one of the supported code storage methods described above. In other words, it is a Mynewt project with an a
dditional file \nrepository.yml\n which describes the repo for use by \nnewt\n (and humans browsing them). It contains a mapping of version numbers to the actual github branches containing the source code.\n\n\nNote that the \nrepository.yml\n file lives only in the master branch of the git\nrepository. \nNewt\n will always fetch this file from the master branch and then\nuse that to determine the actual branch required depending on the version\nspecified in your \nproject.yml\n file. Special care should be taken to ensure that this file exists only in the master branch.\n\n\nHere is the \nrepository.yml\n file from the apache-Mynewt-core:\n\n\nrepo.name: apache-mynewt-core\nrepo.versions:\n \n0.7.9\n: \nMynewt_0_8_0_b2_tag\n\n \n0-latest\n: \n0.7.9\n\n \n0.8-latest\n: \n0.7.9\n\n\n\n\n\n\n\n\nIt contains the following:\n\n\n\n\nrepo.name\n The external name that is used to include the library in \nyour \nproject.yml\n file. This is the name you in include in the \nproj
ect.repositories\n variable when adding this repository to your project.\n\n\nrepo.versions\n A description of what versions to give the user depending \non the settings in their \nproject.yml\n file. \n\n\n\n\n\n\nRepo Version\n\n\nThe repo version number resolves to an actual git branch depending on the mapping specified in \nrepository.yml\n for that repo. The version field argument in your \nproject.yml\n file supports multiple formats for flexibility:\n\n\nmajor_num\n.\nminor_num\n.\nrevision_num\n\n\n\n\n\n\nor\n\n\nmajor_num\n.\nminor_num\n-\nstability string\n\n\n\n\n\n\nor \n\n\nmajor_num\n-\nstability string\n\n\n\n\n\n\n\n\nThe stability string can be one of 3 pre-defined stability values.\n\n\n\n\nstable -- A stable release version of the repository\n\n\ndev -- A development version from the repository\n\n\nlatest -- The latest from the repository\n\n\n\n\nIn your \nproject.yml\n file you can specify different combinations of \nthe version number and stability value.
For example:\n\n\n\n\n0-latest\n -- The latest version with major number 0\n\n\n1.2-stable\n -- The latest stable version with major and minor number 1.2\n\n\n1.2-dev\n -- The development version from 1.2\n\n\n1.1.1\n -- a specific version 1.1.1\n\n\n\n\nYou cannot specify a stability string with a fully numbered version, e.g.\n\n\n1.2.8-stable\n\n\n\n\n\n\n\nRepo Versions Available\n\n\nA \nrepository.yml\n file contains information to match a version request\ninto a git branch to fetch for your project.\n\n\nIt's up to the repository maintainer to map these to branches of the \nrepository. For example, let's say in a fictitious repository the following are \ndefined.\n\n\nrepo.versions:\n \n0.8.0\n: \nxxx_branch_0_8_0\n\n \n1.0.0\n: \nxxx_branch_1_0_0\n\n \n1.0.2\n: \nxxx_branch_1_0_2\n\n \n1.1.1\n: \nxxx_branch_1_1_0\n\n \n1.1.2\n: \nxxx_branch_1_1_2\n\n \n1.2.0\n: \nxxx_branch_1_2_0\n\n \n1.2.1\n: \nxxx_branch_1_2_1\n\n \n1.2-dev\
n: \n1.2.1\n\n \n1-dev\n: \n1.2-dev\n\n \n1.2-stable\n: \n1.2.0\n\n \n0-latest\n: \n0.8.0\n\n \n1-latest\n: \n1-dev\n\n ....\n\n\n\n\n\nWhen the \nproject.yml\n file asks for \n1.2-stable\n it is resolved to version\n\n1.2.0\n (perhaps \n1.2.1\n is not stable yet), which in turn resolves to a specific\nbranch \nxxx_branch_1_2_0\n. This is the branch that \nnewt\n fetches into \nyour project. \n\n\nNote:\n Make sure a repo version exists in the \nrepository.yml\n file of a repo you wish to add. Otherwise Newt will not be able to resolve the version and will fail to fetch the repo into your project.\n\n\n\n\nHow to find out what Repos are available for Mynewt components\n\n\nCurrently, there is no \nnewt\n command to locate/search Mynewt package \nrepositories. However, since the \nnewt\n tool supports only github, \nsearching github by keyword is a satisfactory option until a search \ntool is created.\n\n\nWhen searching github, recall that a Mynewt repository must \
nhave a \nrepository.yml\n file in its root directory. If you don't see \nthat file, it's not a Mynewt repository and can't be included in your \nproject via the newt tool. \n\n\nOnce you find a repository, the github URL and \nrepository.yml\n file\nshould give you all the information to add it to your \nproject.yml\n file.",
+ "title": "Add repo to project"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#adding-repositories-to-your-project",
+ "text": "",
+ "title": "Adding Repositories to your Project"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#what-is-a-repository",
+ "text": "A repository is a version-ed Mynewt project, which is a collection of Mynewt packages organized in a specific way for redistribution. What differentiates a repository from a Mynewt project is the presence of a repository.yml file describing the repository. This will be described \nbelow. For a basic understanding of repositories you may read the Newt Tool Manual and How to create repos . Note: For the remainder of this document we'll use the term repo as shorthand for a Mynewt repository. Repos are useful because they are an organized way for the community to share Mynewt packages and projects. In fact, the Mynewt-core is distributed as a repo.",
+ "title": "What is a Repository"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#why-does-mynewt-need-additional-repos",
+ "text": "Repos add functionality not included in the Mynewt core. New repos might be created for several reasons. Expertise . Individuals or organizations may have expertise that they want\nto share in the form of repos. For example a chip vendor may\ncreate a repo to hold the Mynewt support for their chips. Non-Core component . Some components, although very useful to Mynewt users\nare not core to all Mynewt users. These are likely candidates to be held in \ndifferent repos. Software licensing . Some software have licenses that make them incompatible\nwith the ASF (Apache Software Foundation) license policies. These may be \nvaluable components to some Mynewt users, but cannot be contained in the apache-Mynewt-core .",
+ "title": "Why does Mynewt need additional repos?"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#what-repos-are-in-my-project",
+ "text": "The list of repos used by your project are contained within the project.yml file. An example can be seen by creating a new project: $ mkdir ~/dev\n$ cd ~/dev\n$ newt new myproj\n$ cd myproj View the project.yml section and you will see a line describing the repos: project.repositories:\n - apache-Mynewt-core By default, this newly created project uses a single repo called apache-Mynewt-core . If you wish to add additional repos, you would add \nadditional lines to the project.repositories variable like this. project.repositories:\n - apache-Mynewt-core - another_repo_named_x",
+ "title": "What Repos are in my Project"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#repo-descriptors",
+ "text": "In addition to the repo name, the project.yml file must also contain\na repo descriptor for each repository you include that gives newt \ninformation on obtaining the repo. In the same myproj above you will see the following repo descriptor. repository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubator-mynewt-core A repo descriptor starts with repository. name . . In this example, the \ndescriptor specifies the information for the apache-Mynewt-core . The fields within the descriptor have the following definitions: type -- The type of code storage the repo uses. The current version\nof newt only supports github. Future versions may support generic git or other\ncode storage mechanisms. vers -- The version of the repo to use for your project. A source\ncode repository contains many versions of the source. This field is used to \nspecify the one to use for this project. See the section on ve
rsions below \nfor a detailed description of the format of this field. user -- The username for the repo. On github, this is the name\nafter github.com in the repo path. Consider the repository https://github.com/apache/incubator-mynewt-core . It has username apache . repo -- The name of the repo. On github, this is the name after\nthe username described above. Consider the repository https://github.com/apache/incubator-mynewt-core . It has username incubator-mynewt-core . This is a path to the source control\nand should not be confused with the name of the repo that you used in the repository. name declaration above. That name is contained elsewhere\nwithin the repo. See Below.",
+ "title": "Repo Descriptors"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#adding-existing-repos-to-my-project",
+ "text": "To add a new repo to your project, you have to complete two steps. Edit the project.yml file and add a new repo descriptor. The previous\nsection includes information on the field required in your repo descriptor. Edit the project/yml file and add a new line to the project.repositories \nvariable with the name of the repo you are adding. An example of a project.yml file with two repositories is shown below: project.name: my_project \n\nproject.repositories:\n - apache-Mynewt-core\n - Mynewt_arduino_zero\n\n# Use github s distribution mechanism for core ASF libraries.\n# This provides mirroring automatically for us.\n#\nrepository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubator-mynewt-core\n\n# a special repo to hold hardware specific stuff for arduino zero\nrepository.Mynewt_arduino_zero:\n type: github\n vers: 0-latest\n user: runtimeinc\n repo: Mynewt_arduino_zero",
+ "title": "Adding Existing Repos to my Project"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#what-version-of-the-repo-to-use",
+ "text": "Mynewt repos are version-ed artifacts. They are stored in source control \nsystems like github. The repo descriptor in your project.yml file must\nspecify the version of the repo you will accept into your project. For now, we are at the beginnings of Mynewt. For testing and evaluation\nplease use 0-latest in the vers field in your repo descriptor. vers:0-latest See Create a Repo for a description of the versioning system and all the possible ways to specify a version to use.",
+ "title": "What Version of the Repo to use"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#identifying-a-repo",
+ "text": "A repo contains Mynewt packages organized in a specific way and stored in one of the supported code storage methods described above. In other words, it is a Mynewt project with an additional file repository.yml which describes the repo for use by newt (and humans browsing them). It contains a mapping of version numbers to the actual github branches containing the source code. Note that the repository.yml file lives only in the master branch of the git\nrepository. Newt will always fetch this file from the master branch and then\nuse that to determine the actual branch required depending on the version\nspecified in your project.yml file. Special care should be taken to ensure that this file exists only in the master branch. Here is the repository.yml file from the apache-Mynewt-core: repo.name: apache-mynewt-core\nrepo.versions:\n 0.7.9 : Mynewt_0_8_0_b2_tag \n 0-latest : 0.7.9 \n 0.8-latest : 0.7.9 It contains the following:
repo.name The external name that is used to include the library in \nyour project.yml file. This is the name you in include in the project.repositories variable when adding this repository to your project. repo.versions A description of what versions to give the user depending \non the settings in their project.yml file.",
+ "title": "Identifying a Repo"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#repo-version",
+ "text": "The repo version number resolves to an actual git branch depending on the mapping specified in repository.yml for that repo. The version field argument in your project.yml file supports multiple formats for flexibility: major_num . minor_num . revision_num or major_num . minor_num - stability string or major_num - stability string The stability string can be one of 3 pre-defined stability values. stable -- A stable release version of the repository dev -- A development version from the repository latest -- The latest from the repository In your project.yml file you can specify different combinations of \nthe version number and stability value. For example: 0-latest -- The latest version with major number 0 1.2-stable -- The latest stable version with major and minor number 1.2 1.2-dev -- The development version from 1.2 1.1.1 -- a specific version 1.1.1 You cannot specify a stability string with a fully
numbered version, e.g. 1.2.8-stable",
+ "title": "Repo Version"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#repo-versions-available",
+ "text": "A repository.yml file contains information to match a version request\ninto a git branch to fetch for your project. It's up to the repository maintainer to map these to branches of the \nrepository. For example, let's say in a fictitious repository the following are \ndefined. repo.versions:\n 0.8.0 : xxx_branch_0_8_0 \n 1.0.0 : xxx_branch_1_0_0 \n 1.0.2 : xxx_branch_1_0_2 \n 1.1.1 : xxx_branch_1_1_0 \n 1.1.2 : xxx_branch_1_1_2 \n 1.2.0 : xxx_branch_1_2_0 \n 1.2.1 : xxx_branch_1_2_1 \n 1.2-dev : 1.2.1 \n 1-dev : 1.2-dev \n 1.2-stable : 1.2.0 \n 0-latest : 0.8.0 \n 1-latest : 1-dev \n .... When the project.yml file asks for 1.2-stable it is resolved to version 1.2.0 (perhaps 1.2.1 is not stable yet), which in turn resolves to a specific\nbranch xxx_branch_1_2_0 . This is the branch that newt fetches into \nyour project. Note: Make sure a repo version exists in the repository.yml
file of a repo you wish to add. Otherwise Newt will not be able to resolve the version and will fail to fetch the repo into your project.",
+ "title": "Repo Versions Available"
+ },
+ {
+ "location": "/os/tutorials/add_repos/#how-to-find-out-what-repos-are-available-for-mynewt-components",
+ "text": "Currently, there is no newt command to locate/search Mynewt package \nrepositories. However, since the newt tool supports only github, \nsearching github by keyword is a satisfactory option until a search \ntool is created. When searching github, recall that a Mynewt repository must \nhave a repository.yml file in its root directory. If you don't see \nthat file, it's not a Mynewt repository and can't be included in your \nproject via the newt tool. Once you find a repository, the github URL and repository.yml file\nshould give you all the information to add it to your project.yml file.",
+ "title": "How to find out what Repos are available for Mynewt components"
+ },
+ {
+ "location": "/os/tutorials/create_repo/",
+ "text": "Create a Repo out of a Project\n\n\nIn order to create a repository out of a project, all you need to do is create a \nrepository.yml\n file, and check it into the master branch of your project.\n\n\nNOTE:\n Currently only github source control service is supported by our package management system, but support for plain git will be added soon.\n\n\nThe repository.yml defines all versions of the repository and the corresponding source control tags that these versions correspond to. As an example, if the repository.yml file has the following content, it means there is one version of the apache-mynewt-core operating system available, which is \n0.0.0\n (implying we haven't released yet!). Such a version number corresponds to the \"develop\" branch in this repository. \n0-latest\n would also resolved to this same \n0.0.0\n version. The next section explains the versioning system a bit more.\n\n\n$ more repository.yml\nrepo.name: apache-mynewt-core\nrepo.versions:\n
\n0.0.0\n: \ndevelop\n\n \n0-latest\n: \n0.0.0\n\n\n\n\n\n\n\n\nWhere should the repository.yml file be?\n\n\nThe \nrepository.yml\n file lives only in the master branch of the git\nrepository. \nNewt\n will always fetch this file from the master branch and then\nuse that to resolve the actual branch required depending on the version\nspecified in the project. \nSpecial care should be taken to ensure that this\nfile exists only in the master branch.\n\n\nHere is the \nrepository.yml\n file from a certain snapshot of apache-Mynewt-core:\n\n\nrepo.name: apache-mynewt-core\nrepo.versions:\n \n0.7.9\n: \nMynewt_0_8_0_b2_tag\n\n \n0-latest\n: \n0.7.9\n\n \n0.8-latest\n: \n0.7.9\n\n\n\n\n\n\n\n\nIt contains the following:\n\n\n\n\nrepo.name\n The external name that is used to include the library in \nyour \nproject.yml\n file. This is the name you in include in the \nproject.repositories\n variable when adding this repository to your project.\n\n\nrepo.versions\n A d
escription of what versions to give the user depending \non the settings in their \nproject.yml\n file. See below for a thorough description\non versioning. Its a flexible mapping between version numbers and git branches.\n\n\n\n\n\n\nRepo Version Specification\n\n\nThe version field argument for a repo has the following format:\n\n\nmajor_num\n.\nminor_num\n.\nrevision_num\n\n\n\n\n\n\nor\n\n\nmajor_num\n.\nminor_num\n-\nstability string\n\n\n\n\n\n\nor \n\n\nmajor_num\n-\nstability string\n\n\n\n\n\n\n\n\nThe stability string can be one of 3 pre-defined stability values.\n\n\n\n\nstable -- A stable release version of the repository\n\n\ndev -- A development version from the repository\n\n\nlatest -- The latest from the repository\n\n\n\n\nIn your \nproject.yml\n file you can specify different combinations of \nthe version number and stability value. For example:\n\n\n\n\n0-latest\n -- The latest version with major number 0\n\n\n1.2-stable\n -- The latest stable versio
n with major and minor number 1.2\n\n\n1.2-dev\n -- The development version from 1.2\n\n\n1.1.1\n -- a specific version 1.1.1\n\n\n\n\nYou \ncannot\n specify a stability string with a fully numbered version, e.g.\n\n\n1.2.8-stable\n\n\n\n\n\n\n\nRepo Version Resolution\n\n\nA \nrepository.yml\n file contains information to match this version request\ninto a git branch to fetch for your project.\n\n\nIt's up to you as the repository maintainer to map these to actual github branches of the repository. For example, let's say in a fictitious repository the following are defined.\n\n\nrepo.versions:\n \n0.8.0\n: \nxxx_branch_0_8_0\n\n \n1.0.0\n: \nxxx_branch_1_0_0\n\n \n1.0.2\n: \nxxx_branch_1_0_2\n\n \n1.1.1\n: \nxxx_branch_1_1_0\n\n \n1.1.2\n: \nxxx_branch_1_1_2\n\n \n1.2.0\n: \nxxx_branch_1_2_0\n\n \n1.2.1\n: \nxxx_branch_1_2_1\n\n \n1.2-dev\n: \n1.2.1\n\n \n1-dev\n: \n1.2-dev\n\n \n1.2-stable\n: \n1.2.0\n\n \n0-latest\n: \n0.8.0\n\n
\n1-latest\n: \n1-dev\n\n ....\n\n\n\n\n\nWhen the \nproject.yml\n file asks for \n1.2-stable\n it will be resolved to version\n\n1.2.0\n which in turn will resolve to a specific branch \nxxx_branch_1_2_0\n. This is the branch that \nnewt\n will fetch into the project with that \nproject.yml\n file.\n\n\n\n\nDependencies on other repos\n\n\nRepositories can also have dependencies on other repositories. These \ndependencies should be listed out on a per-tag basis. So, for example, \nif apache-mynewt-core were to depend on sterlys-little-repo, you might \nhave the following directives in the repository.yml:\n\n\ndevelop.repositories:\n sterlys-little-repo:\n type: github\n vers: 0.8-latest\n user: sterlinghughes\n repo: sterlys-little-repo\n\n\n\n\n\n\n\nThis would tell Newt that for anything that resolves to the develop \nbranch, this repository requires the sterlys-little-repo repository. \n\n\nDependencies are resolved circularly by the newt too
l, and every dependent repository is placed as a sibling in the repos directory. Currently, if two repositories have the same name, they will conflict and bad things will happen.\n\n\nWhen a repository is installed to the repos/ directory, the current \nversion of that repository is written to the \"project.state\" file. The \nproject state file contains the currently installed version of any given \nrepository. This way, the current set of repositories can be recreated \nfrom the project.state file reliably, whereas the project.yml file can \nhave higher level directives (i.e. include 0.8-stable.)\n\n\nResolving dependencies\n\n\nAt the moment, all dependencies must match, otherwise newt will provide \nan error. As an example, if you have a set of dependencies such that:\n\n\napache-mynewt-core depends on sterlys-little-repo 0.6-stable\napache-mynewt-core depends on sterlys-big-repo 0.5.1\nsterlys-big-repo-0.5.1 depends on sterlys-little-repo 0.6.2\n\n\n\n\n\n\n\nwhere 0.6-stabl
e is 0.6.3, the newt tool will try and resolve the dependency to \nsterlys-little-repo. It will notice that there are two conflicting \nversions of the same repository, and not perform installation.\n\n\nIn the future Newt will be smarter about loading in all dependencies, \nand then looking to satisfy those dependencies to the best match of all \npotential options.",
+ "title": "Create a repo"
+ },
+ {
+ "location": "/os/tutorials/create_repo/#create-a-repo-out-of-a-project",
+ "text": "In order to create a repository out of a project, all you need to do is create a repository.yml file, and check it into the master branch of your project. NOTE: Currently only github source control service is supported by our package management system, but support for plain git will be added soon. The repository.yml defines all versions of the repository and the corresponding source control tags that these versions correspond to. As an example, if the repository.yml file has the following content, it means there is one version of the apache-mynewt-core operating system available, which is 0.0.0 (implying we haven't released yet!). Such a version number corresponds to the \"develop\" branch in this repository. 0-latest would also resolved to this same 0.0.0 version. The next section explains the versioning system a bit more. $ more repository.yml\nrepo.name: apache-mynewt-core\nrepo.versions:\n 0.0.0 : develop \n 0-latest : 0.0.0",
+ "title": "Create a Repo out of a Project"
+ },
+ {
+ "location": "/os/tutorials/create_repo/#where-should-the-repositoryyml-file-be",
+ "text": "The repository.yml file lives only in the master branch of the git\nrepository. Newt will always fetch this file from the master branch and then\nuse that to resolve the actual branch required depending on the version\nspecified in the project. Special care should be taken to ensure that this\nfile exists only in the master branch. Here is the repository.yml file from a certain snapshot of apache-Mynewt-core: repo.name: apache-mynewt-core\nrepo.versions:\n 0.7.9 : Mynewt_0_8_0_b2_tag \n 0-latest : 0.7.9 \n 0.8-latest : 0.7.9 It contains the following: repo.name The external name that is used to include the library in \nyour project.yml file. This is the name you in include in the project.repositories variable when adding this repository to your project. repo.versions A description of what versions to give the user depending \non the settings in their project.yml file. See below for a thorough description\non versioning.
Its a flexible mapping between version numbers and git branches.",
+ "title": "Where should the repository.yml file be?"
+ },
+ {
+ "location": "/os/tutorials/create_repo/#repo-version-specification",
+ "text": "The version field argument for a repo has the following format: major_num . minor_num . revision_num or major_num . minor_num - stability string or major_num - stability string The stability string can be one of 3 pre-defined stability values. stable -- A stable release version of the repository dev -- A development version from the repository latest -- The latest from the repository In your project.yml file you can specify different combinations of \nthe version number and stability value. For example: 0-latest -- The latest version with major number 0 1.2-stable -- The latest stable version with major and minor number 1.2 1.2-dev -- The development version from 1.2 1.1.1 -- a specific version 1.1.1 You cannot specify a stability string with a fully numbered version, e.g. 1.2.8-stable",
+ "title": "Repo Version Specification"
+ },
+ {
+ "location": "/os/tutorials/create_repo/#repo-version-resolution",
+ "text": "A repository.yml file contains information to match this version request\ninto a git branch to fetch for your project. It's up to you as the repository maintainer to map these to actual github branches of the repository. For example, let's say in a fictitious repository the following are defined. repo.versions:\n 0.8.0 : xxx_branch_0_8_0 \n 1.0.0 : xxx_branch_1_0_0 \n 1.0.2 : xxx_branch_1_0_2 \n 1.1.1 : xxx_branch_1_1_0 \n 1.1.2 : xxx_branch_1_1_2 \n 1.2.0 : xxx_branch_1_2_0 \n 1.2.1 : xxx_branch_1_2_1 \n 1.2-dev : 1.2.1 \n 1-dev : 1.2-dev \n 1.2-stable : 1.2.0 \n 0-latest : 0.8.0 \n 1-latest : 1-dev \n .... When the project.yml file asks for 1.2-stable it will be resolved to version 1.2.0 which in turn will resolve to a specific branch xxx_branch_1_2_0 . This is the branch that newt will fetch into the project with that project.yml file.",
+ "title": "Repo Version Resolution"
+ },
+ {
+ "location": "/os/tutorials/create_repo/#dependencies-on-other-repos",
+ "text": "Repositories can also have dependencies on other repositories. These \ndependencies should be listed out on a per-tag basis. So, for example, \nif apache-mynewt-core were to depend on sterlys-little-repo, you might \nhave the following directives in the repository.yml: develop.repositories:\n sterlys-little-repo:\n type: github\n vers: 0.8-latest\n user: sterlinghughes\n repo: sterlys-little-repo This would tell Newt that for anything that resolves to the develop \nbranch, this repository requires the sterlys-little-repo repository. Dependencies are resolved circularly by the newt tool, and every dependent repository is placed as a sibling in the repos directory. Currently, if two repositories have the same name, they will conflict and bad things will happen. When a repository is installed to the repos/ directory, the current \nversion of that repository is written to the \"project.state\" file. The \nproject state file co
ntains the currently installed version of any given \nrepository. This way, the current set of repositories can be recreated \nfrom the project.state file reliably, whereas the project.yml file can \nhave higher level directives (i.e. include 0.8-stable.)",
+ "title": "Dependencies on other repos"
+ },
+ {
+ "location": "/os/tutorials/create_repo/#resolving-dependencies",
+ "text": "At the moment, all dependencies must match, otherwise newt will provide \nan error. As an example, if you have a set of dependencies such that: apache-mynewt-core depends on sterlys-little-repo 0.6-stable\napache-mynewt-core depends on sterlys-big-repo 0.5.1\nsterlys-big-repo-0.5.1 depends on sterlys-little-repo 0.6.2 where 0.6-stable is 0.6.3, the newt tool will try and resolve the dependency to \nsterlys-little-repo. It will notice that there are two conflicting \nversions of the same repository, and not perform installation. In the future Newt will be smarter about loading in all dependencies, \nand then looking to satisfy those dependencies to the best match of all \npotential options.",
+ "title": "Resolving dependencies"
+ },
+ {
+ "location": "/os/tutorials/upgrade_repo/",
+ "text": "Upgrade a repo\n\n\nIn order to upgrade a previously installed repository, the \"newt upgrade\" command should be issued:\n\n\n$ newt upgrade\n\n\n\n\n\n\n\nNewt upgrade will look at the current desired version in \nproject.yml\n, \nand compare it to the version in \nproject.state\n. If these two differ, it \nwill upgrade the dependency. Upgrade works not just for the dependency \nin \nproject.yml\n, but for all the sub-dependencies that they might have.",
+ "title": "Upgrade a repo"
+ },
+ {
+ "location": "/os/tutorials/upgrade_repo/#upgrade-a-repo",
+ "text": "In order to upgrade a previously installed repository, the \"newt upgrade\" command should be issued: $ newt upgrade Newt upgrade will look at the current desired version in project.yml , \nand compare it to the version in project.state . If these two differ, it \nwill upgrade the dependency. Upgrade works not just for the dependency \nin project.yml , but for all the sub-dependencies that they might have.",
+ "title": "Upgrade a repo"
+ },
+ {
"location": "/os/tutorials/unit_test/",
"text": "Write a Test Suite for a Package\n\n\nThis document presents a tutorial which guides the reader through writing\na test suite for a Mynewt package (new or existing).\n\n\nIntroduction\n\n\nWriting a test suite involves using the \nlibs/testutil\n\n package within Mynewt core os. The \ntestutil\n library provides the interface to \nthe \nnewt\n command tool and also provides the compile time hooks to include\ntest suites into your code. Review the \n[\ntestutil\n introduction page ] (../modules/testutil/testutil.md)\nto learn about how the library works.\n\n\nIdentify Your Package\n\n\nIdentify the package for which you are writing a test suite. For this example\nwe will use \nlibs/json\n. To create a new package, see \nthis Tutorial\n.\n\n\nModify Pkg.yml\n\n\nEdit the package (\npkg.yml\n) file for your package and add the test dependency\nfor the Mynewt core OS \nlibs/testutil\n.\n\n\npkg\n.\ndeps\n.\nTEST\n:\n \n-\n \nlibs/testutil\n\n\n\n\n\n\nCreate Yo
ur Test Suite Template\n\n\nCreate a subdirectory \ntest\n under your package main directory. \nCreate a file pair for your test code and header files within the \ntest\n\ndirectory created above. Below shows the \nlibs/json\n directory within the \nMynewt core, including the test directory. In this example, we used the \nconvention \ntest_xxx.c/h\n (in this case \ntest_json\n).\n\n\n\u251c\u2500\u2500\n \nMSJSON_COPYING\n\n\n\u251c\u2500\u2500\n \ninclude\n\n\n\u2502\u00a0\u00a0\n \n\u2514\u2500\u2500\n \njson\n\n\n\u2502\u00a0\u00a0\n \n\u2514\u2500\u2500\n \njson\n.\nh\n\n\n\u251c\u2500\u2500\n \npkg\n.\nyml\n\n\n\u2514\u2500\u2500\n \nsrc\n\n \n\u251c\u2500\u2500\n \njson_decode\n.\nc\n\n \n\u251c\u2500\u2500\n \njson_encode\n.\nc\n\n \n\u2514\u2500\u2500\n \ntest\n\n \n\u251c\u2500\u2500\n \ntest_json\n.\nc\n\n \n\u2514\u2500\u2500\n \ntest_json\n.\nh\n\n\n\n\n\n\nCreate Your Test Suite Code\n\n\nEdit the \ntest_json.c\n file and add your test suite
definition. NOTE that \nthe test suite code requires \n#include \ntestutil/testutil.h\n to get the \nMynewt testutil definitions.\n\n\nYour test suite \ntest_json.c\n file contains at a minimum two functions:\n\n\n\n\nA test Suite which is empty for now, but will contain calls to your test\ncases. \n\n\nA main function which must be \n#ifdef\n'd using \nMYNEWT_SELFTEST\n to ensure\nthat is does not get compiled in when this test suite is run with \ntest suites from other packages \n\n\n\n\nBelow shows the contents of the \ntest_json.c\n file.\n\n\n#include \ntestutil/testutil.h\n\n\n\nTEST_SUITE\n(\ntest_json_suite\n) {\n \n/* empty for now, add test cases later */\n\n}\n\n\n#ifdef MYNEWT_SELFTEST\n\n\nint\n\n\nmain\n(\nint\n \nargc\n, \nchar\n \n**argv\n)\n{\n \ntu_config\n.\ntc_print_results\n \n=\n \n1\n;\n \ntu_init\n();\n \ntest_json_suite\n();\n \nreturn\n \ntu_any_failed\n;\n}\n\n#endif\n\n\n\n\n\n\nTry It Out\n\n\nAt this point, you have a working test suite
with \nno\n tests.\n\nThis will by default pass the test. Your output will look\nsomething like this.\n\n\nYou can use the \nnewt test\n command to run the unit tests for any package.\n\nJust include the package name. These unit tests run via the project \n\nunittest\n which is a native project automatically included in the core\nos package. Below shows some of the test output of this command.\n\n\n$\n \nnewt\n \ntest\n \nlibs/json\n\n\nArchiving\n \nutil\n.\na\n\n\nLinking\n \ntest_json\n\n\nTesting\n \npackage\n \nlibs/json\n\n\nTest\n ...\n/bin/unittest/libs/json/test_json\n \nok!\n\n\n\n\n\n\nCreate a Test\n\n\nTo create a test within your test suite, there are two things to do.\n\n\n\n\nAdd the functions to your test suite\n\n\nImplement the function using the \ntestutil\n macros\n\n\n\n\nFor this tutorial we will create two functions: one to test a simple json\nencode and one to test the decode of this simple message to ensure its \ncoherent.\n\n\nFollow These steps;\n\n\n
1. Create function prototypes in \ntest_json.h\n for your test functions. \nA macro in \ntestutil.h\n hides the actual prototype, but as of this writing\nthe prototype is \nint test_func(void);\n. \n\n\n#ifndef TEST_JSON_H\n\n\n#define TEST_JSON_H\n\n\n\nTEST_CASE_DECL\n(\ntest_json_simple_encode\n);\n\nTEST_CASE_DECL\n(\ntest_json_simple_decode\n);\n\n\n#endif /* TEST_JSON_H \n\n\n\n\n\n\n2. create a new file \ntest_json_simple.c\n to define these two functions. For\nnow you can stub these functions. Below shows the contents of this file. \nThe functions are defined using macros which reference back to the \n\ntestutil\n library so the test can be enumerated and recorded automatically.\n\n\n#include \ntestutil/testutil.h\n\n\n#include \ntest_json.h\n\n\n\nTEST_CASE\n(\ntest_json_simple_encode\n) {\n}\n\n\nTEST_CASE\n(\ntest_json_simple_decode\n) {\n}\n\n#endif /* TEST_JSON_H \n\n\n\n\n\n\n3. Add the tests to your test suite in \ntest_json.c\n as shown below.\n\n\nTEST_SUITE\n(\nt
est_json_suite\n) {\n \ntest_json_simple_encode\n();\n \ntest_json_simple_decode\n();\n}\n\n\n\n\n\nYour test suite should still pass as shown below\n\n\n$newt\n \ntest\n \nlibs/json\n\n\nTesting\n \npackage\n \nlibs/json\n\n\nTest\n ...\n/bin/unittest/libs/json/test_json\n \nok!\n\n\n\n\n\n\nAdd Contents to your Tests\n\n\nAt this point, you can add contents to your test and verify that \nthe test suites pass. For now, lets just add a simple failure to show\nwhat it would look like when running from Newt.\n\n\n\n\nEdit \ntest_json_simple.c\n and add a \nTEST_ASSERT\n to a test funtion. The\ntest assert will fail if its argument is \nfalse\n.\n\n\n\n\nTEST_CASE\n(\ntest_json_simple_encode\n) {\n \nTEST_ASSERT\n(\n0\n);\n}\n\n\n\n\n\nWhen running newt, you will see the test suite fails with something like\nthe message shown below.\n\n\nTesting\n \npackage\n \nlibs/json\n\n[\nFAIL\n] \ntest_json_suite/\n(\nnull\n) \n|test_json_simple\n.\nc\n:\n24\n|\n \nfailed\n \nassertion\
n: \n0\n\n\nError\n: \nTest\n \ncrashed\n: ..\n/bin/unittest/libs/json/test_json\n\n\nexit\n \nstatus\n \n1\n\n\n\n\n\n\nCongratulations\n\n\nNow you can begin the work of adding your test cases and test.\n\n\nTesting on your target",
"title": "Write a Test Suite for a Package"
@@ -611,64 +726,19 @@
"title": "Use of HAL for drivers"
},
{
- "location": "/os/tutorials/add_repos/",
- "text": "Additional Repositories\n\n\nWhat is a Repository\n\n\nA repository is a version-ed Mynewt project, which is a \ncollection of Mynewt packages organized in a specific\nway. \n\n\nWhat differentiates a repository from a Mynewt project is the presence of a\n\nrepository.yml\n file describing the repository. This will be described \nbelow. \nNote:\n For the remainder of this document we'll use the term repo as shorthand for a \nMynewt repository.\n\n\nRepos are useful because they are an organized way for the community\nto share Mynewt packages and projects. In fact, the Mynewt-core is \ndistributed as a repo.\n\n\n\n\nWhy does Mynewt need additional repos?\n\n\nRepos add functionality not included in the Mynewt core. New repos might be created for \nseveral reasons.\n\n\n\n\nExpertise\n. Individuals or organizations may have expertise that they want\nto share in the form of repos. For example a chip vendor may\ncreate a repo to hold the Mynewt support for thei
r chips.\n\n\nNon-Core component\n. Some components, although very useful to Mynewt users\nare not core to all Mynewt users. These are likely candidates to be held in \ndifferent repos.\n\n\nSoftware licensing\n. Some software have licenses that make them incompatible\nwith the ASF (Apache Software Foundation) license policies. These may be \nvaluable components to some Mynewt users, but cannot be contained in the \napache-Mynewt-core\n.\n\n\n\n\n\n\nWhat Repos are in my Project\n\n\nThe list of repos used by your project are contained within the \n\nproject.yml\n file. An example can be seen by creating a new project:\n\n\n$ mkdir ~/dev\n$ cd ~/dev\n$ newt new myproj\n$ cd myproj\n\n\n\n\n\n\n\nView the \nproject.yml\n section and you will see a line describing the repos:\n\n\nproject.repositories:\n - apache-Mynewt-core\n\n\n\n\n\n \n\n\nBy default, this newly created project uses a single repo called \n\napache-Mynewt-core\n. \n\n\nIf you wish to add additional repos, yo
u would add \nadditional lines to the \nproject.repositories\n variable like this.\n\n\nproject.repositories:\n - apache-Mynewt-core\n - another_repo_named_x\n\n\n\n\n\n\n\nRepo Descriptors\n\n\nIn addition to the repo name, the \nproject.yml\n file must also contain\na repo descriptor for each repository you include that gives \nnewt\n \ninformation on obtaining the repo.\n\n\nIn the same \nmyproj\n above you will see the following repo descriptor.\n\n\nrepository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubator-mynewt-core\n\n\n\n\n\nA repo descriptor starts with \nrepository.\nname\n.\n. In this example, the \ndescriptor specifies the information for the \napache-Mynewt-core\n.\n\n\n\n\nThe fields within the descriptor have the following definitions:\n\n\n\n\n\n\ntype\n -- The type of code storage the repo uses. The current version\nof \nnewt\n only supports github. Future versions may support generic git or other\ncode sto
rage mechanisms.\n\n\n\n\n\n\nvers\n -- The version of the repo to use for your project. A source\ncode repository contains many versions of the source. This field is used to \nspecify the one to use for this project. See the section on versions below \nfor a detailed description of the format of this field.\n\n\n\n\n\n\nuser\n -- The username for the repo. On github, this is the name\nafter \ngithub.com\n in the repo path. Consider the repository \n\nhttps://github.com/apache/incubator-mynewt-core\n. It has username \napache\n. \n\n\n\n\n\n\nrepo\n -- The name of the repo. On github, this is the name after\nthe username described above. Consider the repository \n\nhttps://github.com/apache/incubator-mynewt-core\n. It has username \n\nincubator-mynewt-core\n. This is a path to the source control\nand should not be confused with the name of the repo that you used in the \n\nrepository.\nname\n declaration above. That name is contained elsewhere\nwithin the repo. See Below.\
n\n\n\n\n\n\n\n\nAdding Existing Repos to my Project\n\n\nTo add a new repo to your project, you have to complete two steps.\n\n\n\n\n\n\nEdit the \nproject.yml\n file and add a new repo descriptor. The previous\nsection includes information on the field required in your repo descriptor.\n\n\n\n\n\n\nEdit the \nproject/yml\n file and add a new line to the \nproject.repositories\n\nvariable with the name of the repo you are adding. \n\n\n\n\n\n\nAn example if a \nproject.yml\n file with two repositories is shown below:\n\n\nproject.name: \nmy_project\n\n\nproject.repositories:\n - apache-Mynewt-core\n - Mynewt_arduino_zero\n\n# Use github\ns distribution mechanism for core ASF libraries.\n# This provides mirroring automatically for us.\n#\nrepository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubator-mynewt-core\n\n# a special repo to hold hardware specific stuff for arduino zero\nrepository.Mynewt_arduino_zero:\n type: github\
n vers: 0-latest\n user: runtimeinc\n repo: Mynewt_arduino_zero\n\n\n\n\n\n\n\nWhat Version of the Repo to use\n\n\nMynewt repos are version-ed artifacts. They are stored in source control \nsystems like github. The repo descriptor in your \nproject.yml\n file must\nspecify the version of the repo you will accept into your project.\n\n\nFor now, we are at the beginnings of Mynewt. For testing and evaluation\nplease use \n0-latest\n in the \nvers\n field in your repo descriptor.\n\n\n vers:0-latest\n\n\n\n\n\nSee below for a description of the version system.\n\n\n\n\nWhat is in a Repo\n\n\nA repo is a collection of Mynewt packages organized in a specific\nway and stored in one of the supported code storage methods described above. \n\n\nA repo is a Mynewt project with an additional file \nrepository.yml\n\nwhich describes the repo for use by \nnewt\n (and humans browsing them).\n\n\nThere is one key consideration for this \nrepository.yml\n file. The \n\nrepository.ym
l\n file only lives in the master branch of the git\nrepository. \nNewt\n will always fetch this file from the master branch and then\nuse that to resolve the actual branch required depending on the version\nspecified in the project. Special care should be taken to ensure that this\nfile exists only in the master branch.\n\n\nHere is the \nrepository.yml\n file from the apache-Mynewt-core:\n\n\nrepo.name: apache-mynewt-core\nrepo.versions:\n \n0.7.9\n: \nMynewt_0_8_0_b2_tag\n\n \n0-latest\n: \n0.7.9\n\n \n0.8-latest\n: \n0.7.9\n\n\n\n\n\n\n\n\nIt contains the following:\n\n\n\n\nrepo.name\n The external name that is used to include the library in \nyour \nproject.yml\n file. This is the name you in include in the \nproject.repositories\n variable when adding this repository to your project.\n\n\nrepo.versions\n A description of what versions to give the user depending \non the settings in their \nproject.yml\n file. See below for a thorough description\non versioning.
Its a flexible mapping between version numbers and git branches.\n\n\n\n\n\n\nRepo Version\n\n\nThe version field argument in your \nproject.yml\n file has the following format:\n\n\nmajor_num\n.\nminor_num\n.\nrevision_num\n\n\n\n\n\n\nor\n\n\nmajor_num\n.\nminor_num\n-\nstability string\n\n\n\n\n\n\nor \n\n\nmajor_num\n-\nstability string\n\n\n\n\n\n\n\n\nThe stability string can be one of 3 pre-defined stability values.\n\n\n\n\nstable -- A stable release version of the repository\n\n\ndev -- A development version from the repository\n\n\nlatest -- The latest from the repository\n\n\n\n\nIn your \nproject.yml\n file you can specify different combinations of \nthe version number and stability value. For example:\n\n\n\n\n0-latest\n -- The latest version with major number 0\n\n\n1.2-stable\n -- The latest stable version with major and minor number 1.2\n\n\n1.2-dev\n -- The development version from 1.2\n\n\n1.1.1\n -- a specific version 1.1.1\n\n\n\n\nYou c
annot specify a stability string with a fully numbered version, e.g.\n\n\n1.2.8-stable\n\n\n\n\n\n\n\nA \nrepository.yml\n file contains information to match this version request\ninto a git branch to fetch for your project.\n\n\nIts up to the repository maintainer to map these to branches of the \nrepository. For example, let's say in a fictitious repository the following are \ndefined.\n\n\nrepo.versions:\n \n0.8.0\n: \nxxx_branch_0_8_0\n\n \n1.0.0\n: \nxxx_branch_1_0_0\n\n \n1.0.2\n: \nxxx_branch_1_0_2\n\n \n1.1.1\n: \nxxx_branch_1_1_0\n\n \n1.1.2\n: \nxxx_branch_1_1_2\n\n \n1.2.0\n: \nxxx_branch_1_2_0\n\n \n1.2.1\n: \nxxx_branch_1_2_1\n\n \n1.2-dev\n: \n1.2.1\n\n \n1-dev\n: \n1.2-dev\n\n \n1.2-stable\n: \n1.2.0\n\n \n0-latest\n: \n0.8.0\n\n \n1-latest\n: \n1-dev\n\n ....\n\n\n\n\n\nWhen the \nproject.yml\n file asks for \n1.2-stable\n its resolved to version\n\n1.2.0\n (perhaps \n1.2.1\n is not stable yet), which resolves to a specific\nbr
anch \nxxx_branch_1_2_0\n. This is the branch that \nnewt\n fetches into \nyour project.\n\n\n\n\nHow to find out what Repos are available for Mynewt components\n\n\nCurrently, there is no \nnewt\n command to locate/search Mynewt package \nrepositories. However, since the \nnewt\n tool supports only github, \nsearching github by keyword is a satisfactory option until a search \ntool is created.\n\n\nWhen searching github, recall that a Mynewt repository must \nhave a \nrepository.yml\n file in its root directory. If you don't see \nthat file, it's not a Mynewt repository and can't be included in your \nproject via the newt tool. \n\n\nOnce you find a repository, the github URL and \nrepository.yml\n file\nshould give you all the information to add it to your \nproject.yml\n file.",
- "title": "Additional Repositories"
- },
- {
- "location": "/os/tutorials/add_repos/#additional-repositories",
- "text": "",
- "title": "Additional Repositories"
- },
- {
- "location": "/os/tutorials/add_repos/#what-is-a-repository",
- "text": "A repository is a version-ed Mynewt project, which is a \ncollection of Mynewt packages organized in a specific\nway. What differentiates a repository from a Mynewt project is the presence of a repository.yml file describing the repository. This will be described \nbelow. Note: For the remainder of this document we'll use the term repo as shorthand for a \nMynewt repository. Repos are useful because they are an organized way for the community\nto share Mynewt packages and projects. In fact, the Mynewt-core is \ndistributed as a repo.",
- "title": "What is a Repository"
- },
- {
- "location": "/os/tutorials/add_repos/#why-does-mynewt-need-additional-repos",
- "text": "Repos add functionality not included in the Mynewt core. New repos might be created for \nseveral reasons. Expertise . Individuals or organizations may have expertise that they want\nto share in the form of repos. For example a chip vendor may\ncreate a repo to hold the Mynewt support for their chips. Non-Core component . Some components, although very useful to Mynewt users\nare not core to all Mynewt users. These are likely candidates to be held in \ndifferent repos. Software licensing . Some software have licenses that make them incompatible\nwith the ASF (Apache Software Foundation) license policies. These may be \nvaluable components to some Mynewt users, but cannot be contained in the apache-Mynewt-core .",
- "title": "Why does Mynewt need additional repos?"
- },
- {
- "location": "/os/tutorials/add_repos/#what-repos-are-in-my-project",
- "text": "The list of repos used by your project are contained within the project.yml file. An example can be seen by creating a new project: $ mkdir ~/dev\n$ cd ~/dev\n$ newt new myproj\n$ cd myproj View the project.yml section and you will see a line describing the repos: project.repositories:\n - apache-Mynewt-core By default, this newly created project uses a single repo called apache-Mynewt-core . If you wish to add additional repos, you would add \nadditional lines to the project.repositories variable like this. project.repositories:\n - apache-Mynewt-core\n - another_repo_named_x",
- "title": "What Repos are in my Project"
- },
- {
- "location": "/os/tutorials/add_repos/#repo-descriptors",
- "text": "In addition to the repo name, the project.yml file must also contain\na repo descriptor for each repository you include that gives newt \ninformation on obtaining the repo. In the same myproj above you will see the following repo descriptor. repository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubator-mynewt-core A repo descriptor starts with repository. name . . In this example, the \ndescriptor specifies the information for the apache-Mynewt-core . The fields within the descriptor have the following definitions: type -- The type of code storage the repo uses. The current version\nof newt only supports github. Future versions may support generic git or other\ncode storage mechanisms. vers -- The version of the repo to use for your project. A source\ncode repository contains many versions of the source. This field is used to \nspecify the one to use for this project. See the section on ve
rsions below \nfor a detailed description of the format of this field. user -- The username for the repo. On github, this is the name\nafter github.com in the repo path. Consider the repository https://github.com/apache/incubator-mynewt-core . It has username apache . repo -- The name of the repo. On github, this is the name after\nthe username described above. Consider the repository https://github.com/apache/incubator-mynewt-core . It has username incubator-mynewt-core . This is a path to the source control\nand should not be confused with the name of the repo that you used in the repository. name declaration above. That name is contained elsewhere\nwithin the repo. See Below.",
- "title": "Repo Descriptors"
- },
- {
- "location": "/os/tutorials/add_repos/#adding-existing-repos-to-my-project",
- "text": "To add a new repo to your project, you have to complete two steps. Edit the project.yml file and add a new repo descriptor. The previous\nsection includes information on the field required in your repo descriptor. Edit the project/yml file and add a new line to the project.repositories \nvariable with the name of the repo you are adding. An example if a project.yml file with two repositories is shown below: project.name: my_project \n\nproject.repositories:\n - apache-Mynewt-core\n - Mynewt_arduino_zero\n\n# Use github s distribution mechanism for core ASF libraries.\n# This provides mirroring automatically for us.\n#\nrepository.apache-Mynewt-core:\n type: github\n vers: 0-latest\n user: apache\n repo: incubator-mynewt-core\n\n# a special repo to hold hardware specific stuff for arduino zero\nrepository.Mynewt_arduino_zero:\n type: github\n vers: 0-latest\n user: runtimeinc\n repo: Mynewt_arduino_zero",
- "title": "Adding Existing Repos to my Project"
- },
- {
- "location": "/os/tutorials/add_repos/#what-version-of-the-repo-to-use",
- "text": "Mynewt repos are version-ed artifacts. They are stored in source control \nsystems like github. The repo descriptor in your project.yml file must\nspecify the version of the repo you will accept into your project. For now, we are at the beginnings of Mynewt. For testing and evaluation\nplease use 0-latest in the vers field in your repo descriptor. vers:0-latest See below for a description of the version system.",
- "title": "What Version of the Repo to use"
- },
- {
- "location": "/os/tutorials/add_repos/#what-is-in-a-repo",
- "text": "A repo is a collection of Mynewt packages organized in a specific\nway and stored in one of the supported code storage methods described above. A repo is a Mynewt project with an additional file repository.yml \nwhich describes the repo for use by newt (and humans browsing them). There is one key consideration for this repository.yml file. The repository.yml file only lives in the master branch of the git\nrepository. Newt will always fetch this file from the master branch and then\nuse that to resolve the actual branch required depending on the version\nspecified in the project. Special care should be taken to ensure that this\nfile exists only in the master branch. Here is the repository.yml file from the apache-Mynewt-core: repo.name: apache-mynewt-core\nrepo.versions:\n 0.7.9 : Mynewt_0_8_0_b2_tag \n 0-latest : 0.7.9 \n 0.8-latest : 0.7.9 It contains the following: repo.name The external name that is used to include th
e library in \nyour project.yml file. This is the name you in include in the project.repositories variable when adding this repository to your project. repo.versions A description of what versions to give the user depending \non the settings in their project.yml file. See below for a thorough description\non versioning. Its a flexible mapping between version numbers and git branches.",
- "title": "What is in a Repo"
+ "location": "/os/tutorials/bletiny_project/",
+ "text": "NimBLE project\n\n\nThis tutorial explains how to start BLE 4.2 on a board and start seeing some BLE related statistics.",
+ "title": "Enable BLE using nimBLE"
},
{
- "location": "/os/tutorials/add_repos/#repo-version",
- "text": "The version field argument in your project.yml file has the following format: major_num . minor_num . revision_num or major_num . minor_num - stability string or major_num - stability string The stability string can be one of 3 pre-defined stability values. stable -- A stable release version of the repository dev -- A development version from the repository latest -- The latest from the repository In your project.yml file you can specify different combinations of \nthe version number and stability value. For example: 0-latest -- The latest version with major number 0 1.2-stable -- The latest stable version with major and minor number 1.2 1.2-dev -- The development version from 1.2 1.1.1 -- a specific version 1.1.1 You cannot specify a stability string with a fully numbered version, e.g. 1.2.8-stable A repository.yml file contains information to match this version request\ninto a git branch to fetch f
or your project. Its up to the repository maintainer to map these to branches of the \nrepository. For example, let's say in a fictitious repository the following are \ndefined. repo.versions:\n 0.8.0 : xxx_branch_0_8_0 \n 1.0.0 : xxx_branch_1_0_0 \n 1.0.2 : xxx_branch_1_0_2 \n 1.1.1 : xxx_branch_1_1_0 \n 1.1.2 : xxx_branch_1_1_2 \n 1.2.0 : xxx_branch_1_2_0 \n 1.2.1 : xxx_branch_1_2_1 \n 1.2-dev : 1.2.1 \n 1-dev : 1.2-dev \n 1.2-stable : 1.2.0 \n 0-latest : 0.8.0 \n 1-latest : 1-dev \n .... When the project.yml file asks for 1.2-stable its resolved to version 1.2.0 (perhaps 1.2.1 is not stable yet), which resolves to a specific\nbranch xxx_branch_1_2_0 . This is the branch that newt fetches into \nyour project.",
- "title": "Repo Version"
- },
- {
- "location": "/os/tutorials/add_repos/#how-to-find-out-what-repos-are-available-for-mynewt-components",
- "text": "Currently, there is no newt command to locate/search Mynewt package \nrepositories. However, since the newt tool supports only github, \nsearching github by keyword is a satisfactory option until a search \ntool is created. When searching github, recall that a Mynewt repository must \nhave a repository.yml file in its root directory. If you don't see \nthat file, it's not a Mynewt repository and can't be included in your \nproject via the newt tool. Once you find a repository, the github URL and repository.yml file\nshould give you all the information to add it to your project.yml file.",
- "title": "How to find out what Repos are available for Mynewt components"
+ "location": "/os/tutorials/bletiny_project/#nimble-project",
+ "text": "This tutorial explains how to start BLE 4.2 on a board and start seeing some BLE related statistics.",
+ "title": "NimBLE project"
},
{
"location": "/os/tutorials/event_queue/",
"text": "How to define a task which uses event queues to manage multiple events\n\n\nIntroduction\n\n\nEvent queue is a mechanism by which you can serialize incoming events for your task. You can use it to get info about arrived hardware interrupts, callout expirations and messages from other tasks.\n\n\nThe benefit of doing inter-task communication this way is that there should be less resources that need to be locked.\n\n\nThe benefit of doing interrupt processing in a task context instead of inside an interrupt context is that you are not blocking other HW interrupts when doing the work. The same goes for high priority tasks in the system; they're blocked until the interrupt handler returns. From the task context you'll also be able to access other OS facilities; you can sleep while waiting for a lock, for example.\n\n\n\n\nExample app\n\n\nHere you are going to write an app which demonstrates the use of event queues for communication between tasks. You will also use
OS callouts for timer expiration and another event from a GPIO interrupt.\n\n\nYou will use inputs from 3 sources to toggle 3 GPIO outputs on my STM32F3discovery board.\n\n\n\n\nCreate project\n\n\nYou start by creating a project and populating it with repositories incubator-mynewt-core and mynewt_stm32f3. See \nSTM32F3 tutorial\n if you need help with this. You can also read the tutorial on \nAdditional Repositories\n for a more thorough understanding. \n\n\n \n\n\nCreate application\n\n\nHere's what the pkg.yml looks for the application.\n\n\n[marko@IsMyLaptop:~/src/events]$ cat apps/event_sample/pkg.yml\npkg.name: apps/event_sample\npkg.type: app\n\npkg.deps:\n - \n@apache-mynewt-core/libs/os\n\n - \n@apache-mynewt-core/hw/hal\n\n - \n@apache-mynewt-core/libs/console/stub\n\n\n\n\n\n\n\n\nInitialize the event queue structure\n\n\nThis must be done before anyone tries to place events to the queue. Here it's done before any task gets created. Initialization is done by ca
lling \nos_eventq_init()\n.\n\n\n#define MY_TASK_PRIO 4\n\n\n#define MY_TASK_STACK_SZ 512\n\n\n\nstatic\n \nstruct\n \nos_eventq\n \nmy_eventq\n;\n\nstatic\n \nos_stack_t\n \nmy_task_stack\n[\nMY_TASK_STACK_SZ\n];\n\nstatic\n \nstruct\n \nos_task\n \nmy_task_str\n;\n\n\nvoid\n\n\ninit_tasks\n(\nvoid\n)\n{\n \nstruct\n \nos_task\n \ntaskid\n;\n\n \nos_eventq_init\n(\nmy_eventq\n);\n \nos_task_init\n(\nmy_task_str\n, \ntask\n, \nmy_task\n, \nNULL\n, \nMY_TASK_PRIO\n,\n \nOS_WAIT_FOREVER\n, \nmy_task_stack\n, \nMY_TASK_STACK_SZ\n);\n\n\n\n\n\n\n\nProcessing events\n\n\nHere event processing is done inside \nmy_task\n. The main loop of the task is pulling events from the queue, and then taking action. We look at the type of the event to figure out what to do.\n\n\nThe code snippet shows what the main loop of the event handler looks like. Events are removed from the head of the queue using os_eventq_get\n\n\nvoid\n\n\nmy_task\n(\nvoid\n \n*arg\n)\n{\n \nstruc
t\n \nos_event\n \n*ev\n;\n\n \nwhile\n (\n1\n) {\n \nev\n \n=\n \nos_eventq_get\n(\nmy_eventq\n);\n \nswitch\n (\nev-\nev_type\n) {\n \n/* more event types here */\n\n \ndefault\n:\n\n \nassert\n(\n0\n);\n }\n }\n}\n\n\n\n\n\n\n\nEvent types\n\n\nYou can define your own event types. Some numbers are already reserved by the OS, so you should not use those as your own types.\n\n\nReserved event types are defined in \nlibs/os/include/os/os_eventq.h\n. One example of a reserved type is OS_EVENT_T_TIMER, which is used as type in OS callouts.\n\n\nYou should start your event numbers from \nOS_EVENT_T_PERUSER\n, and go higher.\n\n\nYou are going to generate events from GPIO interrupt handler, from another task as well as from a callout. OS callout already has a type, but you'll need to define types for the other uses.\n\n\n#define MY_TASK_GPIO_EVENT (OS_EVENT_T_PERUSER)\n\n\n#define MY_TASK_TASK_EVENT (OS_EVENT_T_PERUSER + 1)\n\n\n\n\n
\n\n\n\nPosting events from another task\n\n\nEvents are posted to a queue by calling \nos_eventq_put()\n. You need to preallocate memory for the event structure. Here it's done by declaring the event structure as a global variable.\n\n\nNote that you can call \nos_eventq_put()\n with an event which has already been queued. In that case, the call has no effect; the position of the event is not changed within the queue.\n\n\nIn the code snippet we declare the os_event structure, and initialize it. We also create the event generating task, and periodically post event to the event queue.\n\n\n#define GEN_TASK_PRIO 3\n\n\n#define GEN_TASK_STACK_SZ 512\n\n\n\nstatic\n \nstruct\n \nos_event\n \ngen_task_ev\n;\n\nstatic\n \nos_stack_t\n \ngen_task_stack\n[\nGEN_TASK_STACK_SZ\n];\n\nstatic\n \nstruct\n \nos_task\n \ngen_task_str\n;\n\n\nvoid\n\n\ngen_task\n(\nvoid\n \n*arg\n)\n{\n \nwhile\n (\n1\n) {\n \nos_time_delay\n(\nOS_TICKS_PER_SEC\n \n/\n \n4\n);\n \nos_even
tq_put\n(\nmy_eventq\n, \ngen_task_ev\n);\n }\n}\n\n\nvoid\n\n\ninit_tasks\n(\nvoid\n)\n{\n \n/* .... */\n\n \ngen_task_ev\n.\nev_type\n \n=\n \nMY_TASK_TASK_EVENT\n;\n \nos_task_init\n(\ngen_task_str\n, \ngen_task\n, \ngen_task\n, \nNULL\n, \nGEN_TASK_PRIO\n,\n \nOS_WAIT_FOREVER\n, \ngen_task_stack\n, \nGEN_TASK_STACK_SZ\n);\n}\n\n\n\n\n\n\n\nCallout events\n\n\nYou can get timer events delivered to your task's event queue with OS callout. Check \ncallout documentation\n for description on how to use the API.\n\n\nFor this example, you'll use only one type of callout; so you can use the simpler structure.\n\n\nIn the code snippet we declare the os_callout structure and initialize it. Then we arm the timer.\n\n\nstatic\n \nstruct\n \nos_callout\n \nmy_callout\n;\n\n\nvoid\n\n\ninit_tasks\n(\nvoid\n)\n{\n \n/* .... */\n\n\n \nos_callout_init\n(\nmy_callout\n, \nmy_eventq\n, \nNULL\n);\n \nos_callout_reset\n(\nmy_callout\n, \nOS_TICKS_PER_SEC\n);\n}\n\n\n\n
\n\n\n\nPosting events from interrupt handler\n\n\nAnother place where posting events makes sense is from an interrupt handler. In this tutorial you will do it when GPIO changes state.\n\n\nYou'll use HAL GPIO interface to register a routine which is getting called from the interrupt handler context. This routine will then post event to your queue.\n\n\nOn STM32F3Discovery board, there is a button connected to PA0. The identifier for this GPIO pin is 0.\n\n\nstatic\n \nstruct\n \nos_event\n \ngpio_ev\n;\n\n\nvoid\n\n\ninit_tasks\n(\nvoid\n)\n{\n \n/* .... */\n\n\n \ngpio_ev\n.\nev_type\n \n=\n \nMY_TASK_GPIO_EVENT\n;\n \nhal_gpio_irq_init\n(\n0\n, \nmy_gpio_irq\n, \nNULL\n, \nGPIO_TRIG_RISING\n,\n \nGPIO_PULL_NONE\n);\n \nhal_gpio_irq_enable\n(\n0\n);\n}\n\n\nstatic\n \nvoid\n\n\nmy_gpio_irq\n(\nvoid\n \n*arg\n)\n{\n \nos_eventq_put\n(\nmy_eventq\n, \ngpio_ev\n);\n}\n\n\n\n\n\n\n\nEvent processing finalized\n\n\nNow that you are posting events from different so
urces, you will fill in the parts in the task main loop to trigger different behaviors depending on event type.\n\n\nYou'll drive different LEDs depending on what type of event arrived. LEDs on this board are connected to PE8, PE9, PE10 and so on. These have GPIO identifiers starting from 72 onwards.\n\n\n#define TASK_LED 72\n\n\n#define CALLOUT_LED 73\n\n\n#define GPIO_LED 74\n\n\n\nvoid\n\n\ninit_tasks\n(\nvoid\n)\n{\n \n/* .... */\n\n \nhal_gpio_init_out\n(\nTASK_LED\n, \n1\n);\n \nhal_gpio_init_out\n(\nCALLOUT_LED\n, \n1\n);\n \nhal_gpio_init_out\n(\nGPIO_LED\n, \n1\n);\n}\n\n\n\n\n\nAnd here is the new main loop for your task. Note that when callout event arrives, we re-arm the callout.\n\n\nvoid\n\n\nmy_task\n(\nvoid\n \n*arg\n)\n{\n \nstruct\n \nos_event\n \n*ev\n;\n\n \nwhile\n (\n1\n) {\n \nev\n \n=\n \nos_eventq_get\n(\nmy_eventq\n);\n \nswitch\n (\nev-\nev_type\n) {\n \ncase\n \nMY_TASK_TASK_EVENT\n:\n \n
hal_gpio_toggle\n(\nTASK_LED\n);\n \nbreak\n;\n \ncase\n \nOS_EVENT_T_TIMER\n:\n \nhal_gpio_toggle\n(\nCALLOUT_LED\n);\n \nos_callout_reset\n(\nmy_callout\n, \nOS_TICKS_PER_SEC\n \n/\n \n2\n);\n \nbreak\n;\n \ncase\n \nMY_TASK_GPIO_EVENT\n:\n \nhal_gpio_toggle\n(\nGPIO_LED\n);\n \nbreak\n;\n \ndefault\n:\n\n \nassert\n(\n0\n);\n }\n }\n}\n\n\n\n\n\n\n\nNow you're done. Once you load this to your board, the task LED will blink at an interval of 250ms, the callout LED with an interval of 500ms, and the GPIO LED every time you press the button.\n\n\n\n\nCode for the example\n\n\n#include \nos/os.h\n\n\n#include \nbsp/bsp.h\n\n\n#include \nhal/hal_gpio.h\n\n\n#include \nassert.h\n\n\n\n\n#define MY_TASK_PRIO 4\n\n\n#define MY_TASK_STACK_SZ 512\n\n\n\n#define GEN_TASK_PRIO 3\n\n\n#define GEN_TASK_STACK_SZ 512\n\n\n\n#define MY_TASK_GPIO_EVENT (OS_EVENT_T_PERUSER)
\n\n\n#define MY_TASK_TASK_EVENT (OS_EVENT_T_PERUSER + 1)\n\n\n\n#define TASK_LED 72\n\n\n#define CALLOUT_LED 73\n\n\n#define GPIO_LED 74\n\n\n\nstatic\n \nstruct\n \nos_eventq\n \nmy_eventq\n;\n\nstatic\n \nos_stack_t\n \nmy_task_stack\n[\nMY_TASK_STACK_SZ\n];\n\nstatic\n \nstruct\n \nos_task\n \nmy_task_str\n;\n\n\nstatic\n \nstruct\n \nos_event\n \ngen_task_ev\n;\n\nstatic\n \nos_stack_t\n \ngen_task_stack\n[\nGEN_TASK_STACK_SZ\n];\n\nstatic\n \nstruct\n \nos_task\n \ngen_task_str\n;\n\n\nstatic\n \nstruct\n \nos_callout\n \nmy_callout\n;\n\n\nstatic\n \nstruct\n \nos_event\n \ngpio_ev\n;\n\n\nvoid\n\n\nmy_task\n(\nvoid\n \n*arg\n)\n{\n \nstruct\n \nos_event\n \n*ev\n;\n\n \nwhile\n (\n1\n) {\n \nev\n \n=\n \nos_eventq_get\n(\nmy_eventq\n);\n \nswitch\n (\nev-\nev_type\n) {\n \ncase\n \nMY_TASK_TASK_EVENT\n:\n \nhal_gpio_toggle\n(\nTASK_LED\n);\n \nbreak\n;\n \ncase\n \nOS_EVENT_T_TIMER\n:\n \nh
al_gpio_toggle\n(\nCALLOUT_LED\n);\n \nos_callout_reset\n(\nmy_callout\n, \nOS_TICKS_PER_SEC\n \n/\n \n2\n);\n \nbreak\n;\n \ncase\n \nMY_TASK_GPIO_EVENT\n:\n \nhal_gpio_toggle\n(\nGPIO_LED\n);\n \nbreak\n;\n \ndefault\n:\n\n \nassert\n(\n0\n);\n }\n }\n}\n\n\nstatic\n \nvoid\n\n\nmy_gpio_irq\n(\nvoid\n \n*arg\n)\n{\n \nos_eventq_put\n(\nmy_eventq\n, \ngpio_ev\n);\n}\n\n\nvoid\n\n\ngen_task\n(\nvoid\n \n*arg\n)\n{\n \nwhile\n (\n1\n) {\n \nos_time_delay\n(\nOS_TICKS_PER_SEC\n \n/\n \n4\n);\n \nos_eventq_put\n(\nmy_eventq\n, \ngen_task_ev\n);\n }\n}\n\n\nvoid\n\n\ninit_tasks\n(\nvoid\n)\n{\n \nos_eventq_init\n(\nmy_eventq\n);\n \nos_task_init\n(\nmy_task_str\n, \ntask\n, \nmy_task\n, \nNULL\n, \nMY_TASK_PRIO\n,\n \nOS_WAIT_FOREVER\n, \nmy_task_stack\n, \nMY_TASK_STACK_SZ\n);\n\n \ngen_task_ev\n.\nev_type\n \n=\n \nMY_TASK_TASK_EVENT\n;\n \nos_task_init\n(\ngen_task
_str\n, \ngen_task\n, \ngen_task\n, \nNULL\n, \nGEN_TASK_PRIO\n,\n \nOS_WAIT_FOREVER\n, \ngen_task_stack\n, \nGEN_TASK_STACK_SZ\n);\n\n \nos_callout_init\n(\nmy_callout\n, \nmy_eventq\n, \nNULL\n);\n \nos_callout_reset\n(\nmy_callout\n, \nOS_TICKS_PER_SEC\n);\n\n \ngpio_ev\n.\nev_type\n \n=\n \nMY_TASK_GPIO_EVENT\n;\n \nhal_gpio_irq_init\n(\n0\n, \nmy_gpio_irq\n, \nNULL\n, \nGPIO_TRIG_RISING\n,\n \nGPIO_PULL_NONE\n);\n \nhal_gpio_irq_enable\n(\n0\n);\n\n \nhal_gpio_init_out\n(\nTASK_LED\n, \n1\n);\n \nhal_gpio_init_out\n(\nCALLOUT_LED\n, \n1\n);\n \nhal_gpio_init_out\n(\nGPIO_LED\n, \n1\n);\n}\n\n\nint\n\n\nmain\n(\nint\n \nargc\n, \nchar\n \n**argv\n)\n{\n \nos_init\n();\n\n \ninit_tasks\n();\n \nos_start\n();\n \nassert\n(\n0\n);\n \nreturn\n \n0\n;\n}",
- "title": "A task to manage multiple events"
+ "title": "Add task to manage multiple events"
},
{
"location": "/os/tutorials/event_queue/#how-to-define-a-task-which-uses-event-queues-to-manage-multiple-events",
@@ -5611,16 +5681,191 @@
"title": "toc"
},
{
+ "location": "/network/ble/nimble_setup/",
+ "text": "Set up a NimBLE application\n\n\nThis tutorial explains how to setup an application using the Nimble stack. The end result will be a framework that you can use to create your own BLE application using the nimble stack.\n\n\nThis tutorial assumes that you have already installed a source tree and are familiar with the newt tools and concepts.\n\n\nCreate the application directory\n\n\n\n\nCreate the target\n\n\nThe first step will be to create the target that you will use to build your application. We will call this target \"ble_tgt\". Type the \nnewt target create ble_tgt\n command. You should get this:\n\n\n$ newt target create ble_tgt\nTarget targets/ble_tgt successfully created\n\n\n\n\n\nWhat this command just did was to create a directory called \nble_tgt\n in the targets directory of your project. Two files are created in that directory: pkg.yml and target.yml.\n\n\nThe target is not yet complete though! We need to set some target variables for this project
. Currently, the nimble stack has been ported to the Nordic nrf5x chipsets; specifically the nrf51 and nrf52. This application will use the nrf52 but we will also show the setup for the nrf51 in case your project uses that chip.\n\n\nHere is the command you will need to setup your target for the nrf52:\n\n\n$ newt target set ble_tgt app=apps/ble_app \\\n bsp=hw/bsp/nrf52pdk \\\n build_profile=optimized\nTarget targets/ble_tgt successfully set target.app to apps/ble_app\nTarget targets/ble_tgt successfully set target.bsp to hw/bsp/nrf52pdk\nTarget targets/ble_tgt successfully set target.build_profile to optimized\n\n\n\n\n\nHere is the command you will need to setup your target for the nrf51:\n\n\n$ newt target set ble_tgt app=apps/ble_app \\\n bsp=hw/bsp/nrf51dk \\\n build_profile=optimized\nTarget targets/ble_tgt successfully set target.app to apps/ble_
app\nTarget targets/ble_tgt successfully set target.bsp to hw/bsp/nrf51dk\nTarget targets/ble_tgt successfully set target.build_profile to optimized\n\n\n\n\n\n\n\nNimble stack initialization\n\n\nWe are now going to explain how to setup your application to initialize the nimble stack and to get the basic stack, and its required modules, initialized and up and running. Note that the code shown here is an example of what is required for nimble stack operation; it is not intended to dictate to the developer exactly how to organize/setup your code. For example, the code sample shows modification of main.c in the application /src folder. The developer has the flexibility to organize the code as they see fit so this code does not need to reside in /src/main.c nor in the main() function itself. The only possible issue is the order of some of the initializations. Where this order is important it is indicated in the tutorial.\n\n\nA note about the code samples: the main() function in each c
ode sample builds upon the previous example. However, code outside of main() shows only what we add for each step. The last code sample shows the entire main.c that we created.\n\n\nLet's start with a very basic main() function (shown below). In this main all we are doing is initializing the Mynewt OS and starting it.\n\n\n#include \nos/os.h\n\n\n\nint\n\n\nmain\n(\nvoid\n)\n{\n \n/* Initialize OS */\n\n \nos_init\n();\n\n \n/* Start the OS */\n\n \nos_start\n();\n\n \n/* os start should never return. If it does, this should be an error */\n\n \nassert\n(\n0\n);\n}\n\n\n\n\n\nThe Nimble stack requires a number of packages/modules to be initialized prior to being initialized. We are going to add these one by one to the application and describe each.\n\n\n\n\nAdd cputime\n\n\nThe Nimble stack requires \"cputime\". This is provided by the Mynewt HAL of the\nsame name. The cputime HAL provides a high resolution timer that is used by the\nnimble stack (as the BLE specif
ication requires a fairly high resolution timer\nand has fairly tight timing requirements). The cputime HAL allows the user to\nspecify the timer resolution as different applications may require a different\nresolution. While the Nimble stack does not require a specific timer resolution\nper se, a resolution that is too large may affect performance and power\nefficiency. A suggested clock rate for HAL cputime for the nimble stack is 1\nMHz, or 1 microsecond per cputime tick. This provides enough resolution for\nmost needs while providing the Nimble stack enough resolution to implement the\nBLE specification.\n\n\nAdd the initialization of cputime to your application:\n\n\n#include \nhal/hal_cputime.h\n\n\n\n\nint\n\n\nmain\n(\nvoid\n)\n{\n \nint\n \nrc\n;\n\n \n/* Initialize OS */\n\n \nos_init\n();\n\n\n \n/* Set cputime to count at 1 usec increments */\n\n\n \nrc\n \n=\n \ncputime_init\n(\n1000000\n);\n\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n\n \n/* Start the O
S */\n\n \nos_start\n();\n\n \n/* os start should never return. If it does, this should be an error */\n\n \nassert\n(\n0\n);\n}\n\n\n\n\n\n\n\nCreate the system memory buffer pool\n\n\nThe Nimble stack allocates packet buffers (called mbufs) from the system memory buffer pool (msys). The system memory buffer pool and mbufs are described in the OS manual; we suggest reading that section in order to become familiar with mbufs if you are not already familiar with them. Note that the application itself (the unique application code that you are writing) does not need to use mbufs and none of the BLE host API exposed to the application developer uses them. However, the Nimble stack does require the existence of the system memory pool.\n\n\nCreating the memory pool and registering it with the system memory buffer pool can be a bit tricky the first time. However, using the template provided below it should be much easier. The header file /net/nimble/include/nimble/ble.h, which sho
uld be included in main.c, contains some MBUF macros that you will need to create the memory pool used by msys. The macro \nBLE_MBUF_PAYLOAD_SIZE\n defines the maximum amount of user payload, plus overhead, that a link layer BLE PDU can contain. The macro \nBLE_MBUF_MEMBLOCK_OVERHEAD\n is the amount of overhead required by the Nimble stack in each memory block used by the mbuf pool. The macro \nMBUF_NUM_MBUFS\n defines the number of mbufs in the mbuf pool and is defined locally. The user must determine, based on application requirements and platform memory size, how many mbufs are required. For example, if your application expects to have many simultaneous connections you may want to increase the size of the mbuf pool. In the example below, we assume you are only using a small number of active connections (2 to 3).\n\n\nA note about the size of the mbufs and \nBLE_MBUF_PAYLOAD_SIZE\n. Msys allows for multiple mbuf pools of various size. Currently, the Nimble stack requires that msys
has an mbuf pool registered that can accommodate the maximum size BLE LL PDU. Thus, we only show the creation of one mbuf pool of maximum size mbufs which gets registered to the system mbuf memory pool. We plan on modifying the Nimble stack so that smaller mbufs can be used (to conserve memory) but at this point in time you cannot modify \nBLE_MBUF_PAYLOAD_SIZE\n. Furthermore, you cannot add a mbuf pool of smaller size elements to the msys pool as the msys code might then allocate a mbuf that is too small for the nimble stack.\n\n\n/* Create a mbuf pool of BLE mbufs */\n\n\n#define MBUF_NUM_MBUFS (8)\n\n\n#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)\n\n\n#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)\n\n\n#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)\n\n\n\n\nstruct\n \nos_mbuf_pool\n \ng_mbuf_pool\n;\n\nstruct\n \nos_mempool\n \ng_mbuf_mempool\n;\n\nos_membuf_t\n \ng_mbuf_buffer\n[\nMBUF_MEMPOOL_SIZ
E\n];\n\n\n\nint\n\n\nmain\n(\nvoid\n)\n{\n \nint\n \nrc\n;\n\n \n/* Initialize OS */\n\n \nos_init\n();\n\n \n/* Set cputime to count at 1 usec increments */\n\n \nrc\n \n=\n \ncputime_init\n(\n1000000\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n\n \n/* Create memory pool for Nimble packets and register with Msys */\n\n\n \nrc\n \n=\n \nos_mempool_init\n(\ng_mbuf_mempool\n, \nMBUF_NUM_MBUFS\n,\n\n \nMBUF_MEMBLOCK_SIZE\n, \ng_mbuf_buffer\n[\n0\n], \nmbuf_pool\n);\n\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n\n\n \nrc\n \n=\n \nos_mbuf_pool_init\n(\ng_mbuf_pool\n, \ng_mbuf_mempool\n, \nMBUF_MEMBLOCK_SIZE\n,\n\n \nMBUF_NUM_MBUFS\n);\n\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n\n\n \nrc\n \n=\n \nos_msys_register\n(\ng_mbuf_pool\n);\n\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n\n \n/* Start the OS */\n\n \nos_start\n();\n\n \n/* os start should never return. If it does, this should be an error */\n\n \nassert\n(\n0
\n);\n}\n\n\n\n\n\n\n\nInitializing the device address\n\n\nThe BLE specification requires that devices have an address (called a device address). This address can be either a public device address or a random device address. The current Nimble stack implementation requires that these addresses be defined somewhere in the application; they are not defined within the Nimble stack itself. This was done so that the entire application could have access to these addresses. We expect that we will move these addresses into the Nimble stack in a future release.\n\n\nThe two variables that must be defined are named \ng_dev_addr\n (public device address) and \ng_random_addr\n (static random address). The device address must be initialized prior to initializing the Nimble stack. The random address does not have to be initialized ahead of time as it is possible to set the random address in the Nimble controller when it is running. In this example, we only initialize the device address. The comp
any OUI in this example is 0a:bb:cc; the unique portion is 11:22:33 for a device address equal to 0a:bb:cc:11:22:33. Note that we store the address in little endian order as BLE expects the OUI to be in the most significant bytes.\n\n\n/* Our global device address (public) */\n\n\nuint8_t\n \ng_dev_addr\n[\nBLE_DEV_ADDR_LEN\n];\n\n\n\n/* Our random address (static) */\n\n\nuint8_t\n \ng_random_addr\n[\nBLE_DEV_ADDR_LEN\n];\n\n\n\nint\n\n\nmain\n(\nvoid\n)\n{\n \nint\n \nrc\n;\n\n \n/* Initialize OS */\n\n \nos_init\n();\n\n \n/* Set cputime to count at 1 usec increments */\n\n \nrc\n \n=\n \ncputime_init\n(\n1000000\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n \n/* Create memory pool for Nimble packets and register with Msys */\n\n \nrc\n \n=\n \nos_mempool_init\n(\ng_mbuf_mempool\n, \nMBUF_NUM_MBUFS\n,\n \nMBUF_MEMBLOCK_SIZE\n, \ng_mbuf_buffer\n[\n0\n], \nmbuf_pool\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n \nrc\n \n=\n \nos_mbuf_pool_init\n(\
ng_mbuf_pool\n, \ng_mbuf_mempool\n, \nMBUF_MEMBLOCK_SIZE\n,\n \nMBUF_NUM_MBUFS\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n \nrc\n \n=\n \nos_msys_register\n(\ng_mbuf_pool\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n\n \n/* Initialize our device address */\n\n\n \ng_dev_addr\n[\n0\n] \n=\n \n0x33\n;\n\n \ng_dev_addr\n[\n1\n] \n=\n \n0x22\n;\n\n \ng_dev_addr\n[\n2\n] \n=\n \n0x11\n;\n\n \ng_dev_addr\n[\n3\n] \n=\n \n0xcc\n;\n\n \ng_dev_addr\n[\n4\n] \n=\n \n0xbb\n;\n\n \ng_dev_addr\n[\n5\n] \n=\n \n0x0a\n;\n\n\n \n/* Start the OS */\n\n \nos_start\n();\n\n \n/* os start should never return. If it does, this should be an error */\n\n \nassert\n(\n0\n);\n}\n\n\n\n\n\n\n\nInitializing the statistics package\n\n\nThe Nimble stack uses the statistics package and this must be initialized prior to initializing the Nimble stack. Initializing the statistics package is quite simple; all you need to do is call the initialization fu
nction \nstats_module_init()\n.\n\n\n#include \nstats/stats.h\n\n\n\n\nint\n\n\nmain\n(\nvoid\n)\n{\n \nint\n \nrc\n;\n\n \n/* Initialize OS */\n\n \nos_init\n();\n\n \n/* Set cputime to count at 1 usec increments */\n\n \nrc\n \n=\n \ncputime_init\n(\n1000000\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n \n/* Create memory pool for Nimble packets and register with Msys */\n\n \nrc\n \n=\n \nos_mempool_init\n(\ng_mbuf_mempool\n, \nMBUF_NUM_MBUFS\n,\n \nMBUF_MEMBLOCK_SIZE\n, \ng_mbuf_buffer\n[\n0\n], \nmbuf_pool\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n \nrc\n \n=\n \nos_mbuf_pool_init\n(\ng_mbuf_pool\n, \ng_mbuf_mempool\n, \nMBUF_MEMBLOCK_SIZE\n,\n \nMBUF_NUM_MBUFS\n);\n \nassert\n(\nrc\n \n==\n \n0\n);\n\n \nrc\n \n=\n \nos_msys_register\n(\ng_mbuf_pool\n);\n \nassert\
<TRUNCATED>
[7/7] incubator-mynewt-site git commit: Broke NimBLE tutorial into
multiple sections. Added Newt tutorial and theory of ops. Rearranged
tutorials for better flow. This is work in progress.
Posted by ad...@apache.org.
Broke NimBLE tutorial into multiple sections. Added Newt tutorial and theory of ops. Rearranged tutorials for better flow. This is work in progress.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/6dba32a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/6dba32a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/6dba32a6
Branch: refs/heads/asf-site
Commit: 6dba32a6df7ef91935d067c8cf2cd657b0ac9ff7
Parents: 7436536
Author: aditihilbert <ad...@runtime.io>
Authored: Wed Mar 23 11:27:31 2016 -0700
Committer: aditihilbert <ad...@runtime.io>
Committed: Wed Mar 23 11:27:31 2016 -0700
----------------------------------------------------------------------
documentation/index.html | 9 +-
events/index.html | 8 +-
index.html | 10 +-
mkdocs/search_index.json | 397 ++++++--
network/ble/ble_intro/index.html | 29 +-
network/ble/ini_stack/ble_add_cpu/index.html | 593 +++++++++++
network/ble/ini_stack/ble_consolepkg/index.html | 610 ++++++++++++
.../ble/ini_stack/ble_controller_ini/index.html | 656 ++++++++++++
network/ble/ini_stack/ble_devadd/index.html | 607 +++++++++++
network/ble/ini_stack/ble_host_ini/index.html | 651 ++++++++++++
network/ble/ini_stack/ble_ini_intro/index.html | 577 +++++++++++
network/ble/ini_stack/ble_mempool/index.html | 604 +++++++++++
network/ble/ini_stack/ble_statpkg/index.html | 606 +++++++++++
network/ble/nimble_setup/index.html | 997 +++++++++++++++++++
newt/command_list/newt_app/index.html | 25 +-
newt/command_list/newt_help/index.html | 23 +-
newt/command_list/newt_new/index.html | 23 +-
newt/command_list/newt_pkg/index.html | 23 +-
newt/command_list/newt_target/index.html | 23 +-
newt/command_list/newt_version/index.html | 23 +-
newt/install/newt_linux/index.html | 17 +-
newt/install/newt_mac/index.html | 13 +-
newt/newt_intro/index.html | 182 +++-
newt/newt_operation/index.html | 664 ++++++++++++
newt/newt_ops/index.html | 33 +-
newt/tutorials/define_target/index.html | 433 --------
newtmgr/project-slinky/index.html | 2 +-
newtmgr/project-target-slinky/index.html | 2 +-
os/modules/logs/logs/index.html | 2 +-
os/os_user_guide/index.html | 2 +-
os/tutorials/STM32F303/index.html | 44 +-
os/tutorials/add_repos/index.html | 117 ++-
os/tutorials/air_quality_sensor/index.html | 48 +-
os/tutorials/arduino_zero/index.html | 44 +-
os/tutorials/bletiny_project/index.html | 566 +++++++++++
os/tutorials/create_repo/index.html | 703 +++++++++++++
os/tutorials/define_target/index.html | 566 +++++++++++
os/tutorials/event_queue/index.html | 54 +-
os/tutorials/nRF52/index.html | 48 +-
os/tutorials/olimex/index.html | 44 +-
os/tutorials/tutorials/index.html | 44 +-
os/tutorials/unit_test/index.html | 48 +-
os/tutorials/upgrade_repo/index.html | 575 +++++++++++
sitemap.xml | 28 +-
44 files changed, 10006 insertions(+), 767 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/documentation/index.html
----------------------------------------------------------------------
diff --git a/documentation/index.html b/documentation/index.html
index 740386b..1209fac 100644
--- a/documentation/index.html
+++ b/documentation/index.html
@@ -298,11 +298,8 @@
<li class="">
<a href="
-
-
- ../newt/tutorials/define_target/
-
-">Tutorials</a>
+ ../newt/newt_operation/
+">Newt Theory of Ops</a>
</li>
@@ -312,7 +309,7 @@
../newt/newt_ops/
-">Manual</a>
+">User Guide</a>
</li>
</ul>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/events/index.html
----------------------------------------------------------------------
diff --git a/events/index.html b/events/index.html
index 12e18fb..c95ff03 100644
--- a/events/index.html
+++ b/events/index.html
@@ -175,10 +175,10 @@
</div>
<div class="event">
- <h2>See us at Bluetooth World!</h2>
- <p>March 15 - 16, 2016</p>
- <p>Levi's Stadium, CA, USA</p>
- <p>Find out more about our open-source offering at this event featuring the best of IoT innovations powered by Bluetooth</p>
+ <h2>See us at OpenIOT Summit!</h2>
+ <p>April 4 - 6, 2016</p>
+ <p>Manchester Grand Hyatt, San Diego, CA, USA</p>
+ <p>Find out more about our open-source offering at this event for embedded developers, application developers, systems architects, and firmware developers working on IoT solutions.</p>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/index.html
----------------------------------------------------------------------
diff --git a/index.html b/index.html
index 1a2dcd9..27d9175 100644
--- a/index.html
+++ b/index.html
@@ -163,9 +163,9 @@
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
- <h3>See us at Bluetooth World!</h3>
- <p>Levi's Stadium, CA, USA</p>
- <p>March 15 - 16, 2016</p>
+ <h3>See us at OpenIOT Summit!</h3>
+ <p>Manchester Grand Hyatt, San Diego, CA, USA</p>
+ <p>April 4 - 6, 2016</p>
<a href="/events/">Click here for more details</a>
</div>
</div>
@@ -195,14 +195,14 @@
<span class="helper"></span>
<img src="/img/folder.png">
</div>
- <p>Produce a foundational RTOS and embedded middleware utilities such as boot loaders, file systems, and time-series data support</p>
+ <p>Produce a foundational RTOS with utilities such as boot loaders, file systems, and time-series data support</p>
</div>
<div class="column col-md-6 goal text-center">
<div class="goal-image">
<span class="helper"></span>
<img src="/img/watch.png">
</div>
- <p>Build solid networking stack support for secure, efficient communications with constrained devices</p>
+ <p>Build networking stacks for secure, efficient communications with constrained devices, starting with Bluetooth Low Energy 4.2</p>
</div>
</div>
<div class="row">
[3/7] incubator-mynewt-site git commit: Broke NimBLE tutorial into
multiple sections. Added Newt tutorial and theory of ops. Rearranged
tutorials for better flow. This is work in progress.
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/network/ble/nimble_setup/index.html
----------------------------------------------------------------------
diff --git a/network/ble/nimble_setup/index.html b/network/ble/nimble_setup/index.html
new file mode 100644
index 0000000..85d1d20
--- /dev/null
+++ b/network/ble/nimble_setup/index.html
@@ -0,0 +1,997 @@
+<!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">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/network/ble/nimble_setup/">
+ <link rel="shortcut icon" href="../../../img/favicon.ico">
+
+ <title>Set up application - Apache Mynewt</title>
+
+ <link href="../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../css/font-awesome-4.0.3.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='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../extra.css" rel="stylesheet">
+
+ <!-- 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', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="Set up application">
+
+
+ <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- 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>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/about/">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="/documentation/" class="dropdown-toggle" data-toggle="dropdown">Docs <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+
+
+
+
+
+
+ <li >
+ <a href="../../../documentation/">
+ Overview
+ </a>
+ </li>
+
+
+
+
+
+
+
+
+
+ <li class="active">
+ <a href="../../../os/get_started/introduction/">
+ Mynewt OS Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newt/newt_intro/">
+ Newt Tool Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../newtmgr/overview/">
+ Newt Manager Manual
+ </a>
+ </li>
+
+
+
+ <li >
+ <a href="../../../os/tutorials/how_to_edit_docs/">
+ Appendix
+ </a>
+ </li>
+
+
+ </ul>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div id="docSidebar" class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../os/get_started/introduction/
+">Mynewt OS Manual</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+ <li>
+ <a href="../../../os/get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../../../os/get_started/get_started/">Quick Start</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../os/get_started/vocabulary/">Concepts</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../os/tutorials/tutorials/">Tutorials</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../os/os_user_guide/">OS User Guide</a></li>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../ble_intro/
+
+">Networking User Guide</a>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+ <li ><a href="../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+ <ul class="current-toc">
+
+
+
+
+
+
+ <li class="active">
+ Set up application
+ </li>
+
+
+
+
+
+
+
+
+ <li ><a href="../ini_stack/ble_ini_intro/">Initialize stack</a></li>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../os/tutorials/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-offset-3 col-md-9 documentation-viewer" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-6">
+
+<ul class="nav nav-pills">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li class="active" role="presentation"><a href="../../../os/get_started/introduction/">Mynewt OS</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newt/newt_intro/">Newt Tool</a></li>
+
+
+
+ <li role="presentation"><a href="../../../newtmgr/overview/">Newt Mgr</a></li>
+
+
+
+
+</ul>
+ </div>
+ <div class="col-sm-6">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="/documentation/">Docs</a></li>
+
+
+
+ <li>» Networking User Guide</li>
+
+
+
+ <li>» <a href="../ble_intro/">NimBLE - Mynewt BLE Stack</a></li>
+
+
+
+ <li>» Set up application</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="set-up-a-nimble-application">Set up a NimBLE application<a class="headerlink" href="#set-up-a-nimble-application" title="Permanent link">¶</a></h2>
+<p>This tutorial explains how to setup an application using the Nimble stack. The end result will be a framework that you can use to create your own BLE application using the nimble stack.</p>
+<p>This tutorial assumes that you have already installed a source tree and are familiar with the newt tools and concepts.</p>
+<h3 id="create-the-application-directory">Create the application directory<a class="headerlink" href="#create-the-application-directory" title="Permanent link">¶</a></h3>
+<p><This needs to be added. This should talk about how you create the pkg.yml file in the apps directory that the user will create. Also, discuss other application dir stuff></p>
+<h3 id="create-the-target">Create the target<a class="headerlink" href="#create-the-target" title="Permanent link">¶</a></h3>
+<p>The first step will be to create the target that you will use to build your application. We will call this target "ble_tgt". Type the <code>newt target create ble_tgt</code> command. You should get this:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ newt target create ble_tgt
+Target targets/ble_tgt successfully created
+</pre></div>
+
+
+<p>What this command just did was to create a directory called <code>ble_tgt</code> in the targets directory of your project. Two files are created in that directory: pkg.yml and target.yml.</p>
+<p>The target is not yet complete though! We need to set some target variables for this project. Currently, the nimble stack has been ported to the Nordic nrf5x chipsets; specifically the nrf51 and nrf52. This application will use the nrf52 but we will also show the setup for the nrf51 in case your project uses that chip.</p>
+<p>Here is the command you will need to setup your target for the nrf52:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ newt target set ble_tgt app=apps/ble_app \
+ bsp=hw/bsp/nrf52pdk \
+ build_profile=optimized
+Target targets/ble_tgt successfully set target.app to apps/ble_app
+Target targets/ble_tgt successfully set target.bsp to hw/bsp/nrf52pdk
+Target targets/ble_tgt successfully set target.build_profile to optimized
+</pre></div>
+
+
+<p>Here is the command you will need to setup your target for the nrf51:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ newt target set ble_tgt app=apps/ble_app \
+ bsp=hw/bsp/nrf51dk \
+ build_profile=optimized
+Target targets/ble_tgt successfully set target.app to apps/ble_app
+Target targets/ble_tgt successfully set target.bsp to hw/bsp/nrf51dk
+Target targets/ble_tgt successfully set target.build_profile to optimized
+</pre></div>
+
+
+<p><br></p>
+<h3 id="nimble-stack-initialization">Nimble stack initialization<a class="headerlink" href="#nimble-stack-initialization" title="Permanent link">¶</a></h3>
+<p>We are now going to explain how to setup your application to initialize the nimble stack and to get the basic stack, and its required modules, initialized and up and running. Note that the code shown here is an example of what is required for nimble stack operation; it is not intended to dictate to the developer exactly how to organize/setup your code. For example, the code sample shows modification of main.c in the application /src folder. The developer has the flexibility to organize the code as they see fit so this code does not need to reside in /src/main.c nor in the main() function itself. The only possible issue is the order of some of the initializations. Where this order is important it is indicated in the tutorial.</p>
+<p>A note about the code samples: the main() function in each code sample builds upon the previous example. However, code outside of main() shows only what we add for each step. The last code sample shows the entire main.c that we created.</p>
+<p>Let's start with a very basic main() function (shown below). In this main all we are doing is initializing the Mynewt OS and starting it.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #633820">#include "os/os.h"</span>
+
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p>The Nimble stack requires a number of packages/modules to be initialized prior to being initialized. We are going to add these one by one to the application and describe each.</p>
+<p><br></p>
+<h4 id="add-cputime">Add cputime<a class="headerlink" href="#add-cputime" title="Permanent link">¶</a></h4>
+<p>The Nimble stack requires "cputime". This is provided by the Mynewt HAL of the
+same name. The cputime HAL provides a high resolution timer that is used by the
+nimble stack (as the BLE specification requires a fairly high resolution timer
+and has fairly tight timing requirements). The cputime HAL allows the user to
+specify the timer resolution as different applications may require a different
+resolution. While the Nimble stack does not require a specific timer resolution
+per se, a resolution that is too large may affect performance and power
+efficiency. A suggested clock rate for HAL cputime for the nimble stack is 1
+MHz, or 1 microsecond per cputime tick. This provides enough resolution for
+most needs while providing the Nimble stack enough resolution to implement the
+BLE specification.</p>
+<p>Add the initialization of cputime to your application:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "hal/hal_cputime.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h4 id="create-the-system-memory-buffer-pool">Create the system memory buffer pool<a class="headerlink" href="#create-the-system-memory-buffer-pool" title="Permanent link">¶</a></h4>
+<p>The Nimble stack allocates packet buffers (called mbufs) from the system memory buffer pool (msys). The system memory buffer pool and mbufs are described in the OS manual; we suggest reading that section in order to become familiar with mbufs if you are not already familiar with them. Note that the application itself (the unique application code that you are writing) does not need to use mbufs and none of the BLE host API exposed to the application developer uses them. However, the Nimble stack does require the existence of the system memory pool.</p>
+<p>Creating the memory pool and registering it with the system memory buffer pool can be a bit tricky the first time. However, using the template provided below it should be much easier. The header file /net/nimble/include/nimble/ble.h, which should be included in main.c, contains some MBUF macros that you will need to create the memory pool used by msys. The macro <code>BLE_MBUF_PAYLOAD_SIZE</code> defines the maximum amount of user payload, plus overhead, that a link layer BLE PDU can contain. The macro <code>BLE_MBUF_MEMBLOCK_OVERHEAD</code> is the amount of overhead required by the Nimble stack in each memory block used by the mbuf pool. The macro <code>MBUF_NUM_MBUFS</code> defines the number of mbufs in the mbuf pool and is defined locally. The user must determine, based on application requirements and platform memory size, how many mbufs are required. For example, if your application expects to have many simultaneous connections you may want to increase the size of the mbuf p
ool. In the example below, we assume you are only using a small number of active connections (2 to 3).</p>
+<p>A note about the size of the mbufs and <code>BLE_MBUF_PAYLOAD_SIZE</code>. Msys allows for multiple mbuf pools of various size. Currently, the Nimble stack requires that msys has an mbuf pool registered that can accommodate the maximum size BLE LL PDU. Thus, we only show the creation of one mbuf pool of maximum size mbufs which gets registered to the system mbuf memory pool. We plan on modifying the Nimble stack so that smaller mbufs can be used (to conserve memory) but at this point in time you cannot modify <code>BLE_MBUF_PAYLOAD_SIZE</code>. Furthermore, you cannot add a mbuf pool of smaller size elements to the msys pool as the msys code might then allocate a mbuf that is too small for the nimble stack.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #177500">/* Create a mbuf pool of BLE mbufs */</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_NUM_MBUFS (8)</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)</span>
+</span><span style="background-color: #ffffcc"><span style="color: #633820">#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)</span>
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf_pool</span> <span style="color: #000000">g_mbuf_pool</span>;
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">struct</span> <span style="color: #000000">os_mempool</span> <span style="color: #000000">g_mbuf_mempool</span>;
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">os_membuf_t</span> <span style="color: #000000">g_mbuf_buffer</span>[<span style="color: #000000">MBUF_MEMPOOL_SIZE</span>];
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h4 id="initializing-the-device-address">Initializing the device address<a class="headerlink" href="#initializing-the-device-address" title="Permanent link">¶</a></h4>
+<p>The BLE specification requires that devices have an address (called a device address). This address can be either a public device address or a random device address. The current Nimble stack implementation requires that these addresses be defined somewhere in the application; they are not defined within the Nimble stack itself. This was done so that the entire application could have access to these addresses. We expect that we will move these addresses into the Nimble stack in a future release.</p>
+<p>The two variables that must be defined are named <code>g_dev_addr</code> (public device address) and <code>g_random_addr</code> (static random address). The device address must be initialized prior to initializing the Nimble stack. The random address does not have to be initialized ahead of time as it is possible to set the random address in the Nimble controller when it is running. In this example, we only initialize the device address. The company OUI in this example is 0a:bb:cc; the unique portion is 11:22:33 for a device address equal to 0a:bb:cc:11:22:33. Note that we store the address in little endian order as BLE expects the OUI to be in the most significant bytes.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #177500">/* Our global device address (public) */</span>
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">uint8_t</span> <span style="color: #000000">g_dev_addr</span>[<span style="color: #000000">BLE_DEV_ADDR_LEN</span>];
+</span><span style="background-color: #ffffcc">
+</span><span style="background-color: #ffffcc"><span style="color: #177500">/* Our random address (static) */</span>
+</span><span style="background-color: #ffffcc"><span style="color: #A90D91">uint8_t</span> <span style="color: #000000">g_random_addr</span>[<span style="color: #000000">BLE_DEV_ADDR_LEN</span>];
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize our device address */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h4 id="initializing-the-statistics-package">Initializing the statistics package<a class="headerlink" href="#initializing-the-statistics-package" title="Permanent link">¶</a></h4>
+<p>The Nimble stack uses the statistics package and this must be initialized prior to initializing the Nimble stack. Initializing the statistics package is quite simple; all you need to do is call the initialization function <code>stats_module_init()</code>.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "stats/stats.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize the statistics package */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h4 id="initializing-the-console-package">Initializing the console package<a class="headerlink" href="#initializing-the-console-package" title="Permanent link">¶</a></h4>
+<p>The console is also required by the Nimble stack. The console is currently used for log output so it needs to be initialized. For this example, we are not going to use a console receive callback. All this means is that input from the console will not be accepted by default; the developer will have to install their own handler or use one provided by another package (the shell, for example). Just like statistics, the console is initialized by calling the console initialization function <code>console_init()</code>.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "console/console.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+ <span style="color: #177500">/* Initialize the statistics package */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Init the console */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">console_init</span>(<span style="color: #A90D91">NULL</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h4 id="initializing-the-nimble-controller">Initializing the Nimble controller<a class="headerlink" href="#initializing-the-nimble-controller" title="Permanent link">¶</a></h4>
+<p>The Nimble controller is initialized via a call to <code>ble_ll_init()</code>. This function is declared as follows:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">int</span> <span style="color: #000000">ble_ll_init</span>(<span style="color: #A90D91">uint8_t</span> <span style="color: #000000">ll_task_prio</span>, <span style="color: #A90D91">uint8_t</span> <span style="color: #000000">num_acl_pkts</span>, <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">acl_pkt_size</span>)
+</pre></div>
+
+
+<p>This function's parameters are documented below.</p>
+<table>
+<thead>
+<tr>
+<th><strong>Parameter</strong></th>
+<th><strong>Description</strong></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><em>prio</em></td>
+<td>The priority of the Nimble controller task. A lower number corresponds to higher priority.</td>
+</tr>
+<tr>
+<td><em>num_acl_pkts</em></td>
+<td>The maximum number of outstanding data packets that the controller will accept from the host.</td>
+</tr>
+<tr>
+<td><em>acl_pkt_size</em></td>
+<td>The maximum data packet size that the controller will accept from the host.</td>
+</tr>
+</tbody>
+</table>
+<p><strong>prio</strong>:</p>
+<p>If you are not familiar with multitasking, preemptive operating systems we
+highly encourage you to read the Core OS section of Mynewt OS manual. It is up
+to the application developer to decide the priority of tasks in the system.
+Note that the lower the priority number the higher the priority in the OS. For
+example, if a task is running at priority 5 and a task at priority 3 wants to
+run, the task at priority 5 gets preempted as the other task is a higher
+proiority.</p>
+<p>In the example shown below, the LL task is configured to have the highest
+priority (priority 0). We recommend making the BLE LL task the highest priority
+task in your application as it has fairly rigorous timing requirements and
+allowing other tasks to preempt the LL task could cause undesirable behavior.
+Note that we do not force this to be the case as an application may require a
+task to be even higher priority than the LL task. Just be warned: a task
+higher in priority than the LL task should not perform actions that take too
+long; even a few milliseconds could cause undesirable behavior.</p>
+<p><strong>num_acl_pkts</strong> and <strong>acl_pkt_size</strong>:</p>
+<p>These two parameters are used to limit the amount of data the host tries to send through the controller. Nimble uses the msys facility for allocating data packets, so the product of these arguments must not be larger than the total amount of memory allocated for msys. The below example uses some values that are reasonable for most uses.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "controller/ble_ll.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">ble_hs_cfg</span> <span style="color: #000000">cfg</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+ <span style="color: #177500">/* Initialize the statistics package */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize the BLE LL */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">ble_ll_init</span>(<span style="color: #1C01CE">0</span>, <span style="color: #1C01CE">7</span>, <span style="color: #1C01CE">260</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h5 id="initializing-the-nimble-host">Initializing the Nimble host<a class="headerlink" href="#initializing-the-nimble-host" title="Permanent link">¶</a></h5>
+<p>The Nimble host is initialized via a call to <code>ble_hs_init()</code>. This function is declared as follows:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">int</span> <span style="color: #000000">ble_hs_init</span>(<span style="color: #A90D91">uint8_t</span> <span style="color: #000000">prio</span>, <span style="color: #A90D91">struct</span> <span style="color: #000000">ble_hs_cfg</span> <span style="color: #000000">*cfg</span>)
+</pre></div>
+
+
+<p>The parameters are documented below.</p>
+<table>
+<thead>
+<tr>
+<th><strong>Parameter</strong></th>
+<th><strong>Description</strong></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><em>prio</em></td>
+<td>The priority of the Nimble host task. A lower number corresponds to higher priority.</td>
+</tr>
+<tr>
+<td><em>cfg</em></td>
+<td>A pointer to the desired host configuration, or <em>NULL</em> if you want to use the default settings.</td>
+</tr>
+</tbody>
+</table>
+<p><strong>prio</strong>:</p>
+<p>Unlike the controller, the host does not have any strict timing requirements.
+This number should be greater than the priority of any time-critical tasks in
+your application (remember, bigger number = lower priority!). There are no
+restrictions with regards to the host task's priority relative to its client
+tasks. In the below example, the host is assigned a priority of 1.</p>
+<p><strong>cfg</strong>:</p>
+<p>As mentioned above, passing a <em>cfg</em> value of <em>NULL</em> will initialize the Nimble
+host with the default configuration. This is convenient while familiarizing
+yourself with the Nimble stack, but ultimately you will probably want to use a
+custom configuration. For more information on configuring the host, see the
+Nimble Configuration Guide (TBD).</p>
+<p>Continuing with our running example, we now add Nimble host initialization to the <em>main()</em> function. This application uses the default host configuration, so it specifies <em>NULL</em> as the second argument to <code>ble_hs_init()</code>.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="background-color: #ffffcc"><span style="color: #633820">#include "host/ble_hs.h"</span>
+</span>
+<span style="color: #A90D91">int</span>
+<span style="color: #000000">main</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">ble_hs_cfg</span> <span style="color: #000000">cfg</span>;
+
+ <span style="color: #177500">/* Initialize OS */</span>
+ <span style="color: #000000">os_init</span>();
+
+ <span style="color: #177500">/* Set cputime to count at 1 usec increments */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">cputime_init</span>(<span style="color: #1C01CE">1000000</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Create memory pool for Nimble packets and register with Msys */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_msys_register</span>(<span style="color: #000000">&g_mbuf_pool</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize our device address */</span>
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">0</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x33</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">1</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x22</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">2</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x11</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">3</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xcc</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">4</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0xbb</span>;
+ <span style="color: #000000">g_dev_addr</span>[<span style="color: #1C01CE">5</span>] <span style="color: #000000">=</span> <span style="color: #1C01CE">0x0a</span>;
+
+ <span style="color: #177500">/* Initialize the statistics package */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">stats_module_init</span>();
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #177500">/* Initialize the BLE LL */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">ble_ll_init</span>(<span style="color: #1C01CE">0</span>, <span style="color: #1C01CE">7</span>, <span style="color: #1C01CE">260</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+<span style="background-color: #ffffcc"> <span style="color: #177500">/* Initialize the BLE host. */</span>
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">ble_hs_init</span>(<span style="color: #000000">BLE_HS_TASK_PRI</span>, <span style="color: #A90D91">NULL</span>);
+</span><span style="background-color: #ffffcc"> <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+</span>
+ <span style="color: #177500">/* Start the OS */</span>
+ <span style="color: #000000">os_start</span>();
+
+ <span style="color: #177500">/* os start should never return. If it does, this should be an error */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h3 id="building-the-application">Building the application<a class="headerlink" href="#building-the-application" title="Permanent link">¶</a></h3>
+<p>Now that we have created the application and the target we can build it and test it out. The command you need to run is the newt build command with the target we created (ble_tgt). The output will show the files being compiled and linked. You should see this when all is done (except for the ... of course):</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">wes@~/dev/larva$ newt build ble_tgt
+...
+Archiving os.a
+Compiling cons_fmt.c
+Compiling cons_tty.c
+Archiving full.a
+Linking ble_app.elf
+App successfully built: /Users/wes/dev/larva/bin/ble_tgt/apps/ble_app/ble_app.elf
+</pre></div>
+
+
+<h3 id="conclusion">Conclusion<a class="headerlink" href="#conclusion" title="Permanent link">¶</a></h3>
+<p>You now have a fully functional BLE app (never mind the fact that it doesn't
+actually do anything yet!). With all the necessary infrastructure in place,
+you can now start turning this into a real applicaiton. Additional tutorials
+with focus on adding application-layer functionality to your Nimble application
+will be coming soon. In the meantime, you might get some inspiration from
+apache-mynewt-core's example Nimble apps. These apps can be found at the below locations, relative to your project's base directory:</p>
+<ul>
+<li><em>repos/apache-mynewt-core/apps/bleprph</em></li>
+<li><em>repos/apache-mynewt-core/apps/bletiny</em></li>
+</ul>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../ble_intro/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: NimBLE - Mynewt BLE Stack
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../ini_stack/ble_ini_intro/>
+ Next: Initialize stack
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </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>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/command_list/newt_app/index.html
----------------------------------------------------------------------
diff --git a/newt/command_list/newt_app/index.html b/newt/command_list/newt_app/index.html
index e2700b8..4c060a3 100644
--- a/newt/command_list/newt_app/index.html
+++ b/newt/command_list/newt_app/index.html
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,22 +237,12 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
<ul class="current-toc">
-
-
- <li>
- <a href="../../newt_ops/">Command structure</a>
- </li>
-
-
-
@@ -422,7 +409,7 @@
- <li>» <a href="../../newt_ops/">Manual</a></li>
+ <li>» <a href="../../newt_ops/">User Guide</a></li>
@@ -554,7 +541,7 @@
<a href=../../newt_ops/>
<span class="fa fa-arrow-left"></span>
- Previous: Command structure
+ Previous: User Guide
</a>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/command_list/newt_help/index.html
----------------------------------------------------------------------
diff --git a/newt/command_list/newt_help/index.html b/newt/command_list/newt_help/index.html
index 2fb911d..afee4ae 100644
--- a/newt/command_list/newt_help/index.html
+++ b/newt/command_list/newt_help/index.html
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,22 +237,12 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
<ul class="current-toc">
-
-
- <li>
- <a href="../../newt_ops/">Command structure</a>
- </li>
-
-
-
@@ -422,7 +409,7 @@
- <li>» <a href="../../newt_ops/">Manual</a></li>
+ <li>» <a href="../../newt_ops/">User Guide</a></li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/command_list/newt_new/index.html
----------------------------------------------------------------------
diff --git a/newt/command_list/newt_new/index.html b/newt/command_list/newt_new/index.html
index e183538..84c994a 100644
--- a/newt/command_list/newt_new/index.html
+++ b/newt/command_list/newt_new/index.html
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,22 +237,12 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
<ul class="current-toc">
-
-
- <li>
- <a href="../../newt_ops/">Command structure</a>
- </li>
-
-
-
@@ -422,7 +409,7 @@
- <li>» <a href="../../newt_ops/">Manual</a></li>
+ <li>» <a href="../../newt_ops/">User Guide</a></li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/command_list/newt_pkg/index.html
----------------------------------------------------------------------
diff --git a/newt/command_list/newt_pkg/index.html b/newt/command_list/newt_pkg/index.html
index 2d973d8..3c58525 100644
--- a/newt/command_list/newt_pkg/index.html
+++ b/newt/command_list/newt_pkg/index.html
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,22 +237,12 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
<ul class="current-toc">
-
-
- <li>
- <a href="../../newt_ops/">Command structure</a>
- </li>
-
-
-
@@ -422,7 +409,7 @@
- <li>» <a href="../../newt_ops/">Manual</a></li>
+ <li>» <a href="../../newt_ops/">User Guide</a></li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/command_list/newt_target/index.html
----------------------------------------------------------------------
diff --git a/newt/command_list/newt_target/index.html b/newt/command_list/newt_target/index.html
index b954323..b69a510 100644
--- a/newt/command_list/newt_target/index.html
+++ b/newt/command_list/newt_target/index.html
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,22 +237,12 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
<ul class="current-toc">
-
-
- <li>
- <a href="../../newt_ops/">Command structure</a>
- </li>
-
-
-
@@ -422,7 +409,7 @@
- <li>» <a href="../../newt_ops/">Manual</a></li>
+ <li>» <a href="../../newt_ops/">User Guide</a></li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/command_list/newt_version/index.html
----------------------------------------------------------------------
diff --git a/newt/command_list/newt_version/index.html b/newt/command_list/newt_version/index.html
index e94ba62..c2e5787 100644
--- a/newt/command_list/newt_version/index.html
+++ b/newt/command_list/newt_version/index.html
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,22 +237,12 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
<ul class="current-toc">
-
-
- <li>
- <a href="../../newt_ops/">Command structure</a>
- </li>
-
-
-
@@ -422,7 +409,7 @@
- <li>» <a href="../../newt_ops/">Manual</a></li>
+ <li>» <a href="../../newt_ops/">User Guide</a></li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/install/newt_linux/index.html
----------------------------------------------------------------------
diff --git a/newt/install/newt_linux/index.html b/newt/install/newt_linux/index.html
index 165755d..9aa0864 100644
--- a/newt/install/newt_linux/index.html
+++ b/newt/install/newt_linux/index.html
@@ -250,13 +250,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -264,9 +261,7 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
</li>
@@ -519,8 +514,8 @@
</li>
<li class="pull-right">
- <a href=../../tutorials/define_target/>
- Next: Define a target
+ <a href=../../newt_operation/>
+ Next: Newt Theory of Ops
<span class="fa fa-arrow-right"></span>
</a>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/install/newt_mac/index.html
----------------------------------------------------------------------
diff --git a/newt/install/newt_mac/index.html b/newt/install/newt_mac/index.html
index 12b73ff..e75140f 100644
--- a/newt/install/newt_mac/index.html
+++ b/newt/install/newt_mac/index.html
@@ -250,13 +250,10 @@
+ <li>
+ <a href="../../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -264,9 +261,7 @@
- <li><a href="
- ../../newt_ops/
-">Manual</a>
+ <li ><a href="../../newt_ops/">User Guide</a></li>
</li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/6dba32a6/newt/newt_intro/index.html
----------------------------------------------------------------------
diff --git a/newt/newt_intro/index.html b/newt/newt_intro/index.html
index 1604d92..733839f 100644
--- a/newt/newt_intro/index.html
+++ b/newt/newt_intro/index.html
@@ -226,13 +226,10 @@
+ <li>
+ <a href="../newt_operation/">Newt Theory of Ops</a>
+ </li>
- <li><a href="
- ../tutorials/define_target/
-">Tutorials</a>
-
-
- </li>
@@ -240,9 +237,7 @@
- <li><a href="
- ../newt_ops/
-">Manual</a>
+ <li ><a href="../newt_ops/">User Guide</a></li>
</li>
@@ -344,8 +339,169 @@
</div>
</div>
- <h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permanent link">¶</a></h2>
-<p>What is newt tool?</p>
+ <h2 id="newt-tool">Newt Tool<a class="headerlink" href="#newt-tool" title="Permanent link">¶</a></h2>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permanent link">¶</a></h3>
+<p>Newt is a smart build and package management system for embedded contexts. It is a single tool that accomplishes both the following goals:</p>
+<ul>
+<li>source package management </li>
+<li>build, debug and install.</li>
+</ul>
+<h3 id="rationale">Rationale<a class="headerlink" href="#rationale" title="Permanent link">¶</a></h3>
+<p>In order for the Mynewt operating system to work well for constrained environments across the many different types of microcontroller applications (from doorbells to medical devices to power grids), a system is needed that lets you select which packages to install and which packages to build.</p>
+<p>The build systems for embedded devices are often fairly complicated and not well served for this purpose. For example, autoconf is designed for detecting system compatibility issues but not well suited when it comes to tasks like:</p>
+<ul>
+<li>Building for multiple targets</li>
+<li>Deciding what to build in and what not to build in</li>
+<li>Managing dependencies between components</li>
+</ul>
+<p>Fortunately, solutions addressing these very issues can be found in source package management systems in higher level languages such as Javascript
+(Node), Go, PHP and Ruby. We decided to fuse their source management
+systems with a make system built for embedded systems and create Newt.</p>
+<h3 id="build-system">Build System<a class="headerlink" href="#build-system" title="Permanent link">¶</a></h3>
+<p>A good build system must allow the user to take a few common steps while developing embedded applications:</p>
+<ul>
+<li>Generate full flash images</li>
+<li>Download debug images to a target board using a debugger</li>
+<li>Conditionally compile libraries & code based upon build settings</li>
+</ul>
+<p>Newt can read a directory tree, build a dependency tree, and emit the right build artifacts. An example newt source tree is in incubator-mynewt-blinky/develop:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ tree -L 3
+.
+├── DISCLAIMER
+├── LICENSE
+├── NOTICE
+├── README.md
+<span style="background-color: #ffffcc">├── apps
+</span>│ └── blinky
+│ ├── pkg.yml
+│ └── src
+├── project.yml
+<span style="background-color: #ffffcc">└── targets
+</span> ├── my_blinky_sim
+ │ ├── pkg.yml
+ │ └── target.yml
+ └── unittest
+ ├── pkg.yml
+ └── target.yml
+
+6 directories, 10 files
+</pre></div>
+
+
+<p><br></p>
+<p>When Newt sees a directory tree that contains a "project.yml" file, it is smart enough to recognize it as the base directory of a project, and
+automatically builds a package tree. It also recognizes two important package directories in the package tree - "apps" and "targets". More on these directories in <a href="../newt_operation/">Newt Theory of Ops</a>.</p>
+<p>When Newt is told to build a project, it recursively resolves all package dependencies and generates artifacts that are placed in the bin/ directory at the top-level of the project. The artifact directory is prefixed by the target name being built - <code>my_blinky_sim</code> for example:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ tree bin
+bin
+└── my_blinky_sim
+ ├── apps
+ │ └── blinky
+ │ ├── blinky.a
+ │ ├── blinky.a.cmd
+ │ ├── blinky.elf
+ │ ├── blinky.elf.cmd
+ │ ├── blinky.elf.dSYM
+ │ │ └── Contents
+ │ │ ├── Info.plist
+ │ │ └── Resources
+ │ │ └── DWARF
+ │ │ └── blinky.elf
+ │ ├── blinky.elf.lst
+ │ ├── main.d
+ │ ├── main.o
+ │ └── main.o.cmd
+ ├── hw
+ │ ├── bsp
+ │ │ └── native
+ │ │ ├── hal_bsp.d
+ │ │ ├── hal_bsp.o
+ │ │ ├── hal_bsp.o.cmd
+<snip>
+</pre></div>
+
+
+<p><br></p>
+<h3 id="more-operations-using-newt">More operations using Newt<a class="headerlink" href="#more-operations-using-newt" title="Permanent link">¶</a></h3>
+<p>Once a target has been built, Newt allows additional operations on the target. </p>
+<ul>
+<li><strong>download</strong>: Download built target to board</li>
+<li><strong>debug</strong>: Open debugger session to target</li>
+<li><strong>size</strong>: Get size of target components</li>
+<li><strong>create-image</strong>: Add image header to the binary image</li>
+</ul>
+<p>For more details on how Newt works, go to <a href="../newt_operation/">Newt - Theory of Operations</a>.</p>
+<p><br></p>
+<h3 id="source-management-and-repositories">Source Management and Repositories<a class="headerlink" href="#source-management-and-repositories" title="Permanent link">¶</a></h3>
+<p>The other major element of the Newt tool is the ability to create reusable source distributions from a collection of code. <strong>A project can be a reusable container of source code.</strong> In other words, projects can be versioned and redistributed, not packages. A project bundles together packages that are typically needed to work together in a product e.g. RTOS core, filesystem APIs, and networking stack.</p>
+<p>A project that has been made redistributable is known as a <strong>repository</strong>.
+Repositories can be added to your local project by adding them into your project.yml file. Here is an example of the blinky project's yml file which relies on apache-mynewt-core:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ more project.yml
+<snip>
+project.repositories:
+ - apache-mynewt-core
+
+# Use github's distribution mechanism for core ASF libraries.
+# This provides mirroring automatically for us.
+#
+repository.apache-mynewt-core:
+ type: github
+ vers: 0-latest
+ user: apache
+ repo: incubator-mynewt-core
+</pre></div>
+
+
+<p><br></p>
+<p>When you specify this repository in the blinky's project file, you can then use the Newt tool to install dependencies:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ newt install
+Downloading repository description for apache-mynewt-core... success!
+Downloading repository incubator-mynewt-core (branch: develop) at
+https://github.com/apache/incubator-mynewt-core.git
+Cloning into
+'/var/folders/7l/7b3w9m4n2mg3sqmgw2q1b9p80000gn/T/newt-repo814721459'...
+remote: Counting objects: 17601, done.
+remote: Compressing objects: 100% (300/300), done.
+remote: Total 17601 (delta 142), reused 0 (delta 0), pack-reused 17284
+Receiving objects: 100% (17601/17601), 6.09 MiB | 3.17 MiB/s, done.
+Resolving deltas: 100% (10347/10347), done.
+Checking connectivity... done.
+Repos successfully installed
+</pre></div>
+
+
+<p><br></p>
+<p>Newt will install this repository in the <project>/repos directory. In the case of blinky, the directory structure ends up looking like:</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ tree -L 2
+.
+├── DISCLAIMER
+├── LICENSE
+├── NOTICE
+├── README.md
+├── apps
+│ └── blinky
+├── project.state
+├── project.yml
+├── repos
+│ └── apache-mynewt-core
+└── targets
+ ├── my_blinky_sim
+ └── unittest
+</pre></div>
+
+
+<p><br></p>
+<p>In order to reference the installed repositories in packages, the "@" notation should be specified in the repository specifier. As an example, the apps/blinky application has the following dependencies in its pkg.yml file. This tells the build system to look in the base directory of repos/apache-mynewt-core for the <code>libs/os</code>, <code>hw/hal</code>, and <code>libs/console/full</code> packages.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">$ more apps/blinky/pkg.yml
+<snip>
+pkg.deps:
+ - "@apache-mynewt-core/libs/os"
+ - "@apache-mynewt-core/hw/hal"
+ - "@apache-mynewt-core/libs/console/full"
+</pre></div>
+
+
+<p><br></p>
<div class="row">
@@ -355,9 +511,9 @@
<ul class="nav nav-pills" style="margin-bottom: 10px">
<li>
- <a href=../../network/ble/ble_intro/>
+ <a href=../../network/ble/ini_stack/ble_host_ini/>
<span class="fa fa-arrow-left"></span>
- Previous: BLE Stack
+ Previous: Initialize host
</a>
</li>