Newt Manager

Newt Manager (newtmgr) is the application tool that enables a user to communicate with and manage remote instances of Mynewt OS.

Description

Command List

Available high-level commands

    help        Lists commands and flags available 
    conn        Manage newtmgr connection profiles
    echo        Send data to remote endpoint using newtmgr, and receive data back
    image       Manage images on remote instance
    stat        Read statistics from a remote endpoint
    taskstats   Read statistics from a remote endpoint
    mpstats     Read statistics from a remote endpoint
    config      Read or write config value on target

Available Flags

  -c, --connection string       connection profile to use.
  -l, --loglevel string   log level to use (default WARN.)

Examples

Sub-commandUsageExplanation
newtmgr -caditi03 taskstats

help

Usage:

    newtmgr help [input1]

You can also use “newtmgr [command] --help” to display the help text for a newtmgr command.

Flags:

  -c, --connection string      connection profile to use.
  -l, --loglevel string   log level to use (default WARN.)

Examples

Sub-commandAvailable FlagsExplanation
taskstatsnewtmgr -cprofile1 taskstatsRun the taskstats subcommand on the device connected via the ‘profile1’ connection

conn

Usage:

    newtmgr conn [flags]
    newtmgr conn [command]

Available commands:

    add         Add a newtmgr connection profile
    delete      Delete a newtmgr connection profile
    show        Show newtmgr connection profiles

Flags:

  -c, --conn string       connection profile to use.
  -l, --loglevel string   log level to use (default WARN.)

Description

Sub-commandExplanation
addAdds a connection profile. A properly defined profile needs a name, a connection type, and the physical or virtual port to be used for communication.
deleteDeletes a connection profile associated with the given name
showList the specified or all the connection profiles with the name, connection type, and the controlling terminal or port.

Examples

Sub-commandUsageExplanation
addnewtmgr conn add myserial02 type=serial connstring=/dev/ttys002Adds a newtmgr connection profile for the serial port /dev/ttys002 and names it ‘myserial02’
deletenewtmgr conn delete myserial02Deletes the connection profile named ‘myserial02’
shownewtmgr conn show myserial01Shows the details of the profile named ‘myserial01’
shownewtmgr conn showShows all the current profiles defined

echo

Usage:

    newtmgr echo [flags] [text]

This command sends the text to the remote device at the other end of the connection specified with the -c flag and outputs the text when it gets a response from the device. If the device is not responding or if the connection profile is invalid it displays errors.

Flags:

  -c, --conn string       connection profile to use.
  -l, --loglevel string   log level to use (default WARN.)

Examples

Sub-commandUsageExplanation
echonewtmgr echo -c profile01 helloSends the string ‘hello’ to the remote device over the connection profile ‘profile01’ and receives the string back and displays it.

image

Usage:

  newtmgr image [flags]
  newtmgr image [command]

Available commands:

    list         Show target images
    upload       Upload image to target
    boot         Which image to boot
    fileupload   Upload file to target
    filedownload Download file from target

Flags:

  -c, --conn string       connection profile to use.
  -l, --loglevel string   log level to use (default WARN.)

Description

Sub-commandExplanation
listAdds a connection profile. A properly defined profile needs a name, a connection type, and the physical or virtual port to be used for communication.
uploadDeletes a connection profile associated with the given name
bootSpecify the image to boot
fileuploadupload file to the remote target
filedownloaddownload/retrieve file from remote target

Examples

Sub-commandUsageExplanation
listnewtmgr list
uploadnewtmgr upload
bootnewtmgr boot
fileuploadnewtmgr fileupload
filedownloadnewtmgr filedownload

stat

Usage:

  newtmgr stat [flags]
  newtmgr stat [command]

Flags:

  -c, --conn string       connection profile to use.
  -l, --loglevel string   log level to use (default WARN.)

Examples

Sub-commandUsageExplanation
statnewtmgr stat

taskstats

Usage:

  newtmgr taskstats [flags]
  newtmgr taskstats [command]

Lists all the tasks running on the remote endpoint at the end of the specified connection and for each task lists statistics such as priority, task id, runtime (how long the task has been running in ms), context switch count, stack size allocated, actual stack usage, last sanity checkin, next sanity check-in.

Flags:

  -c, --conn string       connection profile to use.
  -l, --loglevel string   log level to use (default WARN.)

Examples

Sub-commandUsageExplanation
statnewtmgr taskstats -c profile01Lists all the tasks running on the remote device at the end of connection named ‘profile01’

Example output

$ newtmgr  -c profile01 taskstats
Return Code = 0
  idle (prio=255 tid=0 runtime=3299340 cswcnt=280342 stksize=1024 stkusage=1000 last_checkin=0 next_checkin=0)
  os_sanity (prio=254 tid=1 runtime=0 cswcnt=3287 stksize=1024 stkusage=1000 last_checkin=0 next_checkin=0)
  shell (prio=3 tid=2 runtime=0 cswcnt=165 stksize=1024 stkusage=1000 last_checkin=0 next_checkin=0)
  uart_poller (prio=0 tid=3 runtime=0 cswcnt=279368 stksize=1024 stkusage=1000 last_checkin=0 next_checkin=0)
  newtmgr (prio=4 tid=4 runtime=0 cswcnt=14 stksize=1024 stkusage=1000 last_checkin=0 next_checkin=0)
  task1 (prio=1 tid=5 runtime=0 cswcnt=3287 stksize=1024 stkusage=1000 last_checkin=0 next_checkin=0)
  task2 (prio=2 tid=6 runtime=0 cswcnt=3287 stksize=1024 stkusage=1000 last_checkin=0 next_checkin=0)