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: https://mynewt.apache.org/latest/newt/install/newt_linux.html

In summary, copy following commands and paste it (one line each time) into your terminal to add newt's public key and deb package to your apt repository for installation.

$ wget -qO - https://raw.githubusercontent.com/JuulLabs-OSS/debian-mynewt/master/mynewt.gpg.key | sudo apt-key add -
$ sudo tee /etc/apt/sources.list.d/mynewt.list <<EOF
deb https://raw.githubusercontent.com/JuulLabs-OSS/debian-mynewt/master latest main
EOF
$ sudo apt-get update
$ sudo apt-get install newt
$ sudo apt-get install newtmgr

Check your installation with version command

$ newt version
Apache Newt version: 1.5.0
$ newtmgr version
Apache Newtmgr 1.5.0

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:

$ sudo apt-get install openocd

Once it is installed, you can check and make sure you have at least v 0.10.0 which support nRF52 chip

$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

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

This guide was first published on Aug 18, 2017. It was last updated on Aug 18, 2017.

This page (Native Installation (Linux)) was last updated on Aug 17, 2017.

Text editor powered by tinymce.