Repository: incubator-mynewt-site Updated Branches: refs/heads/asf-site 477d85dcd -> 2af796a3e
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/2af796a3/newtmgr/project-slinky/index.html ---------------------------------------------------------------------- diff --git a/newtmgr/project-slinky/index.html b/newtmgr/project-slinky/index.html index 6a5d714..8f0a5a2 100644 --- a/newtmgr/project-slinky/index.html +++ b/newtmgr/project-slinky/index.html @@ -9,7 +9,7 @@ <link rel="canonical" href="http://mynewt.apache.org/newtmgr/project-slinky/"> <link rel="shortcut icon" href="../../img/favicon.ico"> - <title>Project Slinky - Apache Mynewt</title> + <title>Sim Slinky - 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="Project Slinky"> + <body class="Sim Slinky"> <div id="navbar" class="navbar navbar-default navbar-fixed-top" role="navigation"> @@ -226,6 +226,16 @@ + <li> + <a href="../installing/">Installing</a> + </li> + + + + + + + <li><a href=" ./ @@ -238,7 +248,17 @@ <li class="active"> - Project Slinky + Sim Slinky + </li> + + + + + + + + <li> + <a href="../project-target-slinky/">Target Slinky</a> </li> @@ -340,7 +360,7 @@ - <li>» Project Slinky</li> + <li>» Sim Slinky</li> @@ -349,251 +369,119 @@ </div> </div> - <h2 id="project-slinky">Project Slinky<a class="headerlink" href="#project-slinky" title="Permanent link">¶</a></h2> + <h2 id="project-sim-slinky">Project Sim Slinky<a class="headerlink" href="#project-sim-slinky" title="Permanent link">¶</a></h2> <h3 id="objective">Objective<a class="headerlink" href="#objective" title="Permanent link">¶</a></h3> -<p>The goal of the project is to enable and demonstate remote communications with a device or target via newt manager (newtmgr). We will first build the project image for a simulated device and then build an image for a hardware target. Next, the tool newtmgr has to be installed and a connection established with the target. Finally, various available commands in newtmgr will be used to query the target, upgrade image, and collect data from the endpoint.</p> +<p>The goal of the project is to enable and demonstrate remote communications with the Mynewt OS via newt manager (newtmgr). We will do this through building a project with Mynewt called Slinky that runs via the native platform. </p> <h3 id="what-you-need">What you need<a class="headerlink" href="#what-you-need" title="Permanent link">¶</a></h3> -<ol> -<li>STM32-E407 development board from Olimex. You can order it from <a href="http://www.mouser.com/ProductDetail/Olimex-Ltd/STM32-E407/?qs=UN6GZl1KCcit6Ye0xmPO4A%3D%3D">http://www.mouser.com</a>, <a href="http://www.digikey.com/product-detail/en/STM32-E407/1188-1093-ND/3726951">http://www.digikey.com</a>, and other places.</li> -<li>ARM-USB-TINY-H connector with JTAG interface for debugging ARM microcontrollers (comes with the ribbon cable to hook up to the board)</li> -<li>USB A-B type cable to connect the debugger to your personal computer</li> -<li>A USB to TTL Serial Cable with female wiring harness. An example is <a href="http://www.amazon.com/JBtek®-WINDOWS-Supported-Raspberry-Programming/dp/B00QT7LQ88/ref=lp_464404_1_9?s=pc&ie=UTF8&qid=1454631303&sr=1-9">http://www.amazon.com/JBtek®-WINDOWS-Supported-Raspberry-Programming/dp/B00QT7LQ88/ref=lp_464404_1_9?s=pc&ie=UTF8&qid=1454631303&sr=1-9</a></li> -<li>Personal Computer</li> -</ol> +<p>1.Personal Computer</p> <p>The instructions assume the user is using a Bourne-compatible shell (e.g. bash or zsh) on your computer. The given instructions have been tested with the following releases of operating systems:</p> <ul> <li>Mac: OS X Yosemite Version 10.10.5</li> </ul> <h3 id="overview-of-steps">Overview of steps<a class="headerlink" href="#overview-of-steps" title="Permanent link">¶</a></h3> <ul> -<li>Define targets using the newt tool</li> +<li>Install dependencies</li> +<li>Define a target using the newt tool</li> <li>Build executables for the targets using the newt tool</li> -<li>Set up serial connection with the targets - both the physical connection with a hardware target and the connection profile using the newtmgr tool</li> +<li>Set up serial connection with the targets </li> +<li>Create a connection profile using the newtmgr tool</li> <li>Use the newtmgr tool to communicate with the targets</li> </ul> -<p>The following instructions will walk you through the update of the larva nest and the installation of newtmgr as well.</p> -<h3 id="creating-local-repository">Creating local repository<a class="headerlink" href="#creating-local-repository" title="Permanent link">¶</a></h3> -<p>Make sure Mynewt's default nest <code>larva</code> is up to date by downloading the latest from the Apache mynewt repository (<a href="https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva">https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva</a>).</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ pwd - /Users/<user>/dev/larva - $ ls -al - total 72 - drwxr-xr-x 18 <user> staff 612 Feb 3 15:47 . - drwxr-xr-x 5 <user> staff 170 Feb 3 13:32 .. - drwxr-xr-x 13 <user> staff 442 Feb 3 13:32 .git - -rw-r--r-- 1 <user> staff 66 Feb 3 13:32 .gitignore - -rw-r--r-- 1 <user> staff 0 Feb 3 13:32 .gitmodules - drwxr-xr-x 4 <user> staff 136 Feb 3 16:13 .nest - -rw-r--r-- 1 <user> staff 11358 Feb 3 13:32 LICENSE - ... - ... - drwxr-xr-x 5 <user> staff 170 Feb 3 13:32 sys - $ git pull origin master -</pre></div> - - -<h3 id="installing-newtmgr">Installing Newtmgr<a class="headerlink" href="#installing-newtmgr" title="Permanent link">¶</a></h3> -<p>You will first download the source code for newt. Currently, you need to create a symbolic link for all the directory references in the go scripts to work correctly.</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev - $ go get git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt - $ ln -s ~/dev/go/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git ~/dev/go/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt - - $ pwd - /Users/<user>/dev/go - $ ls - bin pkg src - $ cd src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/newt - $ ls - newt newtmgr newtvm util - $ cd newtmgr - $ go build - $ +<h3 id="installing-newt">Installing newt<a class="headerlink" href="#installing-newt" title="Permanent link">¶</a></h3> +<p>If you have not already installed <code>newt</code> see the +<a href="../../newt/tutorials/newt_mac/">newt installation instructions</a> and ensure newt is installed an in your path.</p> +<h3 id="installing-newtmgr">Installing newtmgr<a class="headerlink" href="#installing-newtmgr" title="Permanent link">¶</a></h3> +<p>If you have not already installed <code>newtmgr</code> see the +<a href="../installing/">newtmgr installation instructions</a> and ensure newtmgr is installed an in your path.</p> +<h3 id="creating-a-new-project">Creating a new project<a class="headerlink" href="#creating-a-new-project" title="Permanent link">¶</a></h3> +<p>Instructions for creating a project are located in the <a href="../../os/get_started/project_create/">Getting Started</a> section of the <a href="../../os/get_started/introduction/">Mynewt OS Manual</a></p> +<p>We will list only the steps here for brevity. We will name the project +<code>slinky</code>.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt new slinky + Downloading project skeleton from apache/incubator-mynewt-blinky... + ... + Installing skeleton in slink... + Project slink successfully created + $ cd slinky + $ newt install -v + Downloading repository description for apache-mynewt-core... success! + ... + Repos successfully installed </pre></div> -<p>Note: If the <code>go build</code> command results in errors indicating some package cannot be found, do a <code>go get</code> to download all the third-party files needed from github.com and then run <code>go build</code> again. </p> -<h3 id="building-targets">Building Targets<a class="headerlink" href="#building-targets" title="Permanent link">¶</a></h3> -<p>You will create a total of 4 targets. The first one is a simulation target and the second a hardware target (for STM32-E407 Olimex development board). In order to run an image from the flash on the Olimex board, a bootloader is required. You will build two additional targets (bootloader and bin2img) as explained in Project Blinky under <a href="../../get_started/project1/#using-flash-to-make-led-blink">Using flash to make LED blink</a> and as shown below.</p> -<p>Here;'s how to create the target for simulation.</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target create slinky_sim - Creating target slinky_sim - Target slinky_sim sucessfully created! - $ newt target set slinky_sim arch=sim - Target slinky_sim successfully set arch to sim - $ newt target set slinky_sim compiler=sim - Target slinky_sim successfully set compiler to sim - $ newt target set slinky_sim project=slinky - Target slinky_sim successfully set project to slinky - $ newt target set slinky_sim compiler_def=debug - Target slinky_sim successfully set compiler_def to debug - $ newt target set slinky_sim bsp=hw/bsp/native - Target slinky_sim successfully set bsp to hw/bsp/native - $ newt target show slinky_sim - slinky_sim - arch: sim - bsp: hw/bsp/native - compiler: sim - compiler_def: debug - name: slinky_sim - project: slinky +<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 +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 + $ newt target set sim_slinky bsp=@apache-mynewt-core/hw/bsp/native + $ newt target set sim_slinky build_profile=debug + $ newt target set sim_slinky app=@apache-mynewt-core/apps/slinky </pre></div> -<p>Repeat the above steps using the attribute information for each target from the target output shown below to create the remaining three targets. The four target definitions are:</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target show - bin2img - arch: sim - bsp: hw/bsp/native - compiler: sim - compiler_def: debug - name: bin2img - project: bin2img - boot_olimex - arch: cortex_m4 - bsp: hw/bsp/olimex_stm32-e407_devboard - compiler: arm-none-eabi-m4 - compiler_def: optimized - name: boot_olimex - project: boot - slinky1 - arch: cortex_m4 - bsp: hw/bsp/olimex_stm32-e407_devboard - compiler: arm-none-eabi-m4 - compiler_def: debug - name: slinky1 - project: slinky - slinky_sim - arch: sim - bsp: hw/bsp/native - compiler: sim - compiler_def: debug - name: slinky_sim - project: slinky +<h3 id="building-your-target">Building Your target<a class="headerlink" href="#building-your-target" title="Permanent link">¶</a></h3> +<p>To build your target, use <code>newt build</code>. When complete, an executable file +is created.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt build sim_slinky + Compiling main.c + ... + Linking slinky.elf + App successfully built: ~/dev/slinky/bin/sim_slinky/apps/slinky/slinky.elf </pre></div> -<p>Go ahead and build all the targets. The build command for slinky_sim is shown below.</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target build slinky_sim - Building target slinky_sim (project = slinky) - Compiling base64.c - Compiling cbmem.c - ... - Archiving libnative.a - Compiling main.c - Building project slinky - Linking slinky.elf - Successfully run! +<h3 id="run-the-target">Run the target<a class="headerlink" href="#run-the-target" title="Permanent link">¶</a></h3> +<p>Run the executable you have build for the simulated environment. The serial port name on which the simulated target is connected is shown in the output +when mynewt slinky starts.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ ~/dev/slinky/bin/sim_slinky/apps/slinky/slinky.elf + uart0 at /dev/ttys005 </pre></div> -<p>Now run the <code>newt target build</code> command for the remaining three targets.</p> -<h3 id="using-newtmgr-with-a-sim-target">Using newtmgr with a sim target<a class="headerlink" href="#using-newtmgr-with-a-sim-target" title="Permanent link">¶</a></h3> -<ul> -<li>Run the executable you have build for the simulated environment. The serial port name on which the simulated target is connected is shown in the output.</li> -</ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ pwd - /Users/<user>/dev/larva/project/slinky - $ ./bin/slinky_sim/slinky.elf - uart0 at /dev/ttys007 +<p><br></p> +<p>In this example, the slinky app opened up a com port <code>/dev/ttys005</code> +for communications with newtmgr. </p> +<p><strong>NOTE:</strong> This application will block. You will need to open a new console (or execute this in another console) to continue the tutorial.*</p> +<p><br></p> +<h3 id="setting-up-a-connection-profile">Setting up a connection profile<a class="headerlink" href="#setting-up-a-connection-profile" title="Permanent link">¶</a></h3> +<p>You will now set up a connection profile using <code>newtmgr</code> for the serial port connection and start communicating with the simulated remote device.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newtmgr conn add sim1 type=serial connstring=/dev/ttys005 + Connection profile sim1 successfully added + $ newtmgr conn show + Connection profiles: + sim1: type=serial, connstring='/dev/ttys007' </pre></div> -<ul> -<li>You will now set up a connection profile using <code>newtmgr</code> for the serial port connection and start communicating with the simulated remote device.</li> -</ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newtmgr conn add sim1 type=serial connstring=/dev/ttys007 - Connection profile sim1 successfully added - $ newtmgr conn show - Connection profiles: - sim1: type=serial, connstring='/dev/ttys007' - $ newtmgr -c sim1 taskstats - Return Code = 0 - uart_poller (prio=0 tid=3 runtime=0 cswcnt=43810 stksize=1024 stkusage=325 last_checkin=0 next_checkin=0) - newtmgr (prio=4 tid=4 runtime=0 cswcnt=6 stksize=1024 stkusage=585 last_checkin=0 next_checkin=0) - task1 (prio=1 tid=5 runtime=0 cswcnt=551 stksize=1024 stkusage=83 last_checkin=0 next_checkin=0) - task2 (prio=2 tid=6 runtime=0 cswcnt=551 stksize=1024 stkusage=85 last_checkin=0 next_checkin=0) - idle (prio=255 tid=0 runtime=552525 cswcnt=44005 stksize=1024 stkusage=529 last_checkin=0 next_checkin=0) - os_sanity (prio=254 tid=1 runtime=0 cswcnt=551 stksize=1024 stkusage=82 last_checkin=0 next_checkin=0) - shell (prio=3 tid=2 runtime=0 cswcnt=20 stksize=1024 stkusage=142 last_checkin=0 next_checkin=0) - $ newtmgr -c sim1 stat stat - Return Code = 0 - Stats Name: stat - s0: 1 +<h3 id="executing-newtmgr-commands-with-the-target">Executing newtmgr commands with the target<a class="headerlink" href="#executing-newtmgr-commands-with-the-target" title="Permanent link">¶</a></h3> +<p>You can now use connection profile <code>sim1</code> to talk to the running sim_blinky. +As an example, we will query the running mynewt OS for the usage of its +memory pools. </p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newtmgr -c sim1 mpstats + Return Code = 0 + nffs_cache_inode_pool (blksize=36 nblocks=4 nfree=4) + nffs_cache_block_pool (blksize=32 nblocks=64 nfree=64) + nffs_dir_pool (blksize=8 nblocks=4 nfree=4) + default_mbuf_data (blksize=256 nblocks=10 nfree=8) + nffs_file_pool (blksize=12 nblocks=4 nfree=4) + nffs_inode_entry_pool (blksize=24 nblocks=100 nfree=98) + nffs_block_entry_pool (blksize=12 nblocks=100 nfree=100) </pre></div> -<h3 id="using-newtmgr-with-a-remote-target">Using newtmgr with a remote target<a class="headerlink" href="#using-newtmgr-with-a-remote-target" title="Permanent link">¶</a></h3> -<ul> -<li> -<p>First make sure the USB A-B type cable is connected to the ARM-USB-TINY-H debugger connector on the Olimex board. </p> -<p>Next go the to project directory and download the slinky project image to the flash of the Olimex board. You will see the executables in the <code>slinky1</code> directory created for the Olimex target to run the slinky project.</p> -</li> -</ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ pwd - /Users/<user>/dev/larva/project/slinky - $ ls - bin egg.yml slinky.yml src - $ ls bin - slinky1 slinky_sim - $ ls bin/slinky1 - slinky.elf slinky.elf.bin slinky.elf.cmd slinky.elf.img slinky.elf.lst slinky.elf.map - $ newt target download boot_olimex - Downloading with /Users/<user>/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh - $ newt target download slinky1 - Downloading with /Users/<user>/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh +<p>As a test command, you can send an arbitrary string to the target and it +will echo that string back in a response to newtmgr.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newtmgr -c sim1 echo "Hello Mynewt" + {"r": "Hello Mynewt"} </pre></div> -<p>You can now disconnect the debugging cable from the board. You should see the green LED blinking. If not, try powercycling the board.</p> -<ul> -<li> -<p>Now you have to set up the serial connection from your computer to the Olimex board. Locate the PC6/USART6_TX (pin#3), PC7/USART6_RX (pin#4), and GND (pin#2) of the UEXT connector on the Olimex board. More information on the UEXT connector can be found at <a href="https://www.olimex.com/Products/Modules/UEXT/">https://www.olimex.com/Products/Modules/UEXT/</a>. The schematic of the board can be found at <a href="https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407_sch.pdf">https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407_sch.pdf</a> for reference.</p> -<p><img alt="Alt Layout - Serial Connection" src="../pics/serial_conn.png" /></p> -<ul> -<li>Connect the female RX pin of the USB-TTL serial cable to the TX of the UEXT connector on the board. </li> -<li>Connect the female TX pin of the USB-TTL serial cable to the RX of the UEXT connector on the board. </li> -<li>Connect the GND pin of the USB-TTL serial cable to the GND of the UEXT connector on the board.</li> -</ul> -</li> -<li> -<p>Locate the serial connection established in the /dev directory of your computer. It should be of the type <code>tty.usbserial-<some identifier></code>.</p> -</li> -</ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ ls /dev/tty.usbserial-AJ03HAQQ - /dev/tty.usbserial-AJ03HAQQ -</pre></div> - - -<ul> -<li>You now have to define a connection profile using newtmgr. You can give it any name you want. The example below shows the connection profile being named as the very imaginative <code>olimex01</code>.</li> -</ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ pwd - /Users/<user>/dev/larva/project/slinky - $ newtmgr conn add olimex01 type=serial connstring=/dev/tty.usbserial-AJ03HAQQ - Connection profile olimex01 successfully added - $ newtmgr conn show - Connection profiles: - sim1: type=serial, connstring='/dev/ttys007' - olimex01: type=serial, connstring='/dev/tty.usbserial-AJ03HAQQ' -</pre></div> - - -<ul> -<li>Now go ahead and query the Olimex board to get responses back. The simplest command is the <code>echo</code> command to ask it to respond with the text you send it. </li> -</ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newtmgr echo -c olimex01 hello - {"r": "hello"} - $ newtmgr image -c olimex01 list - Images: - 0 : 11.22.33.44 - $ newtmgr -c olimex01 taskstats - Return Code = 0 - shell (prio=3 tid=1 runtime=0 cswcnt=5 stksize=1024 stkusage=60 last_checkin=0 next_checkin=0) - newtmgr (prio=4 tid=2 runtime=0 cswcnt=4 stksize=1024 stkusage=256 last_checkin=0 next_checkin=0) - task1 (prio=1 tid=3 runtime=0 cswcnt=23 stksize=1024 stkusage=32 last_checkin=0 next_checkin=0) - task2 (prio=2 tid=4 runtime=0 cswcnt=24 stksize=1024 stkusage=33 last_checkin=0 next_checkin=0) - idle (prio=255 tid=0 runtime=23121 cswcnt=26 stksize=32 stkusage=16 last_checkin=0 next_checkin=0) -</pre></div> +<p>The response comes back as a json string.</p> +<p>In addition to these, you can also examine running tasks, statistics, +logs, image status (not on sim), and configuration.</p> <div class="row"> <footer> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/2af796a3/newtmgr/project-target-slinky/index.html ---------------------------------------------------------------------- diff --git a/newtmgr/project-target-slinky/index.html b/newtmgr/project-target-slinky/index.html new file mode 100644 index 0000000..5e19516 --- /dev/null +++ b/newtmgr/project-target-slinky/index.html @@ -0,0 +1,576 @@ +<!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/newtmgr/project-target-slinky/"> + <link rel="shortcut icon" href="../../img/favicon.ico"> + + <title>Target Slinky - 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="Target Slinky"> + + + <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 > + <a href="../../newt/newt_intro/"> + Newt Tool Manual + </a> + </li> + + + + <li class="active"> + <a href="../overview/"> + Newt Manager Manual + </a> + </li> + + + + <li > + <a href="../../faq/answers/"> + 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/newt_intro/ +">Newt Tool Manual</a> + + + </li> + + + + + + + + <li><a href=" + ../overview/ +">Newt Manager Manual</a> + + + <ul class="current-toc"> + + + + + <li> + <a href="../overview/">Introduction</a> + </li> + + + + + + + + <li> + <a href="../installing/">Installing</a> + </li> + + + + + + + + + <li><a href=" + ../project-slinky/ +">Tutorials</a> + + + <ul class="current-toc"> + + + + + <li> + <a href="../project-slinky/">Sim Slinky</a> + </li> + + + + + + + + <li class="active"> + Target Slinky + </li> + + + + + </ul> + + </li> + + + + + + + + <li><a href=" + ../protocol/ +">Manual</a> + + + </li> + + + + </ul> + + </li> + + + + + + + + <li><a href=" + ../../faq/answers/ +">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 role="presentation"><a href="../../newt/newt_intro/">Newt Tool</a></li> + + + + <li class="active" role="presentation"><a href="../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="../overview/">Newt Manager Manual</a></li> + + + + <li>» <a href="../project-slinky/">Tutorials</a></li> + + + + <li>» Target Slinky</li> + + + + </ul> +</div> + </div> + </div> + + <h2 id="project-slinky">Project Slinky<a class="headerlink" href="#project-slinky" title="Permanent link">¶</a></h2> +<h3 id="objective">Objective<a class="headerlink" href="#objective" title="Permanent link">¶</a></h3> +<p>The goal of the project is to enable and demonstrate remote communications with the Mynewt OS via newt manager (newtmgr). We will do this through a project with Mynewt called Slinky that runs on the STM32-E407 board.</p> +<h3 id="what-you-need">What you need<a class="headerlink" href="#what-you-need" title="Permanent link">¶</a></h3> +<ol> +<li>STM32-E407 development board from Olimex. You can order it from <a href="http://www.mouser.com/ProductDetail/Olimex-Ltd/STM32-E407/?qs=UN6GZl1KCcit6Ye0xmPO4A%3D%3D">http://www.mouser.com</a>, <a href="http://www.digikey.com/product-detail/en/STM32-E407/1188-1093-ND/3726951">http://www.digikey.com</a>, and other places.</li> +<li>ARM-USB-TINY-H connector with JTAG interface for debugging ARM microcontrollers (comes with the ribbon cable to hook up to the board)</li> +<li>USB A-B type cable to connect the debugger to your personal computer</li> +<li>A USB to TTL Serial Cable with female wiring harness. An example is <a href="http://www.amazon.com/JBtek®-WINDOWS-Supported-Raspberry-Programming/dp/B00QT7LQ88/ref=lp_464404_1_9?s=pc&ie=UTF8&qid=1454631303&sr=1-9">http://www.amazon.com/JBtek®-WINDOWS-Supported-Raspberry-Programming/dp/B00QT7LQ88/ref=lp_464404_1_9?s=pc&ie=UTF8&qid=1454631303&sr=1-9</a></li> +<li>Personal Computer</li> +</ol> +<p>The instructions assume the user is using a Bourne-compatible shell (e.g. bash or zsh) on your computer. The given instructions have been tested with the following releases of operating systems:</p> +<ul> +<li>Mac: OS X Yosemite Version 10.10.5</li> +</ul> +<h3 id="overview-of-steps">Overview of steps<a class="headerlink" href="#overview-of-steps" title="Permanent link">¶</a></h3> +<ul> +<li>Install dependencies</li> +<li>Define a target using the newt tool</li> +<li>Build executables for the targets using the newt tool</li> +<li>Set up serial connection with the targets </li> +<li>Create a connection profile using the newtmgr tool</li> +<li>Use the newtmgr tool to communicate with the targets</li> +</ul> +<h3 id="install-newt">Install newt<a class="headerlink" href="#install-newt" title="Permanent link">¶</a></h3> +<p>If you have not already installed <code>newt</code>, see the +<a href="../../newt/tutorials/newt_mac/">newt installation instructions</a> and ensure newt is installed an in your path.</p> +<h3 id="install-newtmgr">Install newtmgr<a class="headerlink" href="#install-newtmgr" title="Permanent link">¶</a></h3> +<p>If you have not already installed <code>newtmgr</code>, see the +<a href="../installing/">newtmgr installation instructions</a> and ensure newtmgr is installed an in your path.</p> +<h3 id="create-a-new-project">Create a new project<a class="headerlink" href="#create-a-new-project" title="Permanent link">¶</a></h3> +<p>Instructions for creating a project are located in the <a href="../../os/get_started/project_create/">Getting Started</a> section of the <a href="../../os/get_started/introduction/">Mynewt OS Manual</a>.</p> +<p>If you already completed <a href="../project-slinky/">sim slinky</a> you can skip this step.</p> +<p>We will list only the steps here for brevity. We will name the project +<code>slinky</code>.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #000000">$ </span>newt new slinky +Downloading project skeleton from apache/incubator-mynewt-blinky... +... +Installing skeleton in slink... +Project slink successfully created +<span style="color: #000000">$ </span><span style="color: #A90D91">cd </span>slinky +<span style="color: #000000">$newt</span> install -v +Downloading repository description <span style="color: #A90D91">for</span> apache-mynewt-core... success! +... +Repos successfully installed +</pre></div> + + +<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 +description. The tool output is suppressed below for brevity.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #000000">$ </span>newt target create stm32_slinky +<span style="color: #000000">$ </span>newt target <span style="color: #A90D91">set </span>stm32_slinky <span style="color: #000000">bsp=</span>@apache-mynewt-core/hw/bsp/olimex_stm32-e407_devboard +<span style="color: #000000">$ </span>newt target <span style="color: #A90D91">set </span>stm32_slinky <span style="color: #000000">build_profile=</span>debug +<span style="color: #000000">$ </span>newt target <span style="color: #A90D91">set </span>stm32_slinky <span style="color: #000000">app=</span>@apache-mynewt-core/apps/slinky +</pre></div> + + +<p>Create a second target for <code>stm32_bootloader</code> to build a bootloader to boot +the <code>stm32_slinky</code> image. The tool output is suppressed below for brevity.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #000000">$ </span>newt target create stm32_bootloader +<span style="color: #000000">$ </span>newt target <span style="color: #A90D91">set </span>stm32_bootloader <span style="color: #000000">bsp=</span>@apache-mynewt-core/hw/bsp/olimex_stm32-e407_devboard +<span style="color: #000000">$ </span>newt target <span style="color: #A90D91">set </span>stm32_bootloader <span style="color: #000000">build_profile=</span>optimized +<span style="color: #000000">$ </span>newt target <span style="color: #A90D91">set </span>stm32_bootloader target.app<span style="color: #000000">=</span>@apache-mynewt-core/apps/boot +</pre></div> + + +<p><br></p> +<h3 id="build-targets">Build Targets<a class="headerlink" href="#build-targets" title="Permanent link">¶</a></h3> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #000000">$ </span>newt build stm32_slinky +Compiling main.c +... +Linking slinky.elf +App successfully built: ~/dev/slinky/bin/stm32_slinky/apps/slinky/slinky.elf +</pre></div> + + +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">newt build stm32_bootloader +Compiling crc16.c +... +Linking boot.elf +App successfully built: ~/slinky/bin/stm32_bootloader/apps/boot/boot.elf +</pre></div> + + +<p>For the main image, you need to create an image using newt create-image. +Give this image some arbitrary version number "1.2.3".</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #000000">$ </span>newt create-image stm32_slinky 1.2.3 +App image succesfully generated: /Users/paulfdietrich/dev/slinky/bin/stm32_slinky/apps/slinky/slinky.img +Build manifest: /Users/paulfdietrich/dev/slinky/bin/stm32_slinky/apps/slinky/manifest.json +</pre></div> + + +<p><br></p> +<h3 id="using-newtmgr-with-a-remote-target">Using newtmgr with a remote target<a class="headerlink" href="#using-newtmgr-with-a-remote-target" title="Permanent link">¶</a></h3> +<ul> +<li> +<p>First make sure the USB A-B type cable is connected to the ARM-USB-TINY-H debugger connector on the Olimex board. </p> +<p>Next go the to project directory and download the slinky project image to the flash of the Olimex board. </p> +</li> +</ul> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #000000">$ </span>newt load stm32_bootloader +<span style="color: #000000">$ </span>newt load stm32_slinky +</pre></div> + + +<p>You can now disconnect the debugging cable from the board. You should see the green LED blinking. If not, try powercycling the board.</p> +<p><br></p> +<ul> +<li> +<p>Now you have to set up the serial connection from your computer to the Olimex board. Locate the PC6/USART6_TX (pin#3), PC7/USART6_RX (pin#4), and GND (pin#2) of the UEXT connector on the Olimex board. More information on the UEXT connector can be found at <a href="https://www.olimex.com/Products/Modules/UEXT/">https://www.olimex.com/Products/Modules/UEXT/</a>. The schematic of the board can be found at <a href="https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407_sch.pdf">https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407_sch.pdf</a> for reference.</p> +<p><img alt="Alt Layout - Serial Connection" src="../pics/serial_conn.png" /></p> +<ul> +<li>Connect the female RX pin of the USB-TTL serial cable to the TX of the UEXT connector on the board. </li> +<li>Connect the female TX pin of the USB-TTL serial cable to the RX of the UEXT connector on the board. </li> +<li>Connect the GND pin of the USB-TTL serial cable to the GND of the UEXT connector on the board.</li> +</ul> +</li> +</ul> +<p><br></p> +<ul> +<li>Locate the serial connection established in the /dev directory of your computer. It should be of the type <code>tty.usbserial-<some identifier></code>.</li> +</ul> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ ls /dev/tty.usbserial-AJ03HAQQ + /dev/tty.usbserial-AJ03HAQQ +</pre></div> + + +<p><br></p> +<ul> +<li>You now have to define a connection profile using newtmgr. You can give it any name you want. The example below shows the connection profile being named as the very imaginative <code>olimex01</code>.</li> +</ul> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ pwd + /Users/<user>/dev/larva/project/slinky + $ newtmgr conn add olimex01 type=serial connstring=/dev/tty.usbserial-AJ03HAQQ + Connection profile olimex01 successfully added + $ newtmgr conn show + Connection profiles: + sim1: type=serial, connstring='/dev/ttys007' + olimex01: type=serial, connstring='/dev/tty.usbserial-AJ03HAQQ' +</pre></div> + + +<p><br></p> +<ul> +<li>Now go ahead and query the Olimex board to get responses back. The simplest command is the <code>echo</code> command to ask it to respond with the text you send it. </li> +</ul> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newtmgr echo -c olimex01 hello + {"r": "hello"} + $ newtmgr image -c olimex01 list + Images: + 0 : 1.2.3 + $ newtmgr -c olimex01 taskstats + Return Code = 0 + newtmgr (prio=4 tid=2 runtime=0 cswcnt=12 stksize=512 stkusage=255 last_checkin=0 next_checkin=0) + task1 (prio=1 tid=3 runtime=0 cswcnt=299 stksize=128 stkusage=33 last_checkin=0 next_checkin=0) + task2 (prio=2 tid=4 runtime=0 cswcnt=300 stksize=128 stkusage=31 last_checkin=0 next_checkin=0) + idle (prio=255 tid=0 runtime=299916 cswcnt=313 stksize=32 stkusage=18 last_checkin=0 next_checkin=0) + shell (prio=3 tid=1 runtime=1 cswcnt=20 stksize=384 stkusage=60 last_checkin=0 next_checkin=0) +</pre></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/2af796a3/newtmgr/protocol/index.html ---------------------------------------------------------------------- diff --git a/newtmgr/protocol/index.html b/newtmgr/protocol/index.html index 2b35e89..76be234 100644 --- a/newtmgr/protocol/index.html +++ b/newtmgr/protocol/index.html @@ -226,6 +226,16 @@ + <li> + <a href="../installing/">Installing</a> + </li> + + + + + + + <li><a href=" ../project-slinky/ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/2af796a3/sitemap.xml ---------------------------------------------------------------------- diff --git a/sitemap.xml b/sitemap.xml index bd308a7..188da23 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -120,6 +120,12 @@ </url> <url> + <loc>http://mynewt.apache.org/newtmgr/installing/</loc> + <lastmod>2016-03-16</lastmod> + <changefreq>daily</changefreq> + </url> + + <url> <loc>http://mynewt.apache.org</loc> <lastmod></lastmod> <changefreq>daily</changefreq>
