Skip to content

toitoinou/pinetime-rust-mynewt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PineTime Smart Watch Firmware with Apache Mynewt and Embedded Rust

PineTime Smart Watch with Apache Mynewt and Embedded Rust

This master branch of pinetime-rust-mynewt contains the firmware source code for PineTime Smart Watch with...

  1. Apache Mynewt 1.7, Apache NimBLE 1.2 and Embedded Rust (nightly build)

  2. MCUBoot Bootloader 1.5

pinetime-rust-mynewt is an Educational Embedded OS that supports...

  1. Wireless Firmware Updates over Bluetooth LE, based on MCU Manager's Simple Management Protocol

  2. LVGL UI Library Version 7, based on pinetime_lvgl_mynewt

  3. Time Sync with Bluetooth LE Current Time Service

  4. Rust Watch Faces from crates.io

This branch no longer supports druid, embedded-graphics and Visual Rust. Check out the older version in the pre-lvgl branch.

Refer to the articles...

  1. PineTime doesn't run Linux... But that's OK!

  2. Draw your own PineTime Watch Face... From WebAssembly to Embedded Rust

  3. Create Your Own PineTime Watch Face in Rust... And Publish on crates.io

  4. Bluetooth Time Sync and LVGL on PineTime Mynewt

  5. Firmware Update over Bluetooth Low Energy on PineTime Smart Watch

  6. Configure Mynewt for SPI Flash on PineTime Smart Watch (nRF52)

  7. MCUBoot Bootloader for PineTime Smart Watch (nRF52)

  8. Wireless Firmware Update In Action on PineTime Smart Watch (nRF52)

  9. Your First Bluetooth Low Energy App with Flutter

  10. Convert Go to Flutter and Dart for PineTime Companion App

  11. Your First GTK App with Go and VSCodium

  12. Flutter State Management with Bloc for PineTime Companion App

  13. Auto Convert Go to Dart with an Abstract Syntax Tree

  14. My First Week As Embedded FOSS Advocate

  15. Rust Documentation

The following articles were written for the older version of this firmware. Refer to the pre-lvgl branch for the source code...

  1. Visual Rust for PineTime Smart Watch

  2. Build and Flash Rust+Mynewt Firmware for PineTime Smart Watch

  3. Debug Rust+Mynewt Firmware for PineTime on Raspberry Pi

  4. Sneak Peek of PineTime Smart Watch… And why it's perfect for teaching IoT

  5. Building a Rust Driver for PineTime’s Touch Controller

  6. Porting [druid] Rust Widgets to PineTime Smart Watch

  7. Optimising PineTime’s Display Driver with Rust and Mynewt

  8. OpenOCD on Raspberry Pi: Better with SWD on SPI

  9. CHIP-8 Game Emulator in Rust for PineTime Smart Watch

  10. Porting MicroPython and wasp-os to Mynewt on PineTime Smart Watch (nRF52)

The firmware design is similar to this earlier article on nRF52...

Coding nRF52 with Rust and Apache Mynewt on Visual Studio Code

More Articles

RSS Feed

Automated Build with GitHub Actions

The MCUBoot Bootloader and Rust + Mynewt Firmware are built automatically in the GitHub Cloud.

Just fork this repo, update the source code and the built firmware will be available for download under "Actions".

The Automated Build is performed according to the following GitHub Actions Workflow...

.github/workflows/main.yml

The Worklow is similar to the one described in this article...

Build PineTime Firmware in the Cloud with GitHub Actions

Automated Build with GitLab CI

The MCUBoot Bootloader and Rust + Mynewt Firmware are also built automatically with GitLab CI.

This repo is mirrored to GitLab as...

gitlab.com/lupyuen/pinetime-rust-mynewt

The GitLab CI Workflow is at .gitlab-ci.yml

Build Instructions

If you are building from this repository from scratch instead of the Released Packages, here are the steps for Linux (x64, Arm32 and Arm64, including Raspberry Pi), macOS and Windows (no need for WSL, MinGW and Docker)...

Install Build Tools

  1. Download and extract xPack OpenOCD. Other versions of OpenOCD are known to have problems flashing with ST-Link.

    For Linux with ST-Link (not Raspberry Pi): Download and extract xPack OpenOCD from above. Then install the ST-Link driver as follows...

    #  For Linux Only: Install UDEV Rules according to https://xpack.github.io/openocd/install/#udev
    if [ -d /etc/udev/rules.d ]; then
        sudo cp xpack-openocd/contrib/60-openocd.rules /etc/udev/rules.d/
        sudo udevadm control --reload-rules
    fi

    For Windows: Download and extract xPack OpenOCD from above. Then install the ST-Link v2 Driver for Windows...

    • Download the ST-Link USB driver from ST-Link Driver Website (email registration required)

    • Click Get Software

    • Unzip the downloaded file. Double-click the driver installer: dpinst_amd64.exe

    For Raspberry Pi: Install openocd-spi according to the instructions here...

    "OpenOCD on Raspberry Pi: Better with SWD on SPI"

  2. Download the Arm Embedded Toolchain 9-2020-q2-update. Other versions of the toolchain are known to have problems building the firmware.

    For Linux and macOS: Unzip the toolchain and add it to your PATH

    For Windows: Run the installer and check the option for Add to PATH

  3. Install rustup with support for nightly target thumbv7em-none-eabihf.

    Follow the instructions at https://rustup.rs/

    Press Enter to select 1) Proceed with installation (default)

    For Linux and macOS: Open a command prompt and enter...

    source $HOME/.cargo/env
    rustup update
    rustup default nightly
    rustup target add thumbv7em-none-eabihf

    For Windows: Enter the above commands in a Windows Command Prompt (not WSL Terminal). Omit the source line.

  4. For Linux and macOS: Install the newt build tool for Mynewt. Refer to these scripts...

    For Windows: The newt tool has been prebuilt at pinetime-rust-mynewt/newt/newt.exe

Download Source Files

  1. Download the source files to ~/pinetime...

    For Linux and macOS:

    mkdir ~/pinetime
    cd ~/pinetime
    git clone --recursive https://github.com/lupyuen/pinetime-rust-mynewt

    For Windows:

    cd \
    mkdir pinetime
    cd pinetime
    git clone --recursive https://github.com/lupyuen/pinetime-rust-mynewt
  2. Update the MCUBoot version number to 1.3.1. Edit pinetime/pinetime-rust-mynewt/project.yml

    Change...

    repository.mcuboot:
        type: github
        vers: 1.5.0

    to...

    repository.mcuboot:
        type: github
        vers: 1.3.1
  3. Download the source code for Mynewt, NimBLE and MCUBoot...

    For Linux and macOS:

    cd ~/pinetime/pinetime-rust-mynewt
    newt install

    We should see...

    Downloading repository mynewt-core (commit: master) from https://github.com/apache/mynewt-core.git
    Downloading repository mynewt-mcumgr (commit: master) from https://github.com/apache/mynewt-mcumgr.git
    Downloading repository mynewt-nimble (commit: master) from https://github.com/apache/mynewt-nimble.git
    Downloading repository mcuboot (commit: master) from https://github.com/JuulLabs-OSS/mcuboot.git
    Making the following changes to the project:
        install apache-mynewt-core (1.7.0)
        install apache-mynewt-nimble (1.2.0)
        install mcuboot (1.3.1)
    apache-mynewt-core successfully installed version 1.7.0
    apache-mynewt-nimble successfully installed version 1.2.0
    Error: Error updating "mcuboot": error: The following untracked working tree files would be overwritten by checkout:
            ext/mbedtls/include/mbedtls/check_config.h
            ext/mbedtls/include/mbedtls/config.h
    Please move or remove them before you switch branches.
    Aborting
    

    Ignore the mcuboot error above and proceed to the next step.

    For Windows:

    cd \pinetime\pinetime-rust-mynewt
    mkdir repos
    xcopy /s patch\repos-windows repos
    cd repos
    git clone --recursive --branch mynewt_1_7_0_tag https://github.com/apache/mynewt-core.git apache-mynewt-core
    git clone --recursive --branch nimble_1_2_0_tag https://github.com/apache/mynewt-nimble.git apache-mynewt-nimble
  4. Restore the MCUBoot version number to 1.5.0. Edit pinetime/pinetime-rust-mynewt/project.yml

    Change...

    repository.mcuboot:
        type: github
        vers: 1.3.1

    to...

    repository.mcuboot:
        type: github
        vers: 1.5.0
  5. Download version 1.5.0 of MCUBoot to repos/mcuboot

    For Linux and macOS:

    cd ~/pinetime/pinetime-rust-mynewt/repos
    rm -rf mcuboot
    git clone --recursive --branch v1.5.0 https://github.com/JuulLabs-OSS/mcuboot

    For Windows:

    cd \pinetime\pinetime-rust-mynewt\repos
    git clone --recursive --branch v1.5.0 https://github.com/JuulLabs-OSS/mcuboot

    Why are we doing this? Because we are using a more recent version of MCUBoot (1.5.0), but that's not in sync with the older Mynewt version (1.7.0). This will cause newt install to fail. Hence we do this workaround to force Mynewt to build with the newer MCUBoot.

  6. Copy the unzipped OpenOCD from xPack OpenOCD or openocd-spi to the folder...

    pinetime/pinetime-rust-mynewt/openocd
    

    The openocd executable should be located at pinetime/pinetime-rust-mynewt/openocd/bin/openocd

Build MCUBoot Bootloader

Build the MCUBoot Bootloader...

For Linux and macOS:

cd ~/pinetime/pinetime-rust-mynewt
scripts/nrf52/build-boot.sh

For Windows:

cd \pinetime\pinetime-rust-mynewt
scripts\nrf52\build-boot.cmd

We should see...

Linking pinetime/pinetime-rust-mynewt/pinetime-rust-mynewt/bin/targets/nrf52_boot/app/boot/mynewt/mynewt.elf
Target successfully built: targets/nrf52_boot
+ newt size -v nrf52_boot
Size of Application Image: app
Mem FLASH: 0x0-0x7000
Mem RAM: 0x20000000-0x20010000
  FLASH     RAM 
     97     230 *fill*
    756       0 libgcc.a
   6959    5996 boot_bootutil.a
    124       0 boot_mynewt.a
     18       0 boot_mynewt_flash_map_backend.a
   1182       0 crypto_mbedtls.a
    392     444 hw_bsp_nrf52.a
     52       0 hw_cmsis-core.a
   1280      80 hw_drivers_flash_spiflash.a
    654       1 hw_hal.a
   4236      72 hw_mcu_nordic_nrf52xxx.a
   1570   18772 kernel_os.a
   2138      12 libc_baselibc.a
   2049     260 libs_pinetime_boot.a
    297      39 libs_semihosting_console.a
    796     128 sys_flash_map.a
      2       0 sys_log_modlog.a
    632      29 sys_mfg.a
     30       5 sys_sysinit.a
     48       0 util_mem.a
    100       0 nrf52_boot-sysinit-app.a
Loading compiler pinetime/pinetime-rust-mynewt/pinetime-rust-mynewt/repos/apache-mynewt-core/compiler/arm-none-eabi-m4, buildProfile debug

objsize
   text	   data	    bss	    dec	    hex	filename
  23220	    136	  25500	  48856	   bed8	pinetime/pinetime-rust-mynewt/pinetime-rust-mynewt/bin/targets/nrf52_boot/app/boot/mynewt/mynewt.elf

This produces the MCUBoot Bootloader that we will flash to PineTime later...

pinetime/pinetime-rust-mynewt/bin/targets/nrf52_boot/app/boot/mynewt/mynewt.bin

Build Application Firmware

  1. Build the Application Firmware...

    For Linux and macOS:

    cd ~/pinetime/pinetime-rust-mynewt
    scripts/build-app.sh

    For Windows:

    cd \pinetime\pinetime-rust-mynewt
    scripts\build-app.cmd

    If we see the error...

    pinetime/pinetime-rust-mynewt/repos/apache-mynewt-core/libc/baselibc/src/start.c:39:
    undefined reference to `main'
    

    Run build-app again. It should fix the error.

    When the Application Firmware build succeds, we should see...

    Linking pinetime/pinetime-rust-mynewt/pinetime-rust-mynewt/bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.elf
    Target successfully built: targets/nrf52_my_sensor
    + newt size -v nrf52_my_sensor
    Warning: 6 02:26:22.562 [WARNING] Transient package @apache-mynewt-core/mgmt/newtmgr/transport/ble used, update configuration to use linked package instead (@apache-mynewt-core/mgmt/smp/transport/ble)
    Warning: 6 02:26:22.562 [WARNING] Transient package @apache-mynewt-core/mgmt/newtmgr used, update configuration to use linked package instead (@apache-mynewt-core/mgmt/smp)
    Size of Application Image: app
    Mem FLASH: 0x8000-0x7bc00
    Mem RAM: 0x20000000-0x20010000
      FLASH     RAM 
        655     368 *fill*
       4829    2414 apps_my_sensor_app.a
        962       4 boot_bootutil.a
        181      38 boot_split.a
       1814       0 cborattr.a
       2371      72 cmd_img_mgmt.a
       1113       0 cmd_img_mgmt_port_mynewt.a
        723      12 cmd_os_mgmt.a
        222      32 cmd_os_mgmt_port_mynewt.a
       2408       0 crypto_tinycrypt.a
        619       0 encoding_base64.a
       3162       0 encoding_tinycbor.a
        452     444 hw_bsp_nrf52.a
         52       0 hw_cmsis-core.a
       1530      92 hw_drivers_flash_spiflash.a
        706       1 hw_hal.a
       5992      89 hw_mcu_nordic_nrf52xxx.a
          2       0 hw_sensor_creator.a
       1266     256 hw_sensor.a
       9098   27505 kernel_os.a
       3302      50 libc_baselibc.a
         16       0 libs_mynewt_rust.a
     161547    9868 libs_pinetime_lvgl_mynewt.a
      33248     105 libs_rust_app.a
        405      39 libs_semihosting_console.a
        737     212 libs_temp_stub.a
        376      12 mgmt_imgmgr.a
        413      12 mgmt.a
        490       4 mgmt_smp.a
        486     126 mgmt_smp_transport_ble.a
      35492    2152 nimble_controller.a
       4150    1203 nimble_drivers_nrf52.a
      44674    2713 nimble_host.a
        874     218 nimble_host_services_ans.a
        277     112 nimble_host_services_dis.a
        468     118 nimble_host_services_gap.a
        252      62 nimble_host_services_gatt.a
       1818     652 nimble_host_store_config.a
        108       0 nimble_host_util.a
        788    1096 nimble_transport_ram.a
        776       0 smp.a
       1357      42 sys_config.a
        794     128 sys_flash_map.a
          2       0 sys_log_modlog.a
        668      29 sys_mfg.a
       1395      67 sys_reboot.a
         30       5 sys_sysinit.a
       1200       0 time_datetime.a
        120       0 util_mem.a
        500       0 util_scfg.a
        124       0 util.a
        180       0 nrf52_my_sensor-sysinit-app.a
    Loading compiler pinetime/pinetime-rust-mynewt/pinetime-rust-mynewt/repos/apache-mynewt-core/compiler/arm-none-eabi-m4, buildProfile debug
    
    objsize
       text	   data	    bss	    dec	    hex	filename
     335072	   1132	  48820	 385024	  5e000	pinetime/pinetime-rust-mynewt/pinetime-rust-mynewt/bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.elf
    
  2. Create the application firmware image...

    For Linux and macOS:

    cd ~/pinetime/pinetime-rust-mynewt
    scripts/nrf52/image-app.sh

    For Windows:

    cd \pinetime\pinetime-rust-mynewt
    scripts\nrf52\image-app.cmd

    We should see...

    App image successfully generated: 
    pinetime/pinetime-rust-mynewt/bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.img
    
  3. This produces the application firmware image that we will flash to PineTime later...

    pinetime/pinetime-rust-mynewt/bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.img
    

Select the OpenOCD Interface: ST-Link or Raspberry Pi SPI

Edit pinetime/pinetime-rust-mynewt/scripts/config.sh

If we're using ST-Link v2 for flashing PineTime, set swd_device as follows...

#  Select ST-Link v2 as SWD Programmer
swd_device=scripts/nrf52/swd-stlink.ocd

If we're using Raspberry Pi SPI for flashing PineTime, set swd_device as follows...

#  Select Raspberry Pi as SWD Programmer
swd_device=scripts/nrf52-pi/swd-pi.ocd

For Windows: We don't need to edit config.sh

Flash MCUBoot Bootloader

  1. For Linux and macOS: Edit pinetime/pinetime-rust-mynewt/scripts/nrf52/flash-boot.sh

    For Windows: Edit pinetime/pinetime-rust-mynewt/scripts/nrf52/flash-boot.cmd

  2. Change openocd/bin/openocd to the path of our installed openocd (for ST-Link) or openocd-spi (for Raspberry Pi)...

    #  Flash the device
    openocd/bin/openocd \
        -f $swd_device \
        -f scripts/nrf52/flash-boot.ocd
  3. The path of the built firmware file is defined in pinetime/pinetime-rust-mynewt/scripts/nrf52/flash-boot.ocd. We shouldn't need to change this.

    # For MCUBoot (debugging not supported):
    program bin/targets/nrf52_boot/app/boot/mynewt/mynewt.elf.bin verify 0x00000000
    
  4. Flash the bootloader...

    For Linux and macOS:

    cd ~/pinetime/pinetime-rust-mynewt
    scripts/nrf52/flash-boot.sh

    For Windows:

    cd \pinetime\pinetime-rust-mynewt
    scripts\nrf52\flash-boot.cmd
  5. We should see...

    > Executing task in folder pinetime-rust-mynewt: bash -c -l ' scripts/nrf52/flash-boot.sh && echo ✅ ◾ ️Done! ' <
    
    + source scripts/config.sh
    ++ swd_device=scripts/nrf52/swd-stlink.ocd
    + openocd/bin/openocd -f scripts/nrf52/swd-stlink.ocd -f scripts/nrf52/flash-boot.ocd
    GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-15-13:49)
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    debug_level: 0
    adapter speed: 1000 kHz
    force hard breakpoints
    Stopping...
    target halted due to breakpoint, current mode: Thread 
    xPSR: 0x21000000 pc: 0x000023a4 msp: 0x2000ff9c
    
    Flashing Bootloader...
    target halted due to debug-request, current mode: Thread 
    xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000
    Enabled ARM Semihosting to show debug output
    semihosting is enabled
    ** Programming Started **
    auto erase enabled
    target halted due to breakpoint, current mode: Thread 
    xPSR: 0x61000000 pc: 0x2000001e msp: 0x20010000, semihosting
    wrote 24576 bytes from file bin/targets/nrf52_boot/app/boot/mynewt/mynewt.elf.bin in 0.729124s (32.916 KiB/s)
    ** Programming Finished **
    ** Verify Started **
    target halted due to breakpoint, current mode: Thread 
    xPSR: 0x61000000 pc: 0x2000002e msp: 0x20010000, semihosting
    verified 22876 bytes in 0.114145s (195.715 KiB/s)
    ** Verified OK **
    
    Restarting...
    target halted due to debug-request, current mode: Thread 
    xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000, semihosting
    
    **** Done!
    
  6. For ST-Link, check that the Adapter Speed is set to 1000 kHz. OpenOCD won't work at higher speeds.

    adapter speed: 1000 kHz
    
  7. If the flashing fails, check whether any openocd processes are running in the background, and kill them.

Flash Application Firmware

  1. For Linux and macOS: Edit pinetime/pinetime-rust-mynewt/scripts/nrf52/flash-app.sh

    For Windows: Edit pinetime/pinetime-rust-mynewt/scripts/nrf52/flash-app.cmd

  2. Change openocd/bin/openocd to the path of our installed openocd (for ST-Link) or openocd-spi (for Raspberry Pi)...

    #  Flash the device
    openocd/bin/openocd \
        -f $swd_device \
        -f scripts/nrf52/flash-app.ocd
  3. The path of the built firmware file is defined in pinetime/pinetime-rust-mynewt/scripts/nrf52/flash-app.ocd. We shouldn't need to change this.

    program bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.img verify 0x00008000
    
  4. Flash the application...

    For Linux and macOS:

    cd ~/pinetime/pinetime-rust-mynewt
    scripts/nrf52/flash-app.sh

    For Windows:

    cd \pinetime\pinetime-rust-mynewt
    scripts\nrf52\flash-app.cmd
  5. We should see...

    > Executing task in folder pinetime-rust-mynewt: bash -c -l ' scripts/nrf52/flash-app.sh && echo ✅ ◾ ️Done! ' <
    
    + source scripts/config.sh
    ++ swd_device=scripts/nrf52/swd-stlink.ocd
    + openocd/bin/openocd -f scripts/nrf52/swd-stlink.ocd -f scripts/nrf52/flash-app.ocd
    GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-15-13:49)
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    debug_level: 0
    adapter speed: 1000 kHz
    force hard breakpoints
    Stopping...
    target halted due to debug-request, current mode: Thread 
    xPSR: 0x61000000 pc: 0x000001ca msp: 0x2000ffd8
    
    Flashing Application...
    target halted due to debug-request, current mode: Thread 
    xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000
    Enabled ARM Semihosting to show debug output
    semihosting is enabled
    ** Programming Started **
    auto erase enabled
    target halted due to breakpoint, current mode: Thread 
    xPSR: 0x61000000 pc: 0x2000001e msp: 0x20010000, semihosting
    wrote 143360 bytes from file bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.img in 3.606276s (38.821 KiB/s)
    ** Programming Finished **
    ** Verify Started **
    target halted due to breakpoint, current mode: Thread 
    xPSR: 0x61000000 pc: 0x2000002e msp: 0x20010000, semihosting
    verified 139268 bytes in 0.363909s (373.731 KiB/s)
    ** Verified OK **
    
  6. For ST-Link, check that the Adapter Speed is set to 1000 kHz. OpenOCD won't work at higher speeds.

    adapter speed: 1000 kHz
    
  7. If the flashing fails, check whether any openocd processes are running in the background, and kill them.

  8. PineTime reboots (with the reset init OpenOCD Command)...

    Restarting...
    target halted due to debug-request, current mode: Thread 
    xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000, semihosting
    Enabled ARM Semihosting to show debug output
    semihosting is enabled
    
  9. PineTime starts MCUBoot Bootloader...

    **** Done! Press Ctrl-C to exit...
    Starting Bootloader...
    Displaying image...
    Image displayed
    Check button: 0
    [INF] Primary image: magic=good, swap_type=0x4, copy_done=0x1, image_ok=0x1
    [INF] Scratch: magic=bad, swap_type=0x1, copy_done=0x2, image_ok=0x2
    [INF] Boot source: none
    [INF] Swap type: none
    Waiting 5 seconds for button...
    Waited for button: 0
    Bootloader done
    
  10. Finally PineTime starts the Application Firmware...

    TMP create temp_stub_0
    NET hwid 4a f8 cf 95 6a be c1 f6 89 ba 12 1a 
    NET standalone node 
    

Logging of debug messages is disabled by default. To enable debug logging, see the section "Semihosting Logging" below.

PineTime Updater

Alternatively (for Linux and macOS only), flash the following two files to PineTime with PineTime Updater...

  1. MCUBoot Bootloader

    File: bin/targets/nrf52_boot/app/boot/mynewt/mynewt.elf

    Address: 0x0

  2. Rust + Mynewt Firmware

    File: bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.elf

    Address: 0x8000

Remote PineTime

If you don't have a PineTime, try flashing and testing on Remote PineTime instead. Remote PineTime is a real PineTime watch that's connected 24x7 to the internet... For anyone to flash and test firmware from anywhere in the world.

Upload the built firmware file my_sensor_app.img as a GitHub Release and flash to Remote PineTime...

  1. In you GitHub repo, click Releases

  2. Click Draft A New Release

  3. Fill in the Tag Version and Release Title

  4. Attach the firmware file my_sensor_app.img

  5. Click Publish Release

  6. Under Assets, copy the URL of the firmware file my_sensor_app.img

  7. Follow the steps here to flash the MCUBoot Bootloader and our firmware URL to Remote PineTime...

    Remote PineTime

Installation, Build, Flash and Debug Logs

Sample logs for Linux, macOS and Windows may be found in the logs folder

Also check the GitHub Actions build logs

Semihosting Logging

Logging of debug messages is disabled by default. To enable Semihosting Logging, comment out this line (by inserting # at the start of the line)...

- -DDISABLE_SEMIHOSTING  #  Uncomment to disable Arm Semihosting. Must be uncommented for production.

For Bootloader: targets/nrf52_boot/pkg.yml

For Application Firmware: targets/nrf52_my_sensor/pkg.yml

Rebuild the Bootloader and Application Firmware and flash to PineTime. Debug messages will now appear in the OpenOCD log.

More about Arm Semihosting

VSCode Workspace

Open the workspace file workspace.code-workspace in VSCode.

The VSCode Workspace contains VSCode Tasks for building and flashing the Bootloader and Application Firmware.

The Cortex-Debug Debugger in VSCode has also been configured for debugging PineTime with GDB and OpenOCD.

Contents

This repository contains...

Library modules for Mynewt...

Legacy modules for Mynewt that are not used...

Packages

No packages published

Languages

  • Assembly 46.3%
  • C 41.1%
  • C++ 7.5%
  • Rust 4.5%
  • Shell 0.5%
  • HTML 0.1%