Native Installation (OS X)

Mynewt relies on two command line utilities (newt and newtmgr), both of which are described elsewhere in this learning guide, as well as the presence of an ARM cross-compiling toolchain (arm-none-eabi-gcc, etc.).

Both of these need to be installed and available on your system to work with Mynewt projects.

Install newt and newtmgr Binaries

Binary versions of the command-line tools are available from Apache.

Before you start, you will need to add the runtimeco/homebrew-mynewt 'tap' to brew, which can be done as follows:

$ brew tap runtimeco/homebrew-mynewt
$ brew update

Install newt

The full setup guide is available here: http://mynewt.apache.org/newt/install/newt_mac

$ brew install mynewt-newt
==> Installing mynewt-newt from runtimeco/mynewt
==> Downloading https://github.com/runtimeco/binary-releases/raw/master/mynewt-newt-tools_1.1.0/mynewt-newt-1.1.0.sierra.bottle.tar.gz
==> Downloading from https://raw.githubusercontent.com/runtimeco/binary-releases/master/mynewt-newt-tools_1.1.0/mynewt-newt-1.1.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mynewt-newt-1.1.0.sierra.bottle.tar.gz
/usr/local/Cellar/mynewt-newt/1.1.0: 3 files, 10.5MB

You can test the install with:

$newt version
Apache Newt version: 1.1.0

Install newtmgr

The full setup guide is available here: http://mynewt.apache.org/newtmgr/install_mac/

$ brew install mynewt-newtmgr
==> Installing mynewt-newtmgr from runtimeco/mynewt
==> Downloading https://github.com/runtimeco/binary-releases/raw/master/mynewt-newt-tools_1.1.0/mynewt-newtmgr-1.1.0.sierra.bottle.tar.gz
==> Downloading from https://raw.githubusercontent.com/runtimeco/binary-releases/master/mynewt-newt-tools_1.1.0/mynewt-newtmgr-1.1.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mynewt-newtmgr-1.1.0.sierra.bottle.tar.gz
/usr/local/Cellar/mynewt-newtmgr/1.1.0: 3 files, 17MB

You can test the install with:

$ newtmgr help
Newtmgr helps you manage remote devices running the Mynewt OS

Usage:
  newtmgr [flags]
  newtmgr [command]

Available Commands:
  config      Read or write a config value on a device
  conn        Manage newtmgr connection profiles
  crash       Send a crash command to a device
  datetime    Manage datetime on a device
  echo        Send data to a device and display the echoed back data
  fs          Access files on a device
  help        Help about any command
  image       Manage images on a device
  log         Manage logs on a device
  mpstat      Read mempool statistics from a device
  reset       Perform a soft reset of a device
  run         Run test procedures on a device
  stat        Read statistics from a device
  taskstat    Read task statistics from a device

Flags:
  -c, --conn string       connection profile to use
  -h, --help              help for newtmgr
  -l, --loglevel string   log level to use (default "info")
      --name string       name of target BLE device; overrides profile setting
  -t, --timeout float     timeout in seconds (partial seconds allowed) (default 10)
  -r, --tries int         total number of tries in case of timeout (default 1)

Use "newtmgr [command] --help" for more information about a command.

Install an ARM Cross-Compiling Toolchain

In order to build and debug ARM binaries, you will also need to install a cross-compiling toolchain targeting the ARM architecture.

Thankfully, pre-built binaries are also available in brew (used to install newt and newtmgr), as described in the setup guide below:

$ brew tap PX4/homebrew-px4
$ brew update
$ brew install gcc-arm-none-eabi-49

You can test the installation with the following command (making sure that the version listed is 4.9!):

$ 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.

Optional: Install the OpenOCD Debugger

If you wish to debug or flash your projects with a Segger J-Link, you will also need to install the OpenOCD debug tool via the following steps:

$ brew install openocd

If you see one of these errors:

  • Library not loaded: /usr/local/lib/libusb-0.1.4.dylib
    Run: brew install libusb-compat
  • Library not loaded: /usr/local/opt/libftdi/lib/libftdi1.2.dylib
    Run: brew install libftdi
  • Library not loaded: /usr/local/lib/libhidapi.0.dylib
    Run: brew install hidapi

Make sure you have at least version 0.10.0, which can be verified with the following command:

$ openocd --version
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

Optional: Install Segger J-Link Drivers

If you wish to use the newt load or newt debug commands and a Segger J-Link, you will need to install the Segger J-Link drivers as well.

You will need to go to the Segger J-Link Downloads page and download the 'J-Link Software and Documentation pack for MacOSX' installer:

Once downloader, run the installer and the JLinkExe and related J-Link commands that Mynewt relies on will be available from the command-line.

Optional: Install minicom

Much of the interaction with your Mynewt device will happen over the serial port, including working with Shell-based commands on your device.

A relatively easy to use command line application to work with serial port connections is minicom, which is used throughout this learning guide. It can be installed from the command-line with the following command:

$ brew install minicom

You can establish a serial connection via minicom with the following command (adjusting the /dev/tty device name as appropriate):

$ minicom -D /dev/tty.SLAB_USBtoUART
Last updated on 2017-08-17 at 05.49.18 PM Published on 2017-08-18 at 03.37.04 PM