• Stars
    star
    210
  • Rank 187,585 (Top 4 %)
  • Language
    Assembly
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PineTime Smart Watch firmware based on Rust and Apache Mynewt OS

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
    mkdir repos
    cp -r patch/repos-windows/.configs 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

    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
    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.elf.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
    

    TODO: The bootloader has moved to a new location with the latest version of newt...

    bin/targets/nrf52_boot/app/@mcuboot/boot/mynewt/mynewt.elf
    
  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...

More Repositories

1

stm32-blue-pill-rust

Rust for STM32 Blue Pill with Visual Studio Code
Rust
106
star
2

stm32bluepill-mynewt-sensor

Apache Mynewt Sensor Network Application for STM32 Blue Pill and nRF52 with Visual Rust, NB-IoT, GPS, iBeacon, NimBLE, ESP8266 (WiFi Geolocation) and nRF24L01
C
100
star
3

visual-embedded-rust

Visual Embedded Rust extension for Visual Studio Code
TypeScript
83
star
4

pinephone-nuttx

Apache NuttX RTOS for PinePhone
Zig
79
star
5

lupyuen.github.io

Lup Yuen's Articles and Resume
HTML
68
star
6

pinetime-updater

Flash firmware to PineTime the friendly wired way with OpenOCD
Shell
64
star
7

pinetime-companion

Flutter Companion App for PineTime Smart Watch (Android and iOS)
Dart
56
star
8

flutter-blue-sample

Sample Flutter App with Bluetooth LE from flutter_blue
Dart
41
star
9

pinephone-emulator

Emulate PinePhone and Apache NuttX RTOS with Unicorn Emulator
Assembly
36
star
10

zig-bl602-nuttx

Zig on RISC-V BL602 with Apache NuttX RTOS and LoRaWAN
Zig
33
star
11

nuttx-ox64

Apache NuttX RTOS for Pine64 Ox64 64-bit RISC-V SBC (BouffaloLab BL808)
JavaScript
33
star
12

qfplib

ARM Cortex-M0 floating-point library in 1 kbyte. From http://www.quinapalus.com/qfplib.html
Assembly
26
star
13

remote-pinetime-bot

Telegram Bot to flash and test PineTime firmware remotely
Rust
25
star
14

nuttx-sg2000

Apache NuttX RTOS on 64-bit RISC-V Sophgo SG2000 (T-Head C906 / Milk-V Duo S)
25
star
15

send_altitude_cocoos

IoT program for Arduino Uno / STM32 Blue Pill (libopencm3) that reads BME280 temperature + humidity + altitude sensors, via I2C or SPI with DMA and multitasking. Sends sensor data to Sigfox via Wisol Sigfox module on UART. Runs on cocoOS task scheduling library http://www.cocoos.net
C++
24
star
16

nuttx-star64

Apache NuttX RTOS for Pine64 Star64 64-bit RISC-V SBC (StarFive JH7110)
C
23
star
17

LoRaArduino

Arduino code for connecting to LoRa IoT gateway at Temasek Polytechnic
C++
23
star
18

zig-pinephone-gui

Zig GUI App for PinePhone
Zig
21
star
19

AWSIOT

Raspberry Pi, Node.js and Python scripts for AWS IoT, used in Temasek Polytechnic Smart IoT Applications course
JavaScript
19
star
20

pinephone-lvgl-zig

LVGL for PinePhone (and WebAssembly) with Zig and Apache NuttX RTOS
Zig
18
star
21

nuttx-tinyemu

Apache NuttX RTOS in the Web Browser: TinyEMU with VirtIO
18
star
22

lora-sx1262

LoRa Driver for Semtech SX1262 on Apache NuttX OS, Linux (PineDio USB Adapter) and BL602 IoT SDK (PineDio Stack BL604)
C
17
star
23

bl602-rust-wrapper

Rust Wrapper for BL602 IoT SDK
Rust
16
star
24

pinephone-lora

Experimenting with LoRa Backplate for PinePhone
14
star
25

bl602-simulator

BL602 / BL604 Simulator in WebAssembly
Shell
14
star
26

pinetime-watchface

Watch Face Framework for Rust + Mynewt on PineTime Smart Watch
Rust
14
star
27

pi-swd-spi

Implementation of SWD protocol with Raspberry Pi Bidirectional SPI
C
13
star
28

stm32bluepill-unittest

Unit test for STM32 Blue Pill. Based on PlatformIO, libopencm3, unity and Qemu
C
13
star
29

newlib

Smaller standard C libraries for embedded platforms. Based on https://keithp.com/cgit/newlib.git
C
13
star
30

barebones-watchface

Barebones Watch Face for Rust + Mynewt on PineTime Smart Watch
Rust
13
star
31

hynitron_i2c_cst0xxse

Reference code for Hynitron CST816S Touch Controller
C
13
star
32

nuttx-embedded-hal

Rust Embedded HAL for Apache NuttX RTOS
Rust
11
star
33

pinecone-rust-mynewt

Mynewt + Rust for PineCone BL602 RISC-V Board
C
11
star
34

cst816s-nuttx

Hynitron CST816S Touch Controller Driver for Apache NuttX RTOS
C
11
star
35

iot-mission

"My 5-Year IoT Mission" presentation at Hackware 3 Dec 2019
10
star
36

zig-lvgl-nuttx

Zig LVGL Touchscreen App on Apache NuttX RTOS
Zig
10
star
37

rust-nuttx

Rust Stub Library for Apache NuttX OS
Makefile
9
star
38

gowin-blink

Blink demo for GOWIN FPGA dev kit DK-START-GW1N4
Forth
9
star
39

rust_test

Rust Test App for Apache NuttX OS
Rust
8
star
40

rust-i2c-nuttx

Rust talks I2C to Bosch BME280 Sensor on Apache NuttX RTOS
Rust
8
star
41

fpga_oled_ssd1306

FPGA controller for SSD1306 OLED module on SPI. Optimised for GOWIN FPGA
Forth
8
star
42

pinetime-logo-loader

Load a Custom Boot Logo to PineTime Smart Watch
Assembly
8
star
43

roblox-the-things-network

IoT Digital Twin with Roblox and The Things Network
Lua
8
star
44

visual-zig-nuttx

Visual Programming for Zig with NuttX Sensors
Zig
8
star
45

bl602-eflash-loader

BL602 EFlash Loader decompiled with Ghidra
C
7
star
46

stm32bluepill-math-hack

Math hack for STM32 Blue Pill. Based on PlatformIO and libopencm3
C++
7
star
47

RaspberryPiImage

This is the Raspberry Pi image for the Temasek Polytechnic Smart IoT Applications course
Python
7
star
48

pinedio-stack-nuttx

PineDio Stack BL604 RISC-V Board on Apache NuttX RTOS
6
star
49

hrs3300_sprd

Reference code for TianYiHeXin HRS3300 Heart Rate Sensor
C
6
star
50

stm32bluepill-blink

Blink sample for STM32 Blue Pill. Based on PlatformIO and libopencm3
C
5
star
51

NB-EK-L476

Uploaded Source Code for Ghostyu IOT++ NB-EK-L476 NB-IoT development kit http://www.iotxx.com
C
5
star
52

fpga_led_tm1637

Verilog code to support TM1637 LED for FPGA. Optimised for Gowin FPGA.
Forth
5
star
53

pinephone-mir

Experiments with Wayland and Mir display server on PinePhone with Ubuntu Touch
C
5
star
54

wisblock-lora-receiver

Receive LoRa messages with RAKwireless WisBlock
C++
5
star
55

remote-bl602

Flash and test BL602 remotely via a Linux Single-Board Computer
Shell
4
star
56

lora-sx1276

LoRa Driver for Semtech SX1276 on BL602 and BL604
C
4
star
57

nuttx-riscv64

Apache NuttX RTOS on 64-bit RISC-V
Shell
4
star
58

prometheus-the-things-network

Prometheus Configuration for The Things Network (MQTT)
4
star
59

iotapps

Connecting a Raspberry Pi 2 with Grove sensors to a Google Sheet through Temboo
Python
4
star
60

pinetime-lvgl

Rust LVGL Bindings for Mynewt on PineTime Smart Watch
Rust
4
star
61

stm32bluepill-makecode

MakeCode visual programming tool for STM32 Blue Pill based on libopencm3
4
star
62

handdrawn-watchface

Hand-Drawn Watch Face for Rust + Mynewt on PineTime Smart Watch
Rust
4
star
63

cocoOSExample-arduino

cocoOSExample adapted for Arduino. From cocoOS, the free, open source, cooperative task scheduler, based on coroutines targeted for embedded microcontrollers like AVR, MSP430 and STM32. http://www.cocoos.net
C
4
star
64

st7789-nuttx

ST7789 and LVGL Demo for Apache NuttX RTOS
3
star
65

innocomm-sigfox-breakout

Breakout board for InnoComm Sigfox module SN10-12
3
star
66

bl602_adc

BL602 ADC and Temperature Sensor Library for Apache NuttX OS
C
3
star
67

wisblock-lorawan

LoRaWAN client for RAKwireless WisBlock
C++
3
star
68

pinephone-nuttx-usb

PinePhone USB Driver for Apache NuttX RTOS
C
3
star
69

thethingsio-wifi-geolocation

thethings.io Cloud Code that transforms sensor values and calls an external API (Google WiFi Geolocation API)
JavaScript
3
star
70

lvglterm

LVGL Terminal for PinePhone on Apache NuttX RTOS
C
3
star
71

lorawan

LoRaWAN Driver for BL602 and BL604
C
3
star
72

ble-explorer

Experiment to show phones nearby running TraceTogether
Go
3
star
73

bme280-nuttx

Apache NuttX Driver for Bosch BME280 I2C Sensor (Temperature + Humidity + Air Pressure) ported from Zephyr OS
C
3
star
74

pinetime-graphic

Convert PNG graphic for PineTime Watch Faces and PineTime Bootloader
Rust
3
star
75

nuttx-nim

Experiments with Nim on Apache NuttX Real-Time Operating System
3
star
76

nuttx-pinevox

PineVox Smart Speaker with 64-bit RISC-V BL606P on Apache NuttX RTOS
3
star
77

stm32bluepill-mynewt-blinky

Apache Mynewt realtime OS blinky sample for STM32 Blue Pill
C
2
star
78

ESP8266Server

This is a Python UDP server to display UDP messages sent by the ESP8266 Arduino Shield by http://www.doit.am/
Python
2
star
79

wisblock-lora-transmitter

Transmit LoRa messages with RAKwireless WisBlock
C++
2
star
80

MyApp

Objective-C
2
star
81

TP-IoT-NOOBS

Custom Raspberry Pi NOOBS installation for Temasek Polytechnic IoT Course
Shell
2
star
82

gcloud-wifi-geolocation

Web application for Blue Pill Geolocation based on Google Cloud Standard AppEngine Go
HTML
2
star
83

BeaconLoggerAndroid2

Java
2
star
84

pinetime-mynewt

Rust Mynewt Bindings for PineTime Smart Watch
Rust
2
star
85

bl602_adc_test

Test App for BL602 ADC and Temperature Sensor Library for Apache NuttX OS
C
2
star
86

ikea_air_quality_sensor

IKEA VINDRIKTNING Air Quality Sensor connected to LoRaWAN and The Things Network with Apache NuttX OS
C
2
star
87

lorawan_test

LoRaWAN Test App for Apache NuttX OS
C
2
star
88

sx1262_test

LoRa Test App for Semtech SX1262 and Apache NuttX OS
C
2
star
89

microbit-sigfox

Send microbit sensor data to Sigfox with Sigfox Wisol Breakout Board. Coded in MakeCode and JavaScript.
TypeScript
2
star
90

process_sensor_data

This is an Arduino sketch for MediaTek LinkIt ONE to read data from various Grove sensors and transmit the sensor data to AzureIoTService hosted in the Microsoft Azure cloud. The sketch also activates Grove actuators when requested by AzureIoTService.
C++
2
star
91

bl602_expander

GPIO Expander for BL602 / BL604 on Apache NuttX RTOS
C
2
star
92

thethingsio-aws

Send realtime sensor data from thethings.io to Amazon Web Services Kinesis queue
JavaScript
2
star
93

pinetime-macros

Rust Safe Wrapper Macros for Mynewt on PineTime Smart Watch
Rust
2
star
94

nuttx-blockly

(Homage to MakeCode) Coding Ox64 BL808 SBC the Drag-n-Drop Way
TypeScript
2
star
95

postcard

1
star
96

microbit-thethingsio

Visualise microbit sensor data in the cloud with Sigfox and thethings.io
JavaScript
1
star
97

ESP8266Client

This is the client code for ESP8266 Arduino Shield by http://www.doit.am/
C++
1
star
98

zig-pinephone-mach

(Experimental) Mach Zig Game Engine on PinePhone
1
star
99

tp-iot-project

Temasek Polytechnic Specialist Diploma in IoT - Project Templates
1
star
100

PostToElasticsearch

Read a tab-delimited text file and send the fields to Elasticsearch for indexing.
C#
1
star