newt is a build and project management tool that hides most of the messy details of creating, building and debugging mynewt projects. With newt, you don't need to worry about makefiles, compiler flags, debug config settings, and library versions or updates. The details are elegantly hidden behind the easy to use 'newt' wrapper.

For full details on newt and the entire command set see the official newt documentation.

Installing newt

For details on installing the newt tool on your operating system of choice see:

Common newt Commands

Please consult the official newt documentation for details on every command, but the most commonly used commands are detailed below:

newt build <target_name>

This command will build a firmware image for the specified target name, and will handle things like the makefile generation and any compiler parameters and file inclusions required by the target.

Full documentation:

$ newt build first
Building target targets/first
Target successfully built: targets/first

newt create-image <target_name> <version>

This command assigns a version number to the image, and can also be used to optionally cryptographically sign images with an appropriate .pem key file.

Full documentation:

$ newt create-image first 1.2.3
App image succesfully generated: [PATH]/bin/targets/first/app/apps/first/first.img

newt load <target_name>

This command will use a Segger J-Link (if you have one connected) to flash the version controlled .img file to the device.

Make sure you run 'newt create-image' on the firmware image before loading it to the device, or the firmware will be rejected by the bootloader which verifies all firmware at startup!
$ newt load first
Loading app image into slot 1

newt size <target_name>

This command will give you detailed information on the flash and SRAM usage of your firmware, and can be helpful when debugging or when tight on space.

Full documentation:

$ newt size first
Size of Application Image: app
  FLASH     RAM 
     59     246 *fill*
     32       0 apps_first.a
   1404     104 boot_bootutil.a
    426      26 boot_split.a
   1236       0 crypto_mbedtls.a
    492       0 encoding_base64.a
   1228       0 encoding_cborattr.a
   2912       0 encoding_tinycbor.a
    540     496 hw_bsp_ada_feather_nrf52.a
     64       0 hw_cmsis-core.a
    256       0 hw_drivers_uart_uart_hal.a
    392       0 hw_hal.a
   3744      72 hw_mcu_nordic_nrf52xxx.a
   7316    8233 kernel_os.a
   2856      44 libc_baselibc.a
   2416      24 mgmt_imgmgr.a
    220      20 mgmt_mgmt.a
    884     100 mgmt_newtmgr.a
   1401      44 mgmt_newtmgr_nmgr_os.a
    136      32 mgmt_newtmgr_transport_nmgr_shell.a
   1791      37 sys_config.a
   2203     100 sys_console_full.a
    544     128 sys_flash_map.a
   3171      90 sys_log_full.a
    408      12 sys_mfg.a
    752      76 sys_reboot.a
   5324     774 sys_shell.a
   1385      73 sys_stats_full.a
     32       5 sys_sysinit.a
   1676       0 time_datetime.a
    556       0 util_crc.a
    124       0 util_mem.a
    128       0 first-sysinit-app.a
   1492       0 libgcc.a

   text	   data	    bss	    dec	    hex	filename
  47568	    316	  10020	  57904	   e230	[PATH]/bin/targets/first/app/apps/first/first.elf

newt target show

This will give you a list of all targets defined in your project, and some basic details about them.

Full documentation:

$ newt target show
    [email protected]/hw/bsp/ada_feather_nrf52
    [email protected]/hw/bsp/native
Last updated on 2017-09-18 at 01.06.26 PM Published on 2017-08-18 at 03.37.04 PM