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/14 22:46:22 UTC
[1/5] incubator-mynewt-site git commit: added a new tutorial for
project create
Repository: incubator-mynewt-site
Updated Branches:
refs/heads/master 8f4609e88 -> 8a57453b7
added a new tutorial for project create
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/b17522a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/b17522a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/b17522a7
Branch: refs/heads/master
Commit: b17522a7b41dca1d71ac3674755158a7437b9f5a
Parents: 2bb96ab
Author: Paul Dietrich <pa...@yahoo.com>
Authored: Fri Mar 11 15:43:28 2016 -0800
Committer: Paul Dietrich <pa...@yahoo.com>
Committed: Fri Mar 11 15:43:28 2016 -0800
----------------------------------------------------------------------
mkdocs.yml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/b17522a7/mkdocs.yml
----------------------------------------------------------------------
diff --git a/mkdocs.yml b/mkdocs.yml
index f3e0b49..d912ba2 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -14,6 +14,7 @@ pages:
- Introduction: 'os/get_started/introduction.md'
- Get Started:
- 'Blinky, The First Project': 'os/get_started/project1.md'
+ - 'Creating A Project': 'os/get_started/project_create.md'
- 'Concepts':
- toc: 'os/get_started/vocabulary.md'
- Tutorials:
[5/5] incubator-mynewt-site git commit: Merge branch 'MYNEWT-247' of
https://github.com/paulfdietrich/incubator-mynewt-site
Posted by ad...@apache.org.
Merge branch 'MYNEWT-247' of https://github.com/paulfdietrich/incubator-mynewt-site
This closes #50
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/8a57453b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/8a57453b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/8a57453b
Branch: refs/heads/master
Commit: 8a57453b70114bdfd60d7ba9a7e5bab8db78749f
Parents: 8f4609e 0ae305a
Author: aditihilbert <ad...@runtime.io>
Authored: Mon Mar 14 14:45:42 2016 -0700
Committer: aditihilbert <ad...@runtime.io>
Committed: Mon Mar 14 14:45:42 2016 -0700
----------------------------------------------------------------------
docs/newt/newt_linux.md | 107 --------
docs/os/get_started/cross_tools.md | 57 +++++
docs/os/get_started/native_tools.md | 68 +++++
docs/os/get_started/project1.md | 364 +--------------------------
docs/os/get_started/project_create.md | 169 +++++++++++++
docs/os/tutorials/Olimex.md | 318 +++++++++++++++++++++++
docs/os/tutorials/air_quality_sensor.md | 235 ++++++++---------
mkdocs.yml | 9 +-
8 files changed, 751 insertions(+), 576 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/8a57453b/docs/newt/newt_linux.md
----------------------------------------------------------------------
diff --cc docs/newt/newt_linux.md
index bc48cb2,1f37b57..0000000
deleted file mode 100644,100644
--- a/docs/newt/newt_linux.md
+++ /dev/null
@@@ -1,107 -1,109 +1,0 @@@
--## Building newt tool on Linux
--
--
--### Getting your Ubuntu machine Ready
--
--
--#### 1. Install prerequisites
--
- * Install git, libcurl, and the Go language if you do not have them already.
-* Install git amd libcurlif you do not have them already.
--```no-highlight
-- $ sudo apt-get install git
-- $ sudo apt-get install libcurl4-gnutls-dev
- $ sudo apt-get install golang
--```
-
-* Download and install the Go Programming Language from
-[Golang.org](https://golang.org/dl/).
--
--#### 2. Create local repository
--
--* Go language enviroment dictates a directory structure. Known in Go parlanace as workspace, it must contain three sibling directories with the directory names src, pkg and bin, as explained below.
--
-- * src contains Go source files organized into packages (one package per directory),
--
-- * pkg contains package objects, and
--
-- * bin contains executable commands.
--
-- The GOPATH environment variable specifies the location of your workspace. To setup this workspace environment, create a 'dev' directory and then a 'go' directory under it. Set the GOPATH environment variable to this directory where you will soon clone the *newt* tool repository.
--
--```no-highlight
-- $ cd $HOME
-- $ mkdir -p dev/go
-- $ cd dev/go
-- $ export GOPATH=$PWD
--```
-- (Note that you need to add export statements to ~/.bashrc (or equivalent) to export variables permanently.)
--
--* Download the *newt* tool repository by using Go to copy the directory (currently the ASF incubator directory). Be patient as it may take a minute or two. Check the directories installed.
--```no-highlight
-- $ go get mynewt.apache.org/newt/...
-- $ ls
-- bin pkg src
-- $ ls src
- github.com golang.org gopkg.in mynewt.apache.org
- mynewt.apache.org github.com gopkg.in
--```
--
--* Check that newt is in place.
--```no-highlight
- $ ls $GOPATH/src/mynewt.apache.org/newt
- DISCLAIMER NOTICE newt newtvm viper
- LICENSE README.md newtmgr util yaml
- $ ls $GOPATH/src/
- Godeps README.md coding_style.txt newt.go
- LICENSE cli design.txt
--```
--#### 3. Build the newt tool
--
--
--* Use Go to run the newt.go program to build the *newt* tool. The command `go install` compiles and writes the resulting executable to an output file named `newt`, which is installed along with its dependencies in $GOPATH/bin.
--```no-highlight
- $ cd $GOPATH/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt
- $ cd $GOPATH/src/mynewt.apache.org/newt/newt
-- $ go install
-- $ ls "$GOPATH"/bin/
- godep incubator-mynewt-newt.git newt
- godep newt newtmgr newtmv
--```
--* Try running *newt*, the compiled binary. For example, check for the version number by typing 'newt version'. See all the possible commands available to a user of newt by typing 'newt -h'.
--
- Note: If you are going to be be modifying the newt tool itself often and wish to compile the program every time you call it, you may want to store the command in a variable in your .bash_profile. So type in `export newt="go run $GOPATH/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt/newt/go"` in your ~/.bashrc (or equivalent) and execute it by calling `$newt` at the prompt instead of `newt`. Here, you use `go run` which runs the compiled binary directly without producing an executable.
- Note: If you are going to be be modifying the newt tool itself often and wish to compile the program every time you call it, you may want to store the command in a variable in your .bash_profile. So type in `export newt="go run $GOPATH/src/mynewt.apache.org/newt/newt/newt.go"` in your ~/.bashrc (or equivalent) and execute it by calling `$newt` at the prompt instead of `newt`. Here, you use `go run` which runs the compiled binary directly without producing an executable.
--
--```no-highlight
-- $ newt version
-- Newt version: 1.0
-- $ newt -h
-- Newt allows you to create your own embedded project based on the Mynewt
-- operating system. Newt provides both build and package management in a
-- single tool, which allows you to compose an embedded workspace, and set
-- of projects, and then build the necessary artifacts from those projects.
-- For more information on the Mynewt operating system, please visit
-- https://www.github.com/mynewt/documentation.
--
-- Please use the newt help command, and specify the name of the command
-- you want help for, for help on how to use a specific command
--
-- Usage:
-- newt [flags]
-- newt [command]
--
-- Examples:
-- newt
-- newt help [<command-name>]
-- For help on <command-name>. If not specified, print this message.
--
--
-- Available Commands:
-- version Display the Newt version number.
-- target Set and view target information
-- egg Commands to list and inspect eggs on a nest
-- nest Commands to manage nests & clutches (remote egg repositories)
-- help Help about any command
--
-- Flags:
-- -h, --help=false: help for newt
-- -l, --loglevel="WARN": Log level, defaults to WARN.
-- -q, --quiet=false: Be quiet; only display error output.
-- -s, --silent=false: Be silent; don't output anything.
-- -v, --verbose=false: Enable verbose output when executing commands.
--
--
-- Use "newt help [command]" for more information about a command.
--```
--* Without creating a project repository, you can't do a whole lot with the Newt tool. So you'll have to wait till you have downloaded an app to try out the tool.
--
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/8a57453b/docs/os/get_started/project1.md
----------------------------------------------------------------------
diff --cc docs/os/get_started/project1.md
index 342af93,d69086c..3e80067
--- a/docs/os/get_started/project1.md
+++ b/docs/os/get_started/project1.md
@@@ -2,95 -2,38 +2,34 @@@
### Objective
--Learn how to use packages from a default application repository of Mynewt to build your first *Hello World* application (Blinky) on a target board. Once built using *newt* tool, this application will blink the LED lights on the target board. Fun stuff!
++Learn how to use packages from a default application repository of Mynewt to build your first *Hello World* application (Blinky) in the safe haven of a simulation.
This tutorial will guide to achieve the following:
1. Set up the environment on your computer to use Mynewt OS and newt tool.
2. Download packages for building and testing the project [on a simulated target](#build-test-code-on-simulator).
--3. Download packages and use tools to create a runtime image for a board to make its LED blink. You have two choices here:
-- * [Download an image to SRAM](#use-sram-to-make-led-blink), or
-- * [Download it to flash](#use-flash-to-make-led-blink).
--** Time Requirement**: Allow yourself a couple of hours for this project if you are relatively new to embedded systems and playing with development boards. Those jumpers can be pesky!
++** Time Requirement**: Allow yourself an hour for this project if you are relatively new to embedded systems and want to understand each step.
### What you need
--1. STM32-E407 development board from Olimex. You can order it from [http://www.mouser.com](http://www.mouser.com/ProductDetail/Olimex-Ltd/STM32-E407/?qs=UN6GZl1KCcit6Ye0xmPO4A%3D%3D), [http://www.digikey.com](http://www.digikey.com/product-detail/en/STM32-E407/1188-1093-ND/3726951), and other places.
--2. ARM-USB-TINY-H connector with JTAG interface for debugging ARM microcontrollers (comes with the ribbon cable to hook up to the board)
--3. USB A-B type cable to connect the debugger to your personal computer
--4. Personal Computer with Mac OS (Mac: OS X Yosemite Version 10.10.5) or Linux box (Ubuntu 14.10: Utopic Unicorn)
--5. An account on Github repository and *git* installed on your computer.
-6. It assumed you already installed native tools described [here](tools.md)
++1. Personal Computer with Mac OS (Mac: OS X Yosemite Version 10.10.5) or Linux box (Ubuntu 14.10: Utopic Unicorn)
++2. An account on Github repository and *git* installed on your computer.
++3. It assumed you already installed native tools described [here](tools.md)
Also, we assume that you're familiar with UNIX shells.
Let's gets started!
- ### Set up toolchain for Mac
+ ### Install Native and Cross Tools
-See [Installing Native Tools](native_toos.md)
+
- * Install gcc/libc that will produce 32-bit executables, using *brew*.
- ```
- $ brew install gcc
- ...
- ...
- ==> Summary
- 🍺 /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M
- ```
-
- * Install the PX4 Toolchain and check the version installed. ARM maintains a pre-built GNU toolchain with a GCC source branch targeted at Embedded ARM Processors, namely Cortex-R/Cortex-M processor families. After installing, ensure that the symbolic link installed by Homebrew points to the correct version of the debugger. If not, you can either change the symbolic link using the "ln -f -s" command or just go ahead and try with the version it points to!
- ```no-highlight
- $ brew tap PX4/homebrew-px4
- $ brew update
- $ brew install gcc-arm-none-eabi-49
- $ arm-none-eabi-gcc --version
- arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288]
- Copyright (C) 2014 Free Software Foundation, Inc.
- This is free software; see the source for copying conditions. There is NO
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- $ ls -al /usr/local/bin/arm-none-eabi-gdb
- lrwxr-xr-x 1 aditihilbert admin 69 Sep 22 17:16 /usr/local/bin/arm-none-eabi-gdb -> /usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/arm-none-eabi-gdb
- ```
- Note: If no version is specified, brew will install the latest version available. Mynewt OS will eventually work with multiple versions available, including the latest releases. However, at present we have tested only with this version and recommend it for getting started.
-
- * Install OpenOCD (Open On-Chip Debugger), which is an open-source software that will allow you to interface with the JTAG debug connector/adaptor for the Olimex board, debug, and test embedded target devices, including the Olimex board. For more on OpenOCD go to [http://openocd.org](http://openocd.org).
- ```no-highlight
- $ brew install open-ocd
- $ which openocd
- /usr/local/bin/openocd
- $ ls -l $(which openocd)
- lrwxr-xr-x 1 <user> admin 36 Sep 17 16:22 /usr/local/bin/openocd -> ../Cellar/open-ocd/0.9.0/bin/openocd
- ```
-
- At this point you have installed all the necessary software to build and test code on a simluator for the Mac OS.
- * Proceed to the [Build test code on simulator](#build-test-code-on-simulator) section.
++See [Installing Native Tools](native_tools.md)
+ and [Installing Cross Tools](cross_tools.md) for ARM to install
+ the tools needed by newt.
+
- ### Set up toolchain for Linux
-
-
- * Install gcc/ ibc that will produce 32-bit executables:
- ```no-highlight
- $ sudo apt-get install gcc-multilib libc6-i386
- ```
- * For the LED project on the Olimex hardware, you should install gcc for AM 4.9.3. This package can be installed with apt-get as documented below. The steps are explained in depth at [https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded](https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded).
- ```no-highlight
- $ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
- $ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
- $ sudo apt-get update
- $ sudo apt-get install gcc-arm-none-eabi
- ```
- * And finally, install OpenOCD (Open On-Chip Debugger), which is an open-source software that will allow you to interface with the JTAG debug connector/adaptor for the Olimex board, debug your program and test embedded target devices which, including the Olimex board.
-
- If you are running Ubuntu 15.x, then you are in luck and you can simply run:
- ```no-highlight
- $ sudo apt-get install openocd
- ```
- For this project, you should download the openocd 0.8.0 package from [https://launchpad.net/ubuntu/vivid/+source/openocd](https://launchpad.net/ubuntu/vivid/+source/openocd). The direct link to the amd64 build is [http://launchpadlibrarian.net/188260097/openocd_0.8.0-4_amd64.deb](http://launchpadlibrarian.net/188260097/openocd_0.8.0-4_amd64.deb).
-
- * At this point you have installed all the necessary software to build and test code on a simluator for Linux. Proceed to the [Build test code on simulator](#build-test-code-on-simulator) section.
-
### Install newt tool
There are two ways to install the *newt* tool on your computer. The easy way (and the recommeded way for this project) is to download the respective *newt* binaries from the links below:
@@@ -193,291 -136,291 +132,12 @@@ For extra details, specify the VERBOSE
[pass] cbmem_test_suite/cbmem_test_case_3
```
--### Use SRAM to make LED blink
--
--If you wish to build the image to run from the onboard SRAM on Olimex board, follow the steps below:
--#### Preparing the Software
--
--* Make sure the PATH environment variable includes the $HOME/dev/go/bin directory.
--
--* If you have cloned the larva repository for the simulator test in the previous section, you can skip this step. Otherwise, you have to create a repository for the project. Go to ~/dev and clone the larva repository from the apache git repository into a local directory named `larva`.
--
--```no-highlight
-- $ cd ~/dev
-- $ git clone https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git larva
-- $ ls
--
-- go larva
-- $ ls larva
-- DISCLAIMER NOTICE app.yml compiler hw net project sys
-- LICENSE README.md autotargets fs libs pkg-list.yml scripts
--```
--
--* Change directory to ~dev/larva directory and build the *blinky* project inside larva, using the *newt* tool. Starting with the target name, assign specific aspects of the project, as shown below, to pull the appropriate packages and build the right bundle or list for the board. For example, we set the architecture (arch), compiler, board support package (bsp), project, and compiler mode.
--
-- (Remember to prefix each command with "newtvm" if you are executing the newt command in a Linux virtual machine on your Windows box!)
--
--```no-highlight
-- $ newt target create blinky
-- Creating target blinky
-- Target blinky sucessfully created!
-- $ newt target set blinky arch=cortex_m4
-- Target blinky successfully set arch to arm
-- $ newt target set blinky compiler=arm-none-eabi-m4
-- Target blinky successfully set compiler to arm-none-eabi-m4
-- $ newt target set blinky project=blinky
-- Target blinky successfully set project to blinky
-- $ newt target set blinky compiler_def=debug
-- Target blinky successfully set compiler_def to debug
-- $ newt target set blinky bsp=hw/bsp/olimex_stm32-e407_devboard
-- Target blinky successfully set bsp to hw/bsp/olimex_stm32-e407_devboard
-- $ newt target show blinky
-- blinky
-- arch=cortex_m4
-- bsp=hw/bsp/olimex_stm32-e407_devboard
-- compiler=arm-none-eabi-m4
-- compiler_def=debug
-- name=blinky
-- project=blinky
--```
--
--* Next, let's build the image with the above values assigned. By default, the linker script within the `hw/bsp/olimex_stm32-e407_devboard` package builds an image for flash memory, which we don't want; instead, we want an image for the SRAM, so you need to switch that script with `run_from_sram.ld`.
--
--<font color="red">
--(We are working to simplify this scheme whereby an executable for a project will correctly elect the linker scripts and generate the relevant image. For example, the scheme will key on project identity such as bootloader, RAM, Flash (default) and build accordingly. </font>.)
--
-- Afer you build the target, you can find the executable *blinky.elf* in the project directory *~/dev/larva/project/blinky/bin/blinky.*
--```no-highlight
-- $ cd ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard
-- $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld
-- (some diff will be displayed)
-- $ cp run_from_sram.ld olimex_stm32-e407_devboard.ld
-- $ cd ~/dev/larva/project/blinky/
-- $ newt target build blinky
-- Building target blinky (project = blinky)
-- Compiling case.c
-- Compiling suite.c
-- ...
-- Successfully run!
-- $ ls bin/blinky
-- blinky.elf blinky.elf.bin blinky.elf.cmd blinky.elf.lst blinky.elf.map
--```
--
--* Check if you have all the scripts needed to launch OpenOCD and interact with the project's specific hardware. Depending on your system (Ubuntu or Windows) you may already have the scripts in your */usr/share/openocd/scripts/* directory, as they may have been part of the openocd download. If they exist, you are all set and can proceed to prepare the hardware. Otherwise check the *~/dev/larva/hw/bsp/olimex_stm32-e407_devboard* directory for a file named *f407.cfg*. Used by OpenOCD, this config enables us to interact with this specific hardware.
--
--You are all set if you see the file.
--
--```no-highlight
-- $ ls ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard
-- bin include olimex_stm32-e407_devboard_download.sh run_from_loader.ld
-- boot-olimex_stm32-e407_devboard.ld olimex_stm32-e407_devboard.ld pkg.yml run_from_sram.ld
-- f407.cfg olimex_stm32-e407_devboard_debug.sh run_from_flash.ld src
--```
--
--#### Prepare the hardware to boot from embedded SRAM
--
--* Locate the boot jumpers on the board.
--
--
--
--* B1_1/B1_0 and B0_1/B0_0 are PTH jumpers. Note that because the markings on the board may not always be accurate, when in doubt, you should always refer to the manual for the correct positioning. Since the jumpers are a pair, they should move together, and as such, the pair is responsible for the boot mode when bootloader is present.
--To locate the bootloader, the board searches in three places: User Flash Memory, System Memory or the Embedded SRAM. For this Blinky project, we will configure it to boot from SRAM by jumpering **B0_1** and **B1_1**.
--
--* Connect USB-OTG#2 in the picture above to a USB port on your computer (or a powered USB hub to make sure there is enough power available to the board).
--
--* The red PWR LED should be lit.
--
--* Connect the JTAG connector to the SWD/JTAG interface on the board. The other end of the cable should be connected to the USB port or hub of your computer.
--
--#### Let's Go!
--
--* Ensure that you are in the blinky project directory with the *blinky.elf* executable. Run the debug command in the *newt* tool. You'll see some status messages as shown below. In case you need to halt the debugging session, you can issue an `-c "reset halt"` command.
--```no-highlight
-- $ cd ~/dev/larva/project/blinky/bin/blinky
-- $ newt target debug blinky
-- Debugging with /Users/aditihilbert/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh blinky
-- Debugging /Users/aditihilbert/dev/larva/project/blinky/bin/blinky/blinky.elf
-- GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
-- Copyright (C) 2014 Free Software Foundation, Inc.
-- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
-- ...
-- (info)
-- ...
-- target state: halted
-- target halted due to debug-request, current mode: Thread
-- xPSR: 0x01000000 pc: 0x20000250 msp: 0x10010000
-- Info : accepting 'gdb' connection from 3333
-- Info : device id = 0x10036413
-- Info : flash size = 1024kbytes
-- Reset_Handler () at startup_STM32F40x.s:199
-- 199 ldr r1, =__etext
--```
--
-- Check the value of the msp (main service pointer) register. If it is not 0x10010000 as indicated above, you will have to manually set it after you open the gdp tool and load the image on it. For example,
--
--```no-highlight
-- (gdb) set $msp=0x10010000
--```
-- Now load the image and type "c" or "continue" from the GNU debugger.
--
--```no-highlight
-- (gdb) load ~/dev/larva/project/blinky/bin/blinky/blinky.elf
-- Loading section .text, size 0x4294 lma 0x20000000
-- Loading section .ARM.extab, size 0x24 lma 0x20004294
-- Loading section .ARM.exidx, size 0xd8 lma 0x200042b8
-- Loading section .data, size 0x874 lma 0x20004390
-- Start address 0x20000250, load size 19460
-- Transfer rate: 81 KB/sec, 2432 bytes/write.
-- (gdb) c
-- Continuing.
--```
--
--* Voilà! The board's LED should be blinking at 1 Hz. Success!
--
--### Use flash to make LED blink
--
--If you wish to build the image to run from the onboard flash memory on Olimex board, follow the steps below:
--
--* Configure the board to boot from flash by moving the two jumpers together to **B0_0** and **B1_0**. Refer to the pictures of the board under the section titled ["Prepare the hardware to boot from embedded SRAM"](#prepare-the-hardware-to-boot-from-embedded-sram).
--
-- You will have to reset the board once the image is uploaded to it.
--
--* If you skipped the first option for the project [(downloading an image to SRAM)](#use-sram-to-make-led-blink), then skip this step. Otherwise, continue with this step.
--
-- By default, the linker script (`olimex_stm32-e407_devboard.ld`) is configured to run from bootloader and flash. However, if you first ran the image from SRAM you had changed `olimex_stm32-e407_devboard.ld` to match `run_from_sram.ld`. You will, therefore, return to defaults with `olimex_stm32-e407_devboard.ld` linker script matching the contents of 'run_from_loader.ld'. Return to the project directory.
--
--```no-highlight
-- $ cd ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard
-- $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld
-- $ diff olimex_stm32-e407_devboard.ld run_from_loader.ld
-- (some diff will be displayed)
-- $ cp run_from_loader.ld olimex_stm32-e407_devboard.ld
-- $ cd ~/dev/larva/project/blinky/bin/blinky
--```
--
--* In order to run the image from flash, you need to build the bootloader as well. The bootloader does the initial set up of the Olimex board and then transfers control to the image stored at a location in flash known to it. The bootloader in turn requires the *bin2image* tool to check the image header for version information, CRC checks etc. So, we will need to build these two additional targets (bootloader and bin2img).
--
-- Let's first create bin2img:
--```no-highlight
-- $ newt target create bin2img
-- Creating target bin2img
-- Target bin2img successfully created!
-- $ newt target set bin2img arch=sim
-- Target bin2img successfully set arch to sim
-- $ newt target set bin2img compiler=sim
-- Target bin2img successfully set compiler to sim
-- $ newt target set bin2img project=bin2img
-- Target bin2img successfully set project to bin2img
-- $ newt target set bin2img compiler_def=debug
-- Target bin2img successfully set compiler_def to debug
-- $ newt target set bin2img bsp=hw/bsp/native
-- Target bin2img successfully set bsp to hw/bsp/native
-- $ newt target show bin2img
-- bin2img
-- arch=sim
-- bsp=hw/bsp/native
-- compiler=sim
-- compiler_def=debug
-- name=bin2img
-- project=bin2img
--```
-- And then let's create boot_olimex:
--```no-highlight
-- $ newt target create boot_olimex
-- Creating target boot_olimex
-- Target boot_olimex successfully created!
-- $ newt target set boot_olimex arch=cortex_m4
-- Target boot_olimex successfully set arch to cortex_m4
-- $ newt target set boot_olimex compiler=arm-none-eabi-m4
-- Target boot_olimex successfully set compiler to arm-none-eabi-m4
-- $ newt target set boot_olimex project=boot
-- Target boot_olimex successfully set project to boot
-- $ newt target set boot_olimex compiler_def=optimized
-- Target boot_olimex successfully set compiler_def to optimized
-- $ newt target set boot_olimex bsp=hw/bsp/olimex_stm32-e407_devboard
-- Target boot_olimex successfully set bsp to hw/bsp/olimex_stm32-e407_devboard
-- $ newt target show boot_olimex
-- 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
--```
--* Now let's build all the three targets now.
--```no-highlight
-- $ newt target build bin2img
-- Building target bin2img (project = bin2img)
-- Building project bin2img
-- ...
-- Successfully run!
-- $ newt target build boot_olimex
-- Building target boot_olimex (project = boot)
-- Building project boot
-- ...
-- Successfully run!
-- $ newt target build blinky
-- Building target blinky (project = blinky)
-- Building project blinky
-- Successfully run!
--```
--
--* Go to the project directory and download the bootloader and the image to flash ... in a flash!
--```no-highlight
-- $ cd ~/dev/larva/project/blinky/bin/blinky
-- $ newt target download boot_olimex
-- Downloading with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
-- $ newt target download blinky
-- Downloading with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
--```
--
--* Voilà! The LED should be blinking! Success!
--
--* But wait...not so fast. let's double check that it is indeed booting from flash and making the LED blink from the image in flash. Pull the USB cable off the Olimex JTAG adaptor, severing the debug connection to the JTAG port. Next power off the Olimex board by pulling out the USB cable from the board. Wait for a couple of seconds and plug the USB cable back to the board.
--
-- The LED light will start blinking again. Success!
--
-- Note #1: If you want to download the image to flash and a gdb session opened up, use `newt target debug blinky` instead of `newt target download blinky`.
--```no-highlight
-- $ newt target debug blinky
-- Debugging with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh blinky
-- Debugging ~/dev/larva/project/blinky/bin/blinky/blinky.elf
-- GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
-- Copyright (C) 2014 Free Software Foundation, Inc.
-- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
-- ...
-- (info)
-- ...
-- target state: halted
-- target halted due to debug-request, current mode: Thread
-- xPSR: 0x01000000 pc: 0x08000250 msp: 0x10010000
-- Info : accepting 'gdb' connection from 3333
-- Info : device id = 0x10036413
-- Info : flash size = 1024kbytes
-- Reset_Handler () at startup_STM32F40x.s:199
-- 199 ldr r1, =__etext
-- (gdb)
--```
--
-- Note #2: If you want to erase the flash and load the image again you may use the following commands from within gdb. `flash erase_sector 0 0 x` tells it to erase sectors 0 through x. When you ask it to display (in hex notation) the contents of the sector starting at location 'lma,' you should see all f's. The memory location 0x8000000 is the start or origin of the flash memory contents and is specified in the olimex_stm32-e407_devboard.ld linker script. The flash memory locations is specific to the processor.
--```no-highlight
-- (gdb) monitor flash erase_sector 0 0 4
-- erased sectors 0 through 4 on flash bank 0 in 2.296712s
-- (gdb) monitor mdw 0x08000000 16
-- 0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
-- (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
-- (0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
-- (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
-- (gdb) monitor flash info 0
--```
--
### Conclusion
--In summation, you achieved and learned a fair amount in this hands-on tutorial. If this is your first time to embedded systems, this must feel like the best hands-on and low-level "Hello World" progam ever.
++In summation, you achieved and learned a fair amount in this hands-on tutorial, all in the simulation environment.
--Good, we have more fun tutorials for you to get your hands dirty. Be bold and try other Blinky-like [tutorials](../tutorials/nRF52.md).
++Now you can turn to more fun tutorials where you can get your hands dirty with actual hardware. Be bold and try the Blinky [tutorials on Olimex board](../tutorials/olimex.md).
If you see anything missing or want to send us feeback, please do so by signing up for appropriate mailing lists on our [Community Page](../../community.md)
--Keep on hacking and blinking!
++Keep on hacking and blinking!
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/8a57453b/docs/os/tutorials/Olimex.md
----------------------------------------------------------------------
diff --cc docs/os/tutorials/Olimex.md
index 0000000,0000000..65061c8
new file mode 100644
--- /dev/null
+++ b/docs/os/tutorials/Olimex.md
@@@ -1,0 -1,0 +1,318 @@@
++## Blinky, Your Hello World!
++
++### Objective
++
++Learn how to use packages from a default application repository of Mynewt to build your first *Hello World* application (Blinky) on a target board. Once built using *newt* tool, this application will blink the LED lights on the target board. Fun stuff!
++
++This tutorial will guide to achieve the following, assuming you have already set up the environment on your computer to use Mynewt OS and newt tool:
++
++Download packages and use tools to create a runtime image for a board to make its LED blink. You have two choices here:
++ * [Download an image to SRAM](#use-sram-to-make-led-blink), or
++ * [Download it to flash](#use-flash-to-make-led-blink).
++
++** Time Requirement**: Allow yourself a couple of hours for this project if you are relatively new to embedded systems and playing with development boards. Those jumpers can be pesky!
++
++
++### What you need
++
++1. STM32-E407 development board from Olimex. You can order it from [http://www.mouser.com](http://www.mouser.com/ProductDetail/Olimex-Ltd/STM32-E407/?qs=UN6GZl1KCcit6Ye0xmPO4A%3D%3D), [http://www.digikey.com](http://www.digikey.com/product-detail/en/STM32-E407/1188-1093-ND/3726951), and other places.
++2. ARM-USB-TINY-H connector with JTAG interface for debugging ARM microcontrollers (comes with the ribbon cable to hook up to the board)
++3. USB A-B type cable to connect the debugger to your personal computer
++4. Personal Computer with Mac OS (Mac: OS X Yosemite Version 10.10.5) or Linux box (Ubuntu 14.10: Utopic Unicorn)
++5. An account on Github repository and *git* installed on your computer.
++6. It assumed you already installed native tools described [here](native_tools.md)
++
++Also, we assume that you're familiar with UNIX shells.
++
++Let's gets started!
++
++
++### Use SRAM to make LED blink
++
++If you wish to build the image to run from the onboard SRAM on Olimex board, follow the steps below:
++#### Preparing the Software
++
++* Make sure the PATH environment variable includes the $HOME/dev/go/bin directory.
++
++* If you have cloned the larva repository for the simulator test in the previous section, you can skip this step. Otherwise, you have to create a repository for the project. Go to ~/dev and clone the larva repository from the apache git repository into a local directory named `larva`.
++
++```no-highlight
++ $ cd ~/dev
++ $ git clone https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git larva
++ $ ls
++
++ go larva
++ $ ls larva
++ DISCLAIMER NOTICE app.yml compiler hw net project sys
++ LICENSE README.md autotargets fs libs pkg-list.yml scripts
++```
++
++* Change directory to ~dev/larva directory and build the *blinky* project inside larva, using the *newt* tool. Starting with the target name, assign specific aspects of the project, as shown below, to pull the appropriate packages and build the right bundle or list for the board. For example, we set the architecture (arch), compiler, board support package (bsp), project, and compiler mode.
++
++ (Remember to prefix each command with "newtvm" if you are executing the newt command in a Linux virtual machine on your Windows box!)
++
++```no-highlight
++ $ newt target create blinky
++ Creating target blinky
++ Target blinky sucessfully created!
++ $ newt target set blinky arch=cortex_m4
++ Target blinky successfully set arch to arm
++ $ newt target set blinky compiler=arm-none-eabi-m4
++ Target blinky successfully set compiler to arm-none-eabi-m4
++ $ newt target set blinky project=blinky
++ Target blinky successfully set project to blinky
++ $ newt target set blinky compiler_def=debug
++ Target blinky successfully set compiler_def to debug
++ $ newt target set blinky bsp=hw/bsp/olimex_stm32-e407_devboard
++ Target blinky successfully set bsp to hw/bsp/olimex_stm32-e407_devboard
++ $ newt target show blinky
++ blinky
++ arch=cortex_m4
++ bsp=hw/bsp/olimex_stm32-e407_devboard
++ compiler=arm-none-eabi-m4
++ compiler_def=debug
++ name=blinky
++ project=blinky
++```
++
++* Next, let's build the image with the above values assigned. By default, the linker script within the `hw/bsp/olimex_stm32-e407_devboard` package builds an image for flash memory, which we don't want; instead, we want an image for the SRAM, so you need to switch that script with `run_from_sram.ld`.
++
++<font color="red">
++(We are working to simplify this scheme whereby an executable for a project will correctly elect the linker scripts and generate the relevant image. For example, the scheme will key on project identity such as bootloader, RAM, Flash (default) and build accordingly. </font>.)
++
++ Afer you build the target, you can find the executable *blinky.elf* in the project directory *~/dev/larva/project/blinky/bin/blinky.*
++
++```no-highlight
++ $ cd ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard
++ $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld
++ (some diff will be displayed)
++ $ cp run_from_sram.ld olimex_stm32-e407_devboard.ld
++ $ cd ~/dev/larva/project/blinky/
++ $ newt target build blinky
++ Building target blinky (project = blinky)
++ Compiling case.c
++ Compiling suite.c
++ ...
++ Successfully run!
++ $ ls bin/blinky
++ blinky.elf blinky.elf.bin blinky.elf.cmd blinky.elf.lst blinky.elf.map
++```
++
++* Check if you have all the scripts needed to launch OpenOCD and interact with the project's specific hardware. Depending on your system (Ubuntu or Windows) you may already have the scripts in your */usr/share/openocd/scripts/* directory, as they may have been part of the openocd download. If they exist, you are all set and can proceed to prepare the hardware. Otherwise check the *~/dev/larva/hw/bsp/olimex_stm32-e407_devboard* directory for a file named *f407.cfg*. Used by OpenOCD, this config enables us to interact with this specific hardware.
++
++You are all set if you see the file.
++
++```no-highlight
++ $ ls ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard
++ bin include olimex_stm32-e407_devboard_download.sh run_from_loader.ld
++ boot-olimex_stm32-e407_devboard.ld olimex_stm32-e407_devboard.ld pkg.yml run_from_sram.ld
++ f407.cfg olimex_stm32-e407_devboard_debug.sh run_from_flash.ld src
++```
++
++#### Prepare the hardware to boot from embedded SRAM
++
++* Locate the boot jumpers on the board.
++
++
++
++* B1_1/B1_0 and B0_1/B0_0 are PTH jumpers. Note that because the markings on the board may not always be accurate, when in doubt, you should always refer to the manual for the correct positioning. Since the jumpers are a pair, they should move together, and as such, the pair is responsible for the boot mode when bootloader is present.
++To locate the bootloader, the board searches in three places: User Flash Memory, System Memory or the Embedded SRAM. For this Blinky project, we will configure it to boot from SRAM by jumpering **B0_1** and **B1_1**.
++
++* Connect USB-OTG#2 in the picture above to a USB port on your computer (or a powered USB hub to make sure there is enough power available to the board).
++
++* The red PWR LED should be lit.
++
++* Connect the JTAG connector to the SWD/JTAG interface on the board. The other end of the cable should be connected to the USB port or hub of your computer.
++
++#### Let's Go!
++
++* Ensure that you are in the blinky project directory with the *blinky.elf* executable. Run the debug command in the *newt* tool. You'll see some status messages as shown below. In case you need to halt the debugging session, you can issue an `-c "reset halt"` command.
++```no-highlight
++ $ cd ~/dev/larva/project/blinky/bin/blinky
++ $ newt target debug blinky
++ Debugging with /Users/aditihilbert/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh blinky
++ Debugging /Users/aditihilbert/dev/larva/project/blinky/bin/blinky/blinky.elf
++ GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
++ Copyright (C) 2014 Free Software Foundation, Inc.
++ License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
++ ...
++ (info)
++ ...
++ target state: halted
++ target halted due to debug-request, current mode: Thread
++ xPSR: 0x01000000 pc: 0x20000250 msp: 0x10010000
++ Info : accepting 'gdb' connection from 3333
++ Info : device id = 0x10036413
++ Info : flash size = 1024kbytes
++ Reset_Handler () at startup_STM32F40x.s:199
++ 199 ldr r1, =__etext
++```
++
++ Check the value of the msp (main service pointer) register. If it is not 0x10010000 as indicated above, you will have to manually set it after you open the gdp tool and load the image on it. For example,
++
++```no-highlight
++ (gdb) set $msp=0x10010000
++```
++ Now load the image and type "c" or "continue" from the GNU debugger.
++
++```no-highlight
++ (gdb) load ~/dev/larva/project/blinky/bin/blinky/blinky.elf
++ Loading section .text, size 0x4294 lma 0x20000000
++ Loading section .ARM.extab, size 0x24 lma 0x20004294
++ Loading section .ARM.exidx, size 0xd8 lma 0x200042b8
++ Loading section .data, size 0x874 lma 0x20004390
++ Start address 0x20000250, load size 19460
++ Transfer rate: 81 KB/sec, 2432 bytes/write.
++ (gdb) c
++ Continuing.
++```
++
++* Voilà! The board's LED should be blinking at 1 Hz. Success!
++
++### Use flash to make LED blink
++
++If you wish to build the image to run from the onboard flash memory on Olimex board, follow the steps below:
++
++* Configure the board to boot from flash by moving the two jumpers together to **B0_0** and **B1_0**. Refer to the pictures of the board under the section titled ["Prepare the hardware to boot from embedded SRAM"](#prepare-the-hardware-to-boot-from-embedded-sram).
++
++ You will have to reset the board once the image is uploaded to it.
++
++* If you skipped the first option for the project [(downloading an image to SRAM)](#use-sram-to-make-led-blink), then skip this step. Otherwise, continue with this step.
++
++ By default, the linker script (`olimex_stm32-e407_devboard.ld`) is configured to run from bootloader and flash. However, if you first ran the image from SRAM you had changed `olimex_stm32-e407_devboard.ld` to match `run_from_sram.ld`. You will, therefore, return to defaults with `olimex_stm32-e407_devboard.ld` linker script matching the contents of 'run_from_loader.ld'. Return to the project directory.
++
++```no-highlight
++ $ cd ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard
++ $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld
++ $ diff olimex_stm32-e407_devboard.ld run_from_loader.ld
++ (some diff will be displayed)
++ $ cp run_from_loader.ld olimex_stm32-e407_devboard.ld
++ $ cd ~/dev/larva/project/blinky/bin/blinky
++```
++
++* In order to run the image from flash, you need to build the bootloader as well. The bootloader does the initial set up of the Olimex board and then transfers control to the image stored at a location in flash known to it. The bootloader in turn requires the *bin2image* tool to check the image header for version information, CRC checks etc. So, we will need to build these two additional targets (bootloader and bin2img).
++
++ Let's first create bin2img:
++```no-highlight
++ $ newt target create bin2img
++ Creating target bin2img
++ Target bin2img successfully created!
++ $ newt target set bin2img arch=sim
++ Target bin2img successfully set arch to sim
++ $ newt target set bin2img compiler=sim
++ Target bin2img successfully set compiler to sim
++ $ newt target set bin2img project=bin2img
++ Target bin2img successfully set project to bin2img
++ $ newt target set bin2img compiler_def=debug
++ Target bin2img successfully set compiler_def to debug
++ $ newt target set bin2img bsp=hw/bsp/native
++ Target bin2img successfully set bsp to hw/bsp/native
++ $ newt target show bin2img
++ bin2img
++ arch=sim
++ bsp=hw/bsp/native
++ compiler=sim
++ compiler_def=debug
++ name=bin2img
++ project=bin2img
++```
++ And then let's create boot_olimex:
++```no-highlight
++ $ newt target create boot_olimex
++ Creating target boot_olimex
++ Target boot_olimex successfully created!
++ $ newt target set boot_olimex arch=cortex_m4
++ Target boot_olimex successfully set arch to cortex_m4
++ $ newt target set boot_olimex compiler=arm-none-eabi-m4
++ Target boot_olimex successfully set compiler to arm-none-eabi-m4
++ $ newt target set boot_olimex project=boot
++ Target boot_olimex successfully set project to boot
++ $ newt target set boot_olimex compiler_def=optimized
++ Target boot_olimex successfully set compiler_def to optimized
++ $ newt target set boot_olimex bsp=hw/bsp/olimex_stm32-e407_devboard
++ Target boot_olimex successfully set bsp to hw/bsp/olimex_stm32-e407_devboard
++ $ newt target show boot_olimex
++ 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
++```
++* Now let's build all the three targets now.
++```no-highlight
++ $ newt target build bin2img
++ Building target bin2img (project = bin2img)
++ Building project bin2img
++ ...
++ Successfully run!
++ $ newt target build boot_olimex
++ Building target boot_olimex (project = boot)
++ Building project boot
++ ...
++ Successfully run!
++ $ newt target build blinky
++ Building target blinky (project = blinky)
++ Building project blinky
++ Successfully run!
++```
++
++* Go to the project directory and download the bootloader and the image to flash ... in a flash!
++```no-highlight
++ $ cd ~/dev/larva/project/blinky/bin/blinky
++ $ newt target download boot_olimex
++ Downloading with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
++ $ newt target download blinky
++ Downloading with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh
++```
++
++* Voilà! The LED should be blinking! Success!
++
++* But wait...not so fast. let's double check that it is indeed booting from flash and making the LED blink from the image in flash. Pull the USB cable off the Olimex JTAG adaptor, severing the debug connection to the JTAG port. Next power off the Olimex board by pulling out the USB cable from the board. Wait for a couple of seconds and plug the USB cable back to the board.
++
++ The LED light will start blinking again. Success!
++
++ Note #1: If you want to download the image to flash and a gdb session opened up, use `newt target debug blinky` instead of `newt target download blinky`.
++```no-highlight
++ $ newt target debug blinky
++ Debugging with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh blinky
++ Debugging ~/dev/larva/project/blinky/bin/blinky/blinky.elf
++ GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
++ Copyright (C) 2014 Free Software Foundation, Inc.
++ License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
++ ...
++ (info)
++ ...
++ target state: halted
++ target halted due to debug-request, current mode: Thread
++ xPSR: 0x01000000 pc: 0x08000250 msp: 0x10010000
++ Info : accepting 'gdb' connection from 3333
++ Info : device id = 0x10036413
++ Info : flash size = 1024kbytes
++ Reset_Handler () at startup_STM32F40x.s:199
++ 199 ldr r1, =__etext
++ (gdb)
++```
++
++ Note #2: If you want to erase the flash and load the image again you may use the following commands from within gdb. `flash erase_sector 0 0 x` tells it to erase sectors 0 through x. When you ask it to display (in hex notation) the contents of the sector starting at location 'lma,' you should see all f's. The memory location 0x8000000 is the start or origin of the flash memory contents and is specified in the olimex_stm32-e407_devboard.ld linker script. The flash memory locations is specific to the processor.
++```no-highlight
++ (gdb) monitor flash erase_sector 0 0 4
++ erased sectors 0 through 4 on flash bank 0 in 2.296712s
++ (gdb) monitor mdw 0x08000000 16
++ 0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
++ (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
++ (0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
++ (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
++ (gdb) monitor flash info 0
++```
++
++### Conclusion
++
++Congratulations! You have now tried out a project on actual hardware. If this is your first time to embedded systems, this must feel like the best hands-on and low-level "Hello World" progam ever.
++
++Good, we have more fun tutorials for you to get your hands dirty. Be bold and try other Blinky-like [tutorials](../tutorials/nRF52.md).
++
++If you see anything missing or want to send us feeback, please do so by signing up for appropriate mailing lists on our [Community Page](../../community.md)
++
++Keep on hacking and blinking!
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/8a57453b/docs/os/tutorials/air_quality_sensor.md
----------------------------------------------------------------------
diff --cc docs/os/tutorials/air_quality_sensor.md
index 0bc1ef1,dbadb30..5bbe5ad
--- a/docs/os/tutorials/air_quality_sensor.md
+++ b/docs/os/tutorials/air_quality_sensor.md
@@@ -31,21 -31,21 +31,21 @@@ This time you need the latest and great
However, you want to bring in the packages from develop branch. To make that happen you say:
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt app add-pkg-list -b develop larva https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt app add-pkg-list -b develop larva https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git
++[user@IsMyLaptop:~/src/air_quality]$ newt app add-pkg-list -b develop larva https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git
Downloading pkg-list.yml from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git/develop... ok!
Verifying pkg-list.yml format...
ok!
Package list larva successfully installed to application.
--[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install libs/cmsis-core Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!
++[user@IsMyLaptop:~/src/air_quality]$ newt pkg install libs/cmsis-core Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!
Installing libs/cmsis-core
Installation was a success!
```
That's better. You want to make sure you have all the needed bits for supporting your board; so you decide to build the blinky project for it first.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt pkg install project/blinky
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install project/blinky
++[user@IsMyLaptop:~/src/air_quality]$ newt pkg install project/blinky
Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!
Installing project/blinky
Installing libs/console/full
@@@ -56,7 -56,7 +56,7 @@@ Installing sys/confi
Installing sys/log
Installing sys/stats
Installation was a success!
--[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install compiler/arm-none-eabi-m4
++[user@IsMyLaptop:~/src/air_quality]$ newt pkg install compiler/arm-none-eabi-m4
Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!
Installing compiler/arm-none-eabi-m4
Installation was a success!
@@@ -66,28 -66,28 +66,28 @@@ As you can see, this brought in quite
Now create a target for it and build it.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target create blink_f3
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target create blink_f3
++[user@IsMyLaptop:~/src/air_quality]$ newt target create blink_f3
Creating target blink_f3
Target blink_f3 successfully created!
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 arch=cortex_m4
++[user@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 arch=cortex_m4
Target blink_f3 successfully set arch to cortex_m4
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 bsp=hw/bsp/stm32f3discovery
++[user@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 bsp=hw/bsp/stm32f3discovery
Target blink_f3 successfully set bsp to hw/bsp/stm32f3discovery
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler=arm-none-eabi-m4
++[user@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler=arm-none-eabi-m4
Target blink_f3 successfully set compiler to arm-none-eabi-m4
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler_def=debug
++[user@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 compiler_def=debug
Target blink_f3 successfully set compiler_def to debug
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 project=blinky
++[user@IsMyLaptop:~/src/air_quality]$ newt target set blink_f3 project=blinky
Target blink_f3 successfully set project to blinky
--[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3
++[user@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3
Building target blink_f3 (project = blinky)
...
--[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3
++[user@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3
Building target blink_f3 (project = blinky)
Building project blinky
Linking blinky.elf
--/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: /Users/marko/src/air_quality/project/blinky//bin/blink_f3/blinky.elf section `.text' will not fit in region `FLASH'
++/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: /Users/user/src/air_quality/project/blinky//bin/blink_f3/blinky.elf section `.text' will not fit in region `FLASH'
/usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 5180 bytes
collect2: error: ld returned 1 exit status
```
@@@ -97,8 -97,8 +97,8 @@@ The error indicates that the images nee
To do that, you modify the project's egg file project/blinky/pkg.yml. And add *libs/baselibc* to list of package dependencies (pkg.deps).
Now:
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3
++[user@IsMyLaptop:~/src/air_quality]$ newt target build blink_f3
Building target blink_f3 (project = blinky)
....
Archiving libstm32f3discovery.a
@@@ -112,21 -112,21 +112,21 @@@ That's better
You know that this platform uses bootloader, which means you have to create a target for that too. And download the bootloader package.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target create boot_f3
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target create boot_f3
++[user@IsMyLaptop:~/src/air_quality]$ newt target create boot_f3
Creating target boot_f3
Target boot_f3 successfully created!
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 arch=cortex_m4
++[user@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 arch=cortex_m4
newTarget boot_f3 successfully set arch to cortex_m4
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 bsp=hw/bsp/stm32f3discovery
++[user@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 bsp=hw/bsp/stm32f3discovery
newtTarget boot_f3 successfully set bsp to hw/bsp/stm32f3discovery
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler=arm-none-eabi-m4
++[user@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler=arm-none-eabi-m4
Target boot_f3 successfully set compiler to arm-none-eabi-m4
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler_def=optimized
++[user@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 compiler_def=optimized
Target boot_f3 successfully set compiler_def to optimized
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 project=boot
++[user@IsMyLaptop:~/src/air_quality]$ newt target set boot_f3 project=boot
Target boot_f3 successfully set project to boot
--[marko@IsMyLaptop:~/src/air_quality]$ newt pkg install project/boot
++[user@IsMyLaptop:~/src/air_quality]$ newt pkg install project/boot
Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/develop... ok!
Installing project/boot
Installing fs/nffs
@@@ -147,26 -147,26 +147,25 @@@ Successfully run
Next you must download the targets to board, and see that the LED actually blinks. You plug in the STM32F3 discovery board to your laptop, and say:
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3
- Downloading with /Users/marko/src/air_quality/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
- Downloading /Users/marko/src/air_quality/project/blinky/bin/blink_f3/blinky.img to 0x08008000
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3
-Downloading with /Users/marko/src/air_quality/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
-Downloading /Users/marko/src/air_quality/project/blinky/bin/blink_f3/blinky.img to 0x08008000
++[user@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3
++Downloading with /Users/user/src/air_quality/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
++Downloading /Users/user/src/air_quality/project/blinky/bin/blink_f3/blinky.img to 0x08008000
Open On-Chip Debugger 0.9.0 (2015-05-28-12:05)
...
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800026c msp: 0x10002000
auto erase enabled
--Error: couldn't open /Users/marko/src/air_quality/project/blinky/bin/blink_f3/blinky.img
--
++Error: couldn't open /Users/user/src/air_quality/project/blinky/bin/blink_f3/blinky.img
Error: exit status 1
exit status 1
```
Ah. Forgot to create an image out of the blinky binary.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target create-image blink_f3 0.0.1
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target create-image blink_f3 0.0.1
++[user@IsMyLaptop:~/src/air_quality]$ newt target create-image blink_f3 0.0.1
Building target blink_f3 (project = blinky)
Compiling hal_flash.c
Archiving libhal.a
@@@ -179,8 -179,8 +178,8 @@@ Archiving libstm32f3discovery.
Compiling main.c
Building project blinky
Linking blinky.elf
--[marko@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3
--Downloading with /Users/marko/src/air_quality/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
++[user@IsMyLaptop:~/src/air_quality]$ newt target download blink_f3
++Downloading with /Users/user/src/air_quality/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh
```
And it's blinking.
@@@ -190,31 -190,31 +189,31 @@@
Now that you have your system setup, you can start creating your own stuff.
First you want to create a project for yourself - you can start by getting project template from blinky, as it pretty much has what you want.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality
- [marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/pkg.yml project/air_quality/
- [marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality/src
- [marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/src/main.c project/air_quality/src/
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality
-[marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/pkg.yml project/air_quality/
-[marko@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality/src
-[marko@IsMyLaptop:~/src/air_quality]$ cp project/blinky/src/main.c project/air_quality/src/
++[user@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality
++[user@IsMyLaptop:~/src/air_quality]$ cp project/blinky/pkg.yml project/air_quality/
++[user@IsMyLaptop:~/src/air_quality]$ mkdir project/air_quality/src
++[user@IsMyLaptop:~/src/air_quality]$ cp project/blinky/src/main.c project/air_quality/src/
```
Then you modify the project/air_quality/pkg.yml for air_quality in order to change the *pkg.name* to be *project/air_quality*.
And create a target for it:
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target create air_q
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target create air_q
++[user@IsMyLaptop:~/src/air_quality]$ newt target create air_q
newt targCreating target air_q
Target air_q successfully created!
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q arch=cortex_m4
++[user@IsMyLaptop:~/src/air_quality]$ newt target set air_q arch=cortex_m4
Target air_q successfully set arch to cortex_m4
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q bsp=hw/bsp/stm32f3discovery
++[user@IsMyLaptop:~/src/air_quality]$ newt target set air_q bsp=hw/bsp/stm32f3discovery
Target air_q successfully set bsp to hw/bsp/stm32f3discovery
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler=arm-none-eabi-m4
++[user@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler=arm-none-eabi-m4
Target air_q successfully set compiler to arm-none-eabi-m4
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler_def=debug
++[user@IsMyLaptop:~/src/air_quality]$ newt target set air_q compiler_def=debug
Target air_q successfully set compiler_def to debug
--[marko@IsMyLaptop:~/src/air_quality]$ newt target set air_q project=air_quality
++[user@IsMyLaptop:~/src/air_quality]$ newt target set air_q project=air_quality
Target air_q successfully set project to air_quality
--[marko@IsMyLaptop:~/src/air_quality]$ newt target build air_q
++[user@IsMyLaptop:~/src/air_quality]$ newt target build air_q
....
Successfully run!
```
@@@ -226,8 -226,8 +225,8 @@@ To start development of the driver, yo
So you add few files. pkg.yml to describe the driver, and then header stub followed by source stub.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/pkg.yml
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/pkg.yml
++[user@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/pkg.yml
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@@ -251,8 -251,8 +250,8 @@@ pkg.deps
- hw/hal
```
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/include/senseair/senseair.h
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/include/senseair/senseair.h
++[user@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/include/senseair/senseair.h
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@@ -280,8 -280,8 +279,8 @@@ void senseair_init(void)
```
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c
++[user@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@@ -300,7 -300,7 +299,7 @@@
* specific language governing permissions and limitations
* under the License.
*/
--
++
void
senseair_init(void)
{
@@@ -310,16 -310,16 +309,16 @@@
And add dependency to this package in my project yml file.
Here's from project/air_quality/pkg.yml
- ```c
++
+ ```no-highlight
pkg.name: project/air_quality
pkg.vers: 0.8.0
pkg.description: Basic example application which blinks an LED.
--pkg.author: Marko Kiiskila <ma...@runtime.io>
++pkg.author: Marko Kiiskila <us...@runtime.io>
pkg.homepage: http://mynewt.apache.org/os/get_acclimated/project2/
pkg.repository: https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva
pkg.keywords:
--
--
++
pkg.deps:
- libs/console/full
- libs/newtmgr
@@@ -333,19 -333,19 +332,20 @@@
```
And add a call to your main() to initialize this driver.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ diff project/blinky/src/main.c project/air_quality/src/main.c
++
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ diff project/blinky/src/main.c project/air_quality/src/main.c
++[user@IsMyLaptop:~/src/air_quality]$ diff project/blinky/src/main.c project/air_quality/src/main.c
28a29
> #include <senseair/senseair.h>
190a192
> senseair_init();
--[marko@IsMyLaptop:~/src/air_quality
++[user@IsMyLaptop:~/src/air_quality
```
And then build it to make sure all goes well.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target build air_q
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target build air_q
++[user@IsMyLaptop:~/src/air_quality]$ newt target build air_q
Building target air_q (project = air_quality)
Building project air_quality
Successfully run!
@@@ -358,7 -358,7 +358,8 @@@ All looks good
While developing the driver, you want to issue operations from console asking it to do stuff. The way to do this is to register your command handler with shell. Whenever your custom command is issued, you can respond to it.
The way you do this is first adding a dependency to shell package for your senseair driver. So you change libs/my_drivers/senseair/pkg.yml to have the following:
- ```c
++
+ ```no-highlight
pkg.name: libs/my_drivers/senseair
pkg.deps:
- hw/hal
@@@ -367,13 -367,13 +368,15 @@@
And then register your shell command in *senseair_init()*.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c
++[user@IsMyLaptop:~/src/air_quality]$ cat libs/my_drivers/senseair/src/senseair.c
....
++```
++```c
#include <shell/shell.h>
#include <console/console.h>
--
++
static int senseair_shell_func(int argc, char **argv);
static struct shell_cmd senseair_cmd = {
.sc_cmd = "senseair",
@@@ -388,7 -388,7 +391,7 @@@ senseair_init(void
rc = shell_cmd_register(&senseair_cmd);
assert(rc == 0);
}
--
++
static int
senseair_shell_func(int argc, char **argv)
{
@@@ -399,8 -399,8 +402,8 @@@
Then you build this, download to target, and start minicom on your console port.
- ```c
- [marko@IsMyLaptop:~]$ minicom -D /dev/tty.usbserial-AH02MIE2
+ ```no-highlight
-[marko@IsMyLaptop:~]$ minicom -D /dev/tty.usbserial-AH02MIE2
++[user@IsMyLaptop:~]$ minicom -D /dev/tty.usbserial-AH02MIE2
Welcome to minicom 2.7
@@@ -427,22 -427,22 +430,22 @@@ Now that's great. You can connect the h
The sensor has a serial port connection, and that's how you are going to connect to it. Your original BSP, hw/bsp/stm32f3discovery, has only one UART set up (as specified in src/hal_bsp.c, include/hal/bsp.h). Therefore, you need to create your own bsp which has configuration for this added hardware.
So in the shell you make a copy of the original BSP, and then change the package file a little.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ cp -R hw/bsp/stm32f3discovery hw/bsp/stm32f3discovery_with_senseair
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ cp -R hw/bsp/stm32f3discovery hw/bsp/stm32f3discovery_with_senseair
++[user@IsMyLaptop:~/src/air_quality]$ cp -R hw/bsp/stm32f3discovery hw/bsp/stm32f3discovery_with_senseair
```
Then you modify the pkg.yml in the copied BSP to assign name for this package.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ grep pkg.name hw/bsp/stm32f3discovery_with_senseair/pkg.yml
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ grep pkg.name hw/bsp/stm32f3discovery_with_senseair/pkg.yml
++[user@IsMyLaptop:~/src/air_quality]$ grep pkg.name hw/bsp/stm32f3discovery_with_senseair/pkg.yml
pkg.name: "hw/bsp/stm32f3discovery_with_senseair"
```
And you want to use this BSP with my target. So you change the BSP in the target definition.
Here's your new target.
- ```c
- [marko@IsMyLaptop:~/src/air_quality]$ newt target show air_q air_q
+ ```no-highlight
-[marko@IsMyLaptop:~/src/air_quality]$ newt target show air_q air_q
++[user@IsMyLaptop:~/src/air_quality]$ newt target show air_q air_q
arch=cortex_m4
bsp=hw/bsp/stm32f3discovery_with_senseair
compiler=arm-none-eabi-m4
@@@ -456,7 -456,7 +459,7 @@@ You add the 2nd serial port to my new B
Modify the include/hal/bsp.h to increase UART_CNT to 2, and add a definition of the 2nd logical UART. You will use this in your sensor driver.
- ```c
-```no-highlight
++```c
static const struct stm32f3_uart_cfg uart_cfg[UART_CNT] = {
[0] = {
.suc_uart = USART1,
@@@ -527,7 -527,7 +530,7 @@@ As you can see, logical UART number ha
And here is the source for the driver.
- ```c
-```no-highlight
++```c
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@@ -547,15 -547,15 +550,15 @@@
* under the License.
*/
#include <string.h>
--
++
#include <shell/shell.h>
#include <console/console.h>
#include <os/os.h>
--
++
#include <hal/hal_uart.h>
--
++
#include "senseair/senseair.h"
--
++
static const uint8_t cmd_read_co2[] = {
0xFE, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25
};
@@@ -565,24 -565,24 +568,24 @@@ static const uint8_t cmd_read_temp[] =
static const uint8_t cmd_read_humidity[] = {
0xFE, 0x44, 0x00, 0x14, 0x02, 0x97, 0xE5
};
--
++
static int senseair_shell_func(int argc, char **argv);
static struct shell_cmd senseair_cmd = {
.sc_cmd = "senseair",
.sc_cmd_func = senseair_shell_func,
};
--
--struct senseair {
++
++struct senseair {
int uart;
struct os_sem sema;
const uint8_t *tx_data;
int tx_off;
int tx_len;
-- uint8_t rx_data[32]; /* XXX what's the max? */
++ uint8_t rx_data[32];
int rx_off;
int value;
} senseair;
--
++
static int
senseair_tx_char(void *arg)
{
@@@ -590,7 -590,7 +593,7 @@@
int rc;
if (s->tx_off >= s->tx_len) {
-- /*
++ /*
* Command tx finished.
*/
s->tx_data = NULL;
@@@ -601,7 -601,7 +604,7 @@@
s->tx_off++;
return rc;
}
--
++
/*
* CRC for modbus over serial port.
*/
@@@ -609,7 -609,7 +612,7 @@@ static const uint16_t mb_crc_tbl[] =
0x0000, 0xcc01, 0xd801, 0x1400, 0xf001, 0x3c00, 0x2800, 0xe401,
0xa001, 0x6c00, 0x7800, 0xb401, 0x5000, 0x9c01, 0x8801, 0x4400
};
--
++
static uint16_t
mb_crc(const uint8_t *data, int len, uint16_t crc)
{
@@@ -620,7 -620,7 +623,7 @@@
}
return crc;
}
--
++
static int
mb_crc_check(const void *pkt, int len)
{
@@@ -638,7 -638,7 +641,7 @@@
return 0;
}
}
--
++
static int
senseair_rx_char(void *arg, uint8_t data)
{
@@@ -660,7 -660,7 +663,7 @@@
}
return 0;
}
--
++
void
senseair_tx(struct senseair *s, const uint8_t *tx_data, int data_len)
{
@@@ -671,7 -671,7 +674,7 @@@
hal_uart_start_tx(s->uart);
}
--
++
int
senseair_read(enum senseair_read_type type)
{
@@@ -679,7 -679,7 +682,7 @@@
const uint8_t *cmd;
int cmd_len;
int rc;
--
++
if (s->tx_data) {
/*
* busy
@@@ -712,13 -712,13 +715,13 @@@
}
return s->value;
}
--
++
static int
senseair_shell_func(int argc, char **argv)
{
int value;
enum senseair_read_type type;
--
++
if (argc < 2) {
usage:
console_printf("%s <co2|temp|humidity>\n", argv[0]);
@@@ -736,13 -736,13 +739,13 @@@
}
return s->value;
}
--
++
static int
senseair_shell_func(int argc, char **argv)
{
int value;
enum senseair_read_type type;
--
++
if (argc < 2) {
usage:
console_printf("%s <co2|temp|humidity>\n", argv[0]);
@@@ -765,18 -765,18 +768,18 @@@
}
return 0;
}
--
++
int
senseair_init(int uartno)
{
int rc;
struct senseair *s = &senseair;
--
++
rc = shell_cmd_register(&senseair_cmd);
if (rc) {
return rc;
}
--
++
rc = os_sem_init(&s->sema, 1);
if (rc) {
return rc;
@@@ -792,20 -792,21 +795,20 @@@
return rc;
}
s->uart = uartno;
--
++
return 0;
}
```
And you modified your main() for senseair driver init.
- :::c
- int
- main(int argc, char **argv)
- {
- ....
- senseair_init(1);
- ....
-```no-highlight
++```c
+ int
+ main(int argc, char **argv)
+ {
+ ....
+ senseair_init(1);
+ ....
-}
+ }
-
+ ```
-
You can see from the code that you are using the HAL interface to open a UART port, and using OS semaphore as a way of blocking the task when waiting for read response to come back from the sensor.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/8a57453b/mkdocs.yml
----------------------------------------------------------------------
diff --cc mkdocs.yml
index 178750e,6b1ddf6..41e122a
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@@ -13,10 -13,14 +13,14 @@@ pages
- Mynewt OS Manual:
- Introduction: 'os/get_started/introduction.md'
- Get Started:
- - 'Blinky, The First Project': 'os/get_started/project1.md'
+ - 'Installing Native Tools': 'os/get_started/native_tools.md'
+ - 'Creating Your First Project': 'os/get_started/project_create.md'
+ - 'Installing Cross Tools for ARM': 'os/get_started/cross_tools.md'
- - 'Blinky, The First Hardware': 'os/get_started/project1.md'
-
++ - 'Blinky, The First Hardware in Simulation': 'os/get_started/project1.md'
- 'Concepts':
- toc: 'os/get_started/vocabulary.md'
- Tutorials:
++ - 'Blinky on Olimex': 'os/tutorials/olimex.md'
- 'Blinky on STM32F303': 'os/tutorials/STM32F303.md'
- 'Blinky on nRF52': 'os/tutorials/nRF52.md'
- 'Blinky on Arduino Zero': 'os/tutorials/arduino_zero.md'
@@@ -313,6 -316,6 +317,9 @@@ markdown_extensions
- toc:
permalink: true
- sane_lists
++ - codehilite:
++ use_pygments: True
++ noclasses: True
extra:
chapters:
[4/5] incubator-mynewt-site git commit: tested create on linux
refactored toolchain install
Posted by ad...@apache.org.
tested create on linux
refactored toolchain install
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/0ae305ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/0ae305ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/0ae305ac
Branch: refs/heads/master
Commit: 0ae305ace466f6cf42cf234d24672631d018f53e
Parents: 7ecb28a
Author: Paul Dietrich <pa...@yahoo.com>
Authored: Fri Mar 11 17:15:30 2016 -0800
Committer: Paul Dietrich <pa...@yahoo.com>
Committed: Fri Mar 11 17:15:30 2016 -0800
----------------------------------------------------------------------
docs/newt/newt_linux.md | 18 ++++++++++--------
docs/os/get_started/cross_tools.md | 2 ++
docs/os/get_started/native_tools.md | 27 +++++++++++++++++++++++----
docs/os/get_started/project_create.md | 9 +++++++++
mkdocs.yml | 4 ++--
5 files changed, 46 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0ae305ac/docs/newt/newt_linux.md
----------------------------------------------------------------------
diff --git a/docs/newt/newt_linux.md b/docs/newt/newt_linux.md
index d7efa53..1f37b57 100644
--- a/docs/newt/newt_linux.md
+++ b/docs/newt/newt_linux.md
@@ -6,13 +6,15 @@
#### 1. Install prerequisites
-* Install git, libcurl, and the Go language if you do not have them already.
+* Install git amd libcurlif you do not have them already.
```no-highlight
$ sudo apt-get install git
$ sudo apt-get install libcurl4-gnutls-dev
- $ sudo apt-get install golang
```
+* Download and install the Go Programming Language from
+[Golang.org](https://golang.org/dl/).
+
#### 2. Create local repository
* Go language enviroment dictates a directory structure. Known in Go parlanace as workspace, it must contain three sibling directories with the directory names src, pkg and bin, as explained below.
@@ -35,16 +37,16 @@
* Download the *newt* tool repository by using Go to copy the directory (currently the ASF incubator directory). Be patient as it may take a minute or two. Check the directories installed.
```no-highlight
- $ go get git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt
+ $ go get mynewt.apache.org/newt/...
$ ls
bin pkg src
$ ls src
- git-wip-us.apache.org github.com gopkg.in
+ mynewt.apache.org github.com gopkg.in
```
* Check that newt is in place.
```no-highlight
- $ ls $GOPATH/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt
+ $ ls $GOPATH/src/
Godeps README.md coding_style.txt newt.go
LICENSE cli design.txt
```
@@ -53,14 +55,14 @@
* Use Go to run the newt.go program to build the *newt* tool. The command `go install` compiles and writes the resulting executable to an output file named `newt`, which is installed along with its dependencies in $GOPATH/bin.
```no-highlight
- $ cd $GOPATH/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt
+ $ cd $GOPATH/src/mynewt.apache.org/newt/newt
$ go install
$ ls "$GOPATH"/bin/
- godep incubator-mynewt-newt.git newt
+ godep newt newtmgr newtmv
```
* Try running *newt*, the compiled binary. For example, check for the version number by typing 'newt version'. See all the possible commands available to a user of newt by typing 'newt -h'.
- Note: If you are going to be be modifying the newt tool itself often and wish to compile the program every time you call it, you may want to store the command in a variable in your .bash_profile. So type in `export newt="go run $GOPATH/src/git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt/newt/go"` in your ~/.bashrc (or equivalent) and execute it by calling `$newt` at the prompt instead of `newt`. Here, you use `go run` which runs the compiled binary directly without producing an executable.
+ Note: If you are going to be be modifying the newt tool itself often and wish to compile the program every time you call it, you may want to store the command in a variable in your .bash_profile. So type in `export newt="go run $GOPATH/src/mynewt.apache.org/newt/newt/newt.go"` in your ~/.bashrc (or equivalent) and execute it by calling `$newt` at the prompt instead of `newt`. Here, you use `go run` which runs the compiled binary directly without producing an executable.
```no-highlight
$ newt version
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0ae305ac/docs/os/get_started/cross_tools.md
----------------------------------------------------------------------
diff --git a/docs/os/get_started/cross_tools.md b/docs/os/get_started/cross_tools.md
index 5513b1a..2cc9b8c 100644
--- a/docs/os/get_started/cross_tools.md
+++ b/docs/os/get_started/cross_tools.md
@@ -1,5 +1,7 @@
# Installing Cross Tools for ARM
+This page shows how to install tools to use some ARM based platforms
+with mynewt.
## Install Cross tools for ARM MAC
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0ae305ac/docs/os/get_started/native_tools.md
----------------------------------------------------------------------
diff --git a/docs/os/get_started/native_tools.md b/docs/os/get_started/native_tools.md
index 53280c8..67c0b6e 100644
--- a/docs/os/get_started/native_tools.md
+++ b/docs/os/get_started/native_tools.md
@@ -13,7 +13,7 @@ This page provides guidance for MAC and Linux. See the relevant sections below.
if you have not already installed Homebrew from the
[`newt` tutorials pages](../../newt/newt_mac.md).
-### Install gcc/libc that will produce 32-bit executables.
+###Install gcc/libc
Use brew to install gcc.
@@ -25,7 +25,7 @@ Use brew to install gcc.
🍺 /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M
```
-### install gdb
+###Install gdb
```no-highlight
$ brew install gdb
@@ -35,9 +35,10 @@ Use brew to install gcc.
🍺 /usr/local/Cellar/gdb/7.10.1: XXX files,YYM
```
-NOTE: When running a program with gdb, you may need to sign your gdb
+_NOTE: When running a program with gdb, you may need to sign your gdb
executable. [This page](https://gcc.gnu.org/onlinedocs/gnat_ugn/Codesigning-the-Debugger.html)
-shows a recipe for gdb signing.
+shows a recipe for gdb signing. Alternately you can skip this step and
+continue without the ability to debug your mynewt application on your PC._
## Set up toolchain for Linux
@@ -45,5 +46,23 @@ shows a recipe for gdb signing.
```no-highlight
$ sudo apt-get install gcc-multilib libc6-i386
```
+###Install gdb
+
+```no-highlight
+$sudo apt-get install gdb
+
+Reading package lists... Done
+Building dependency tree
+Reading state information... Done
+Suggested packages:
+ gdb-doc gdbserver
+The following NEW packages will be installed:
+ gdb
+...
+Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
+Setting up gdb (7.7.1-0ubuntu5~14.04.2) ...
+$
+
+```
At this point you have installed all the necessary software to build and test code on a simluator for Linux. Proceed to the [Build test code on simulator](#build-test-code-on-simulator) section.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0ae305ac/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 1a334e9..4afe2d4 100644
--- a/docs/os/get_started/project_create.md
+++ b/docs/os/get_started/project_create.md
@@ -120,6 +120,15 @@ under the specific repository you have included in the base project.
Within each of these directories are the packages required to build your
project for the various targets.
+## Do compiler stuff for Linux
+
+A current behavior on Linux requires that we copy a single file within this
+project.
+
+```no-highlight
+cp repos/apache-mynewt-core/compiler/sim/linux-compiler.yml repos/apache-mynewt-core/compiler/sim/compiler.yml
+```
+
## Testing the Project
To validate, you can also run all the units test through simulation.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/0ae305ac/mkdocs.yml
----------------------------------------------------------------------
diff --git a/mkdocs.yml b/mkdocs.yml
index 4f87395..6b1ddf6 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -14,9 +14,9 @@ pages:
- Introduction: 'os/get_started/introduction.md'
- Get Started:
- 'Installing Native Tools': 'os/get_started/native_tools.md'
+ - 'Creating Your First Project': 'os/get_started/project_create.md'
- 'Installing Cross Tools for ARM': 'os/get_started/cross_tools.md'
- - 'Blinky, The First Project': 'os/get_started/project1.md'
- - 'Creating A Project': 'os/get_started/project_create.md'
+ - 'Blinky, The First Hardware': 'os/get_started/project1.md'
- 'Concepts':
- toc: 'os/get_started/vocabulary.md'
[2/5] incubator-mynewt-site git commit: a new file to create a project
Posted by ad...@apache.org.
a new file to create a project
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/7ff04edd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/7ff04edd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/7ff04edd
Branch: refs/heads/master
Commit: 7ff04eddae8ac46514ab90ba8dd31b69b5a8d828
Parents: b17522a
Author: Paul Dietrich <pa...@yahoo.com>
Authored: Fri Mar 11 15:43:48 2016 -0800
Committer: Paul Dietrich <pa...@yahoo.com>
Committed: Fri Mar 11 15:43:48 2016 -0800
----------------------------------------------------------------------
docs/os/get_started/project_create.md | 160 +++++++++++++++++++++++++++++
1 file changed, 160 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7ff04edd/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
new file mode 100644
index 0000000..1a334e9
--- /dev/null
+++ b/docs/os/get_started/project_create.md
@@ -0,0 +1,160 @@
+# Creating a Mynewt Project
+
+This page shows how to create a Mynewt Project using `newt`
+
+# Pre-Requisites
+
+* Ensure you have installed [newt](../../newt/newt_intro) 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](project1.md) to
+support native compiling to build the project this tutorial creates.
+
+## Newt New
+
+Chose a project name. For this tutorial we will call this project `myproj`.
+Enter the `newt new myproj` command. Your put
+```no-highlight
+$ newt new myproj
+
+Downloading project skeleton from apache/incubator-mynewt-blinky...
+Downloading repository incubator-mynewt-blinky (branch: develop) at https://github.com/apache/incubator-mynewt-blinky.git
+Cloning into '/var/folders/x0/1yjkfd_93j79r64d2vf104d40000gp/T/newt-repo290518149'...
+remote: Counting objects: 727, done.
+remote: Compressing objects: 100% (29/29), done.
+remote: Total 727 (delta 7), reused 0 (delta 0), pack-reused 696
+Receiving objects: 100% (727/727), 201.64 KiB | 0 bytes/s, done.
+Resolving deltas: 100% (329/329), done.
+Checking connectivity... done.
+Installing skeleton in myproj...
+Project myproj successfully created
+```
+
+The `newt` tool has created a project directory structure like the one below:
+
+```no-highlight
+─── myproj
+ ├── DISCLAIMER
+ ├── LICENSE
+ ├── NOTICE
+ ├── README.md
+ ├── apps
+ │ └── blinky
+ │ ├── pkg.yml
+ │ └── src
+ │ └── main.c
+ ├── project.yml
+ └── targets
+ ├── my_blinky_sim
+ │ ├── pkg.yml
+ │ └── target.yml
+ └── unittest
+ ├── pkg.yml
+ └── target.yml
+```
+
+`newt` has installed the base files for a project comprising the following.
+
+1. 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
+and its package dependencies.
+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-build-able 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.
+
+## Newt Install
+
+change into the `myproj` directory. Then ask newt to install all the
+project package dependencies using `newt install`
+
+```no-highlight
+$ 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/x0/1yjkfd_93j79r64d2vf104d40000gp/T/newt-repo379645046'...
+remote: Counting objects: 17684, done.
+remote: Compressing objects: 100% (377/377), done.
+remote: Total 17684 (delta 190), reused 0 (delta 0), pack-reused 17284
+Receiving objects: 100% (17684/17684), 6.11 MiB | 2.19 MiB/s, done.
+Resolving deltas: 100% (10395/10395), done.
+Checking connectivity... done.
+Repos successfully installed
+$
+```
+
+Now you will have installed packages required to build your project. Note in
+the package you now have dependent packages stored in the `repos` directory
+under the specific repository you have included in the base project.
+
+```no-highlight
+.
+├── apps
+│ └── blinky
+│ └── src
+├── repos
+│ └── apache-mynewt-core
+│ ├── apps
+│ ├── compiler
+│ ├── fs
+│ ├── hw
+│ ├── libs
+│ ├── net
+│ ├── scripts
+│ ├── sys
+│ └── targets
+└── targets
+ ├── my_blinky_sim
+ └── unittest
+```
+
+Within each of these directories are the packages required to build your
+project for the various targets.
+
+## Testing the Project
+
+To validate, you can also run all the units test through simulation.
+
+```no-highlight
+newt test all
+...lots of compiling and testing...
+...about 2 minutes later ...
+Archiving bootutil.a
+Linking test_bootutil
+Executing test: /myproj/bin/unittest/libs/bootutil/test_bootutil
+Passed tests: [net/nimble/host fs/nffs libs/os hw/hal libs/mbedtls libs/util sys/config libs/bootutil]
+All tests passed
+```
+
+## Building the Project
+
+To build the project you can use `newt build` using the target
+
+```no-highlight
+$ newt build targets/my_blinky_sim
+App successfully built: /bin/my_blinky_sim/apps/blinky/blinky.elf
+```
+
+You can run the simulated version of your project and see the simulated LED
+blink
+```no-highlight
+./bin/my_blinky_sim/apps/blinky/blinky.elf
+hal_gpio set pin 1 to 0
+```
+
+Just do `ctrl-c` to exit.
+
+## Complete
+
+Congratulations, you have created your first project. This project contains
+the core OS, a simple application to blink an LED and all of the dependencies
+required.
\ No newline at end of file
[3/5] incubator-mynewt-site git commit: break out the toolchain
installation to separate getting started pages
Posted by ad...@apache.org.
break out the toolchain installation to separate getting started pages
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/7ecb28a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/7ecb28a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/7ecb28a6
Branch: refs/heads/master
Commit: 7ecb28a6ca8ece233813c245ea7674f8576fe6fa
Parents: 7ff04ed
Author: Paul Dietrich <pa...@yahoo.com>
Authored: Fri Mar 11 16:25:35 2016 -0800
Committer: Paul Dietrich <pa...@yahoo.com>
Committed: Fri Mar 11 16:25:35 2016 -0800
----------------------------------------------------------------------
docs/os/get_started/cross_tools.md | 55 ++++++++++++++++++++++++++
docs/os/get_started/native_tools.md | 49 +++++++++++++++++++++++
docs/os/get_started/project1.md | 67 +++-----------------------------
mkdocs.yml | 3 ++
4 files changed, 112 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7ecb28a6/docs/os/get_started/cross_tools.md
----------------------------------------------------------------------
diff --git a/docs/os/get_started/cross_tools.md b/docs/os/get_started/cross_tools.md
new file mode 100644
index 0000000..5513b1a
--- /dev/null
+++ b/docs/os/get_started/cross_tools.md
@@ -0,0 +1,55 @@
+# Installing Cross Tools for ARM
+
+
+## Install Cross tools for ARM MAC
+
+### Install Tool Chain
+
+Install the PX4 Toolchain and check the version installed. ARM maintains a pre-built GNU toolchain with a GCC source branch targeted at Embedded ARM Processors, namely Cortex-R/Cortex-M processor families. After installing, ensure that the symbolic link installed by Homebrew points to the correct version of the debugger. If not, you can either change the symbolic link using the "ln -f -s" command or just go ahead and try with the version it points to!
+```no-highlight
+ $ brew tap PX4/homebrew-px4
+ $ brew update
+ $ brew install gcc-arm-none-eabi-49
+ $ arm-none-eabi-gcc --version
+ arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288]
+ Copyright (C) 2014 Free Software Foundation, Inc.
+ This is free software; see the source for copying conditions. There is NO
+ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ $ ls -al /usr/local/bin/arm-none-eabi-gdb
+ lrwxr-xr-x 1 aditihilbert admin 69 Sep 22 17:16 /usr/local/bin/arm-none-eabi-gdb -> /usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/arm-none-eabi-gdb
+```
+ Note: If no version is specified, brew will install the latest version available. Mynewt OS will eventually work with multiple versions available, including the latest releases. However, at present we have tested only with this version and recommend it for getting started.
+
+### Install OpenOCD
+
+Install OpenOCD (Open On-Chip Debugger), which is an open-source software that will allow you to interface with the JTAG debug connector/adaptor for the Olimex board, debug, and test embedded target devices, including the Olimex board. For more on OpenOCD go to [http://openocd.org](http://openocd.org).
+```no-highlight
+ $ brew install open-ocd
+ $ which openocd
+ /usr/local/bin/openocd
+ $ ls -l $(which openocd)
+ lrwxr-xr-x 1 <user> admin 36 Sep 17 16:22 /usr/local/bin/openocd -> ../Cellar/open-ocd/0.9.0/bin/openocd
+```
+
+## Install cross arm tools for Linux
+
+### Install Tool Chain
+
+For the LED project on the Olimex hardware, you should install gcc for AM 4.9.3. This package can be installed with apt-get as documented below. The steps are explained in depth at [https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded](https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded).
+```no-highlight
+ $ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
+ $ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
+ $ sudo apt-get update
+ $ sudo apt-get install gcc-arm-none-eabi
+```
+
+
+###Install OpenOCD
+And finally, install OpenOCD (Open On-Chip Debugger), which is an open-source software that will allow you to interface with the JTAG debug connector/adaptor for the Olimex board, debug your program and test embedded target devices which, including the Olimex board.
+
+If you are running Ubuntu 15.x, then you are in luck and you can simply run:
+```no-highlight
+ $ sudo apt-get install openocd
+```
+ For this project, you should download the openocd 0.8.0 package from [https://launchpad.net/ubuntu/vivid/+source/openocd](https://launchpad.net/ubuntu/vivid/+source/openocd). The direct link to the amd64 build is [http://launchpadlibrarian.net/188260097/openocd_0.8.0-4_amd64.deb](http://launchpadlibrarian.net/188260097/openocd_0.8.0-4_amd64.deb).
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7ecb28a6/docs/os/get_started/native_tools.md
----------------------------------------------------------------------
diff --git a/docs/os/get_started/native_tools.md b/docs/os/get_started/native_tools.md
new file mode 100644
index 0000000..53280c8
--- /dev/null
+++ b/docs/os/get_started/native_tools.md
@@ -0,0 +1,49 @@
+# Installing Native Mynewt Tools
+
+This page shows how to install tools for native Mynewt targets. This
+allows you to run Mynewt OS as a native application. It also allows
+you to run the test suites for all packages not requiring HW support.
+
+This page provides guidance for MAC and Linux. See the relevant sections below.
+
+## Set up toolchain for Mac
+
+### Install Brew
+
+if you have not already installed Homebrew from the
+[`newt` tutorials pages](../../newt/newt_mac.md).
+
+### Install gcc/libc that will produce 32-bit executables.
+
+Use brew to install gcc.
+
+```no-highlight
+ $ brew install gcc
+ ...
+ ...
+ ==> Summary
+ 🍺 /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M
+```
+
+### install gdb
+
+```no-highlight
+ $ brew install gdb
+ ...
+ ...
+ ==> Summary
+ 🍺 /usr/local/Cellar/gdb/7.10.1: XXX files,YYM
+```
+
+NOTE: When running a program with gdb, you may need to sign your gdb
+executable. [This page](https://gcc.gnu.org/onlinedocs/gnat_ugn/Codesigning-the-Debugger.html)
+shows a recipe for gdb signing.
+
+## Set up toolchain for Linux
+
+###Install gcc/libc that will produce 32-bit executables:
+```no-highlight
+ $ sudo apt-get install gcc-multilib libc6-i386
+```
+
+At this point you have installed all the necessary software to build and test code on a simluator for Linux. Proceed to the [Build test code on simulator](#build-test-code-on-simulator) section.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7ecb28a6/docs/os/get_started/project1.md
----------------------------------------------------------------------
diff --git a/docs/os/get_started/project1.md b/docs/os/get_started/project1.md
index c3a433d..d69086c 100644
--- a/docs/os/get_started/project1.md
+++ b/docs/os/get_started/project1.md
@@ -22,74 +22,17 @@ This tutorial will guide to achieve the following:
3. USB A-B type cable to connect the debugger to your personal computer
4. Personal Computer with Mac OS (Mac: OS X Yosemite Version 10.10.5) or Linux box (Ubuntu 14.10: Utopic Unicorn)
5. An account on Github repository and *git* installed on your computer.
+6. It assumed you already installed native tools described [here](tools.md)
Also, we assume that you're familiar with UNIX shells.
Let's gets started!
-### Set up toolchain for Mac
+### Install Native and Cross Tools
-
-* Install gcc/libc that will produce 32-bit executables, using *brew*.
-```no-highlight
- $ brew install gcc
- ...
- ...
- ==> Summary
- 🍺 /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M
-```
-
-* Install the PX4 Toolchain and check the version installed. ARM maintains a pre-built GNU toolchain with a GCC source branch targeted at Embedded ARM Processors, namely Cortex-R/Cortex-M processor families. After installing, ensure that the symbolic link installed by Homebrew points to the correct version of the debugger. If not, you can either change the symbolic link using the "ln -f -s" command or just go ahead and try with the version it points to!
-```no-highlight
- $ brew tap PX4/homebrew-px4
- $ brew update
- $ brew install gcc-arm-none-eabi-49
- $ arm-none-eabi-gcc --version
- arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288]
- Copyright (C) 2014 Free Software Foundation, Inc.
- This is free software; see the source for copying conditions. There is NO
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- $ ls -al /usr/local/bin/arm-none-eabi-gdb
- lrwxr-xr-x 1 aditihilbert admin 69 Sep 22 17:16 /usr/local/bin/arm-none-eabi-gdb -> /usr/local/Cellar/gcc-arm-none-eabi-49/20150609/bin/arm-none-eabi-gdb
-```
- Note: If no version is specified, brew will install the latest version available. Mynewt OS will eventually work with multiple versions available, including the latest releases. However, at present we have tested only with this version and recommend it for getting started.
-
-* Install OpenOCD (Open On-Chip Debugger), which is an open-source software that will allow you to interface with the JTAG debug connector/adaptor for the Olimex board, debug, and test embedded target devices, including the Olimex board. For more on OpenOCD go to [http://openocd.org](http://openocd.org).
-```no-highlight
- $ brew install open-ocd
- $ which openocd
- /usr/local/bin/openocd
- $ ls -l $(which openocd)
- lrwxr-xr-x 1 <user> admin 36 Sep 17 16:22 /usr/local/bin/openocd -> ../Cellar/open-ocd/0.9.0/bin/openocd
-```
-
-At this point you have installed all the necessary software to build and test code on a simluator for the Mac OS.
-* Proceed to the [Build test code on simulator](#build-test-code-on-simulator) section.
-
-
-### Set up toolchain for Linux
-
-
-* Install gcc/ ibc that will produce 32-bit executables:
-```no-highlight
- $ sudo apt-get install gcc-multilib libc6-i386
-```
-* For the LED project on the Olimex hardware, you should install gcc for AM 4.9.3. This package can be installed with apt-get as documented below. The steps are explained in depth at [https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded](https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded).
-```no-highlight
- $ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
- $ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
- $ sudo apt-get update
- $ sudo apt-get install gcc-arm-none-eabi
-```
-* And finally, install OpenOCD (Open On-Chip Debugger), which is an open-source software that will allow you to interface with the JTAG debug connector/adaptor for the Olimex board, debug your program and test embedded target devices which, including the Olimex board.
-
- If you are running Ubuntu 15.x, then you are in luck and you can simply run:
-```no-highlight
- $ sudo apt-get install openocd
-```
- For this project, you should download the openocd 0.8.0 package from [https://launchpad.net/ubuntu/vivid/+source/openocd](https://launchpad.net/ubuntu/vivid/+source/openocd). The direct link to the amd64 build is [http://launchpadlibrarian.net/188260097/openocd_0.8.0-4_amd64.deb](http://launchpadlibrarian.net/188260097/openocd_0.8.0-4_amd64.deb).
-
-* At this point you have installed all the necessary software to build and test code on a simluator for Linux. Proceed to the [Build test code on simulator](#build-test-code-on-simulator) section.
+See [Installing Native Tools](native_toos.md)
+ and [Installing Cross Tools](cross_tools.md) for ARM to install
+the tools needed by newt.
### Install newt tool
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7ecb28a6/mkdocs.yml
----------------------------------------------------------------------
diff --git a/mkdocs.yml b/mkdocs.yml
index d912ba2..4f87395 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -13,8 +13,11 @@ pages:
- Mynewt OS Manual:
- Introduction: 'os/get_started/introduction.md'
- Get Started:
+ - 'Installing Native Tools': 'os/get_started/native_tools.md'
+ - 'Installing Cross Tools for ARM': 'os/get_started/cross_tools.md'
- 'Blinky, The First Project': 'os/get_started/project1.md'
- 'Creating A Project': 'os/get_started/project_create.md'
+
- 'Concepts':
- toc: 'os/get_started/vocabulary.md'
- Tutorials: