Native Installation (Linux)

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.

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

Manual newt Installation

On most Debian-based systems, the easiest route will be to manually install the pre-built newt binary from the distribution package as follows:

$ wget https://raw.githubusercontent.com/runtimeco/debian-mynewt/master/pool/main/n/newt/newt_1.1.0-1_amd64.deb
$ sudo dpkg -i newt_1.1.0-1_amd64.deb

Manual newtmgr Installation

Similarly, to install newtmgr you can run the following commands:

$ wget https://raw.githubusercontent.com/runtimeco/debian-mynewt/master/pool/main/n/newtmgr/newtmgr_1.1.0-1_amd64.deb
$ sudo dpkg -i newtmgr_1.1.0-1_amd64.deb

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 available, as described in the setup guide below:

$ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi 
$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
$ sudo apt-get update 
$ sudo apt-get install gcc-arm-none-eabi

Optional: Install the OpenOCD Debugger (Segger J-Link)

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:

  1. Download the binary tarball for Linux
    $ wget https://github.com/runtimeco/openocd-binaries/raw/master/openocd-bin-0.10.0-Linux.tgz
  2. Change to the root directory: $ cd /
  3. Untar the tarball and install into /usr/local/bin. You will need to replace ~/Downloads with the directory that the tarball is downloaded to: 
    $ sudo tar -xpf ~/Downloads/openocd-bin-0.10.0-Linux.tgz
    Note: You must specify the -p option for the tar command.
  4. Check the OpenOCD version you are using:
$ which openocd
/usr/local/bin/openocd
$openocd -v
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html

You should see version: 0.10.0.

If you see any of these error messages:

  • openocd: error while loading shared libraries: libhidapi-hidraw.so.0: cannot open shared object file: No such file or directory

  • openocd: error while loading shared libraries: libusb-1.0.so.0: cannot open shared object file: No such file or directory

run the following command to install the libraries:

$ sudo apt-get install libhidapi-dev:i386

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.

On Ubuntu systems, you will need to go to the Segger J-Link Downloads page and download an appropriate binary package:

  • For 32-bit systems download:
    J-Link Software and Documentation pack for Linux, DEB Installer, 32-bit
  • For 64-bit systems download: 
    J-Link Software and Documentation pack for Linux, DEB Installer, 64-bit

Once you have the file on your system, install the package via dpkg as follows (varying the file for the version of architecture you are using):

$ sudo dpkg -i JLink_Linux_V618a_x86_64.deb
Selecting previously unselected package jlink.
(Reading database ... 175450 files and directories currently installed.)
Preparing to unpack JLink_Linux_V618a_x86_64.deb ...
Removing /opt/SEGGER/JLink ...
/opt/SEGGER/JLink not found (OK)
Unpacking jlink (6.18.1) ...
Setting up jlink (6.18.1) ...

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:

$ sudo apt-get install minicom

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

$ sudo minicom -D /dev/ttyUSB0
Last updated on 2017-08-18 at 04.44.59 AM Published on 2017-08-18 at 03.37.04 PM