Repository: incubator-mynewt-site Updated Branches: refs/heads/master ea9e96af2 -> b08b7861b
cleaned up arduino zero tutorial 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/b08b7861 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/b08b7861 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/b08b7861 Branch: refs/heads/master Commit: b08b7861b907299b8f8438f9ff0c31ae8bd6e62f Parents: ea9e96a Author: aditihilbert <ad...@runtime.io> Authored: Thu Mar 24 15:51:30 2016 -0700 Committer: aditihilbert <ad...@runtime.io> Committed: Thu Mar 24 15:51:30 2016 -0700 ---------------------------------------------------------------------- docs/os/get_started/project_create.md | 28 ++++++++---- docs/os/tutorials/arduino_zero.md | 72 ++++++++++++++++++------------ docs/os/tutorials/bletiny_project.md | 4 +- 3 files changed, 64 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/b08b7861/docs/os/get_started/project_create.md ---------------------------------------------------------------------- diff --git a/docs/os/get_started/project_create.md b/docs/os/get_started/project_create.md index bb8d3b9..a2e3729 100644 --- a/docs/os/get_started/project_create.md +++ b/docs/os/get_started/project_create.md @@ -62,17 +62,16 @@ $ tree The Newt tool has installed the base files for a project comprising the following: -1. the file `project.yml` contains the repository list that the project uses to fetch +1. The file `project.yml` contains the repository list that the project uses to fetch its packages. Your project is a collection of repositories. In this case, the project just comprises the core mynewt repository. Later you will add more repositories to include other mynewt components. -2. the file `apps/blinky/pkg.yml` contains the description of your application +2. The file `apps/blinky/pkg.yml` contains the description of your application and its package dependencies. -3. A target directory containing `my_blinky_sim`, a target descriptor used to +3. A `target` directory containing `my_blinky_sim`, a target descriptor used to build a version of myproj. Use `newt target show` to see available build targets. -4. A non-buildable target called `unittest`. This is used -internally by `newt` and is not a formal build target. +4. A non-buildable target called `unittest`. This is used internally by `newt` and is not a formal build target. **NOTE:** the actual code and package files are not installed (except the template for `main.c`). See the next step for installing the packages. @@ -94,6 +93,7 @@ apache-mynewt-core **NOTE:** _apache-mynewt-core_ may take a while to download. To see progress, use the _-v_ (verbose) option to install. +<br> Once _newt install_ has successfully finished, the contents of _apache-mynewt-core_ will have been downloaded into your local directory. You can view them by issuing the following commands in the base directory of the new project: @@ -130,19 +130,29 @@ $ tree -L 2 repos/apache-mynewt-core/ ``` As you can see, the core of the Apache Mynewt operating system has been brought -into your local directory! +into your local directory. <br> ### Test the project's packages -Use the following command to execute a package's unit tests: +You have already built your first basic project. You can ask Newt to execute the unit tests in a package. For example, to test the shell package in the `apache-mynewt-core` repo, call newt as shown below. ``` -$ newt test <package-name> +$ newt test @apache-mynewt-core/libs/shell +Testing package @apache-mynewt-core/libs/shell +Compiling os.c +Compiling os_callout.c +Compiling os_eventq.c +Compiling os_heap.c +Compiling os_mbuf.c +Compiling os_mempool.c +<snip> ``` -To test all the packages in a project, specify `all` as the _<package-name\>_. +<br> + +To test all the packages in a project, specify `all` instead of the package name. ```no-highlight $ newt test all http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/b08b7861/docs/os/tutorials/arduino_zero.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/arduino_zero.md b/docs/os/tutorials/arduino_zero.md index 1d3a294..98a99cc 100644 --- a/docs/os/tutorials/arduino_zero.md +++ b/docs/os/tutorials/arduino_zero.md @@ -1,6 +1,6 @@ ## Running Mynewt on Arduino Zero -This tutorial describes how to run Mynewt OS on Arduino Zero. +This tutorial describes how to run Mynewt OS on Arduino Zero. Follow these simple steps and your board will be blinking in no time! ### Prerequisites @@ -17,34 +17,30 @@ compatible with this tutorial * A USB cable (Type A to micro B) that can connect the computer to the Arduino * The Mynewt Release -### Arduino Boards - -This tutorial has been tested on the following two Arduino Zero boards. +This tutorial has been tested on the following two Arduino Zero boards - Zero and Zero-Pro. <img src="https://www.arduino.cc/en/uploads/Main/Zero_Usb_Ports.jpg" alt="Drawing" style="width: 400px;"/> <img src="http://www.arduino.org//images/products/ArduinoZeroPro-flat-org.jpg" alt="Drawing" style="width: 330px;"/> -### Steps - -Follow these simple steps and your board will be blinking in no time! +### Install Mynewt and Newt -#### Install Mynewt and Newt +* If you have not already done so, install Newt as shown in the [Newt install tutorial](../../newt/install/newt_mac.md) +* If you have not already done so, create a project as shown in the Quick Start guide on how to [Create Your First Project](../get_started/project_create.md). Skip the testing and building the project steps in that tutorial since you will be defining a target for your Arduino board in this tutorial. -If you have not already done so, install Newt as shown in the [Newt install tutorial](../../newt/install/newt_mac.md) and cloned the Mynewt OS repository as shown in the [Get Started tutorial for Sim Blinky](../get_started/project_create.md) +<br> -### Fetch External Packages for Atmel SAMD21 +### Fetch External Packages Mynewt uses source code provided directly from the chip manufacturer for -low level operations. This code is licensed only for Atmel parts, and -cannot live in the Apache Mynewt repository. Fetch the package from -the runtime github repository. +low level operations. Sometimes this code is licensed only for the specific manufacturer of the chipset and cannot live in the Apache Mynewt repository. That happens to be the case for the Arduino Zero board which uses Atmel SAMD21. Runtime's github repository hosts such external third-party packages and the Newt tool can fetch them. -To fetch the package from the runtime git repository, you need to add -the repository to the ```project.yml``` file in your base project directory. +To fetch the package with MCU support for Atmel SAMD21 for Arduino Zero from the Runtime git repository, you need to add +the repository to the `project.yml` file in your base project directory. Here is an example ```project.yml``` file with the Arduino Zero repository -added. The lines to be added are highlighted. +added. The sections with ```mynewt_arduino_zero``` that need to be added to +your project file are highlighted. ```hl_lines="6 14 15 16 17 18" $ more project.yml @@ -68,8 +64,7 @@ repository.mynewt_arduino_zero: $ ``` -In the above, the sections with ```mynewt_arduino_zero``` need to be added to -your project file. +<br> Once you've edited your ```project.yml``` file, the next step is to install the project dependencies, this can be done with the ```newt install``` command @@ -82,7 +77,9 @@ mynewt_arduino_zero $ ``` -### Create your bootloader Target +<br> + +### Create your bootloader target Next, you need to tell Newt what to build. For the Arduino Zero, we are going to generate both a bootloader, and an image target. @@ -102,6 +99,8 @@ $ newt target set arduino_boot features=arduino_zero_pro Target targets/arduino_boot successfully set pkg.features to arduino_zero_pro ``` +<br> + These commands do a few things: * Create a target named ```arduino_boot```, in order to build the Arduino Zero Bootloader. @@ -117,8 +116,11 @@ These commands do a few things: the Arduino Zero. This is done through setting a build feature. If you are building for an Arduino Zero, and not a Zero Pro, this feature should be set to ```arduino_zero```. -Once you've configured the bootloader target, the next step is to build the bootloader for -your Arduino, you can do this by using the ```newt build``` command: +<br> + +### Build your bootloader + +Once you've configured the bootloader target, the next step is to build the bootloader for your Arduino. You can do this by using the ```newt build``` command: ```no-highlight $ newt build arduino_boot @@ -139,9 +141,11 @@ If this command finishes successfully, you have successfully built the Arduino bootloader, and the next step is to build your application for the Arduino board. -To create and download your application, you create another target, this one pointing -to the application you want to download to the Arduino board. In this tutorial, -we will use the default application that comes with your project, ```apps/blinky```: +<br> + +### Build your blinky app + +To create and download your application, you create another target, this one pointing to the application you want to download to the Arduino board. In this tutorial, we will use the default application that comes with your project, ```apps/blinky```: ```no-highlight $ newt target create arduino_blinky @@ -157,6 +161,8 @@ Target targets/arduino_blinky successfully set pkg.features to arduino_zero_pro $ ``` +<br> + You can now build the target, with ```newt build```: ```no-highlight @@ -174,8 +180,10 @@ Archiving testutil.a App successfully built: myproject/bin/arduino_blinky/apps/blinky/blinky.elf ``` -Congratulations! You have successfully built your application, now it's -time to load the bootloader and application onto the target. +Congratulations! You have successfully built your application. Now it's +time to load both the bootloader and application onto the target. + +<br> ### Connect the Target @@ -192,6 +200,8 @@ A image below shows the Arduino Zero Programming Port. <img src="https://www.arduino.cc/en/uploads/Main/Zero_Usb_Ports.jpg" alt="Drawing" style="width: 400px;"/> <img src="http://www.arduino.org//images/products/ArduinoZeroPro-flat-org.jpg" alt="Drawing" style="width: 330px;"/> +<br> + ### Download the Bootloader Execute the command to download the bootloader. @@ -203,6 +213,7 @@ Execute the command to download the bootloader. If the newt tool finishes without error, that means the bootloader has been successfully loaded onto the target. +<br> ### Run the Image @@ -261,13 +272,16 @@ The "remote" target does not support "run". Try "help target" or "continue". Continuing. ``` -*NOTE:* The 0.0.0 specified after the target name to newt run, is the version +<br> + +**NOTE:** The 0.0.0 specified after the target name to `newt run` is the version of the image to load. If you are not providing remote upgrade, and are just developing locally, you can provide 0.0.0 for every image version. If you want the image to run without the debugger connected, simply quit the -debugger and restart the board. The image you programmed will come and run on the -Arduino on next boot! +debugger and restart the board. The image you programmed will come and run on the Arduino on next boot! + +<br> ### Watch the LED blink http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/b08b7861/docs/os/tutorials/bletiny_project.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/bletiny_project.md b/docs/os/tutorials/bletiny_project.md index 084ea17..fd950cf 100644 --- a/docs/os/tutorials/bletiny_project.md +++ b/docs/os/tutorials/bletiny_project.md @@ -1,5 +1,5 @@ -## NimBLE project +## Create a project -This tutorial explains how to start BLE 4.2 on a board and start seeing some BLE related statistics. +This tutorial explains how to create a BLE 4.2 on a board and start seeing some BLE related statistics.