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/11/28 21:19:13 UTC

[03/10] incubator-mynewt-site git commit: Added shell tutorial

Added shell 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/0862fea9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/0862fea9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/0862fea9

Branch: refs/heads/master
Commit: 0862fea9972fb2e0f09f4251d54a84fe8dcb47ab
Parents: 7c242c3
Author: David G. Simmons <sa...@mac.com>
Authored: Tue Nov 22 09:32:54 2016 -0500
Committer: aditihilbert <ad...@runtime.io>
Committed: Mon Nov 28 10:52:03 2016 -0800

----------------------------------------------------------------------
 docs/os/tutorials/add_newtmgr.md |   2 +-
 docs/os/tutorials/add_shell.md   | 140 ++++++++++++++++++++++++++++++++++
 mkdocs.yml                       |   4 +-
 3 files changed, 144 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0862fea9/docs/os/tutorials/add_newtmgr.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/add_newtmgr.md b/docs/os/tutorials/add_newtmgr.md
index 24f7483..2c5fe85 100644
--- a/docs/os/tutorials/add_newtmgr.md
+++ b/docs/os/tutorials/add_newtmgr.md
@@ -110,7 +110,7 @@ $ newt load myble
 
 ### Set up newtmgr connection
 
-Newtmgr reqwiures a connection profile in order to connect to your board. If you haven't yet, follow the [instructions](../../newtmgr/overview.md) for setting up your connection profile.
+Newtmgr requires a connection profile in order to connect to your board. If you haven't yet, follow the [instructions](../../newtmgr/overview.md) for setting up your connection profile.
 
 <br>
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0862fea9/docs/os/tutorials/add_shell.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/add_shell.md b/docs/os/tutorials/add_shell.md
new file mode 100644
index 0000000..a5b0e91
--- /dev/null
+++ b/docs/os/tutorials/add_shell.md
@@ -0,0 +1,140 @@
+##Enabling The Console and Shell in a project
+
+<br>
+
+This tutorial explains how to add the Console and Shell task to a project so that you 
+can interact with your project over a serial line connection.
+
+<br>
+
+### Pre-Requisites
+
+* Ensure you have installed [newt](../../newt/install/newt_mac.md) and that the 
+newt command is in your system path. 
+* You must have Internet connectivity to fetch remote Mynewt components.
+* You must [install the compiler tools](../get_started/native_tools.md) to 
+support native compiling to build the project this tutorial creates.  
+* You must install the [Segger JLINK package]( https://www.segger.com/jlink-software.html) to 
+load your project on the board.
+* Cable to establish a serial USB connection between the board and the laptop
+
+<br>
+
+### Use an existing project
+
+Since all we're doing is adding the shell and console capability to a project, we assume 
+that you have worked through at least some of the other tutorials, and have an existing project.
+For this example, we'll be modifying the [ble_tiny](bletiny_project.md) project to enable 
+the shell and console connectivity. We'll be calling our app myble as in that project as well. 
+Feel free to use whatever project you'd like though.
+
+<br>
+
+###Modify the Dependencies and Configuration
+
+The first thing you'll need to add is a few new dependencies for your app. To add shell support to 
+your app make sure the following `pkg.deps` are defined in your target's pkg.yml file:
+
+```
+pkg.deps:
+    - "@apache-mynewt-core/sys/console/full"
+    - "@apache-mynewt-core/sys/shell"
+    - "@apache-mynewt-core/sys/sysinit"
+```
+
+This lets the newt system know that it needs to pull in the code for the console and the shell.
+
+Now we'll need to modify the settings for the app to turn on the shell, etc. by modifying the
+`syscfg.yml` file for your target. (Remember, these files are in the targets/<app-name> directory.)
+If there isn't a `syscfg.yml` file in your target's directory, you will need to create one.
+
+```no-highlight
+# Package: apps/bletiny
+
+syscfg.vals:
+    # Enable the shell task.
+    SHELL_TASK: 1
+    # Enable Console OS Ticks
+    CONSOLE_TICKS: 1
+    # Enable Console Prompt
+    CONSOLE_PROMPT: 1 
+```
+
+### Build targets
+
+We're not going to build the bootloader here since we are assuming that you have already
+built and loaded it during previous tutorials.
+
+```no-highlight
+$ newt build myble
+Archiving cbmem.a
+Compiling crc16.c
+Compiling crc8.c
+Archiving crc.a
+Compiling mem.c
+Archiving mem.a
+Linking ~/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny.elf
+Target successfully built: targets/myble
+```
+
+<br>
+
+### Create the app image
+
+Generate a signed application image for the `myble` target. The version number is arbitrary.
+
+```
+$ newt create-image myble 1.0.0
+App image succesfully generated: ~/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny.img
+```
+
+<br>
+
+### Load the image
+
+Make sure the USB connector is in place and the power LED on the board is lit. Use the Power ON/OFF switch to reset the board after loading the image.
+
+```
+$ newt load myble
+```
+
+<br>
+
+### Set up Serial connection
+
+You'll need a Serial connection to see the output of your program. You can see the instructions in the [Tasks and Priority Management](tasks_lesson.md) 
+Tutorial for more information on setting up your serial communications.
+
+<br>
+
+###Connecting with your app
+
+Once you have a connection set up, you can connect to your device with ```minicom -D /dev/tty.usbmodem<port> -b 115200``` to run connect
+to the console of your app. 
+    
+To test and make sure that the Shell is running, first just hit <return>:
+    
+```no-highlight
+3534: >
+```
+
+Remember, we turned the CONSOLE_PROMPT and the CONSOLE_TICKS on earlier. You can try some commands now:
+
+```no-highlight
+3609: > ?
+Commands:
+8841:     echo         ?    prompt     ticks     tasks  mempools
+8843:     date         b
+8844: > ticks off
+ Console Ticks off
+ > prompt off
+ Prompt now off.
+ticks on
+33383: Console Ticks on
+
+33568:
+prompt on
+39108: Prompt now on.
+39108: >
+```
+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0862fea9/mkdocs.yml
----------------------------------------------------------------------
diff --git a/mkdocs.yml b/mkdocs.yml
index d21ee59..cd5d6d4 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -42,6 +42,8 @@ pages:
             - toc: 'os/tutorials/repo/add_repos.md'
             - 'Upgrade a Repo': 'os/tutorials/repo/upgrade_repo.md'
             - 'Turn project into a Repo': 'os/tutorials/repo/create_repo.md'
+        - 'Tasks and Priority Management': 'os/tutorials/tasks_lesson.md'
+        - 'Enable Wi-Fi on Arduino Zero': 'os/tutorials/wi-fi_on_arduino.md'
         - 'Write a Test Suite for a Package': 'os/tutorials/unit_test.md'
         - 'Air-quality Sensor project': 'os/tutorials/air_quality_sensor.md'
         - 'Add task to manage multiple events': 'os/tutorials/event_queue.md'
@@ -49,7 +51,7 @@ pages:
 	    - 'Slinky on sim device': 'os/tutorials/project-slinky.md'
             - 'Slinky on STM32 board': 'os/tutorials/project-target-slinky.md'
         - 'Enable newtmgr in any app': 'os/tutorials/add_newtmgr.md' 
- +      - 'Enable the OS Shell and Console': 'os/tutorials/add_shell.md'
+        - 'Enable the OS Shell and Console': 'os/tutorials/add_shell.md'
         - 'BLE app to check stats via console': 'os/tutorials/bletiny_project.md'
         - 'BLE peripheral project':
             - toc: 'os/tutorials/bleprph/bleprph-intro.md'