GithubHelp home page GithubHelp logo

lupyuen / pinetime-rust-mynewt Goto Github PK

View Code? Open in Web Editor NEW
207.0 20.0 54.0 268.17 MB

PineTime Smart Watch firmware based on Rust and Apache Mynewt OS

Home Page: https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot

License: Apache License 2.0

C 43.84% Batchfile 0.05% Shell 0.54% Assembly 49.39% C++ 1.33% Rust 4.78% HTML 0.07%
rust mynewt pinetime nrf52 nrf52832

pinetime-rust-mynewt's Introduction

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

pinetime-rust-mynewt's People

Contributors

candlehater avatar comansservices avatar davenewham avatar eldruin avatar flynx42 avatar jf002 avatar lupyuen avatar luz avatar nanch avatar simonhochrein avatar steveamor avatar utzig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pinetime-rust-mynewt's Issues

Firmware to update MCUBoot Bootloader

Hi thanks for helping to create the Rust+Mynewt firmware for updating the MCUBoot Bootloader :-)

  1. Try writing some Rust code in https://github.com/lupyuen/pinetime-rust-mynewt/blob/master/rust/app/src/lib.rs

  2. Check whether GitHub Actions will compile it. You need to enable GitHub Actions in your repo... just click "Actions" to enable it

  3. Edit the Rust code in lib.rs to read the bytes from a binary file (i.e. the bootloader binary)

    Use the include_bytes! macro as shown here...

    https://github.com/lupyuen/pinetime-rust-mynewt/blob/master/rust/app/src/chip8.rs#L88

    You may put the binary file in the same folder as lib.rs.

  4. Next step is to write the bytes into flash ROM. But we'll do this one step at a time :-)

To test your firmware without a PineTime, use Remote PineTime...

https://github.com/lupyuen/remote-pinetime-bot/blob/master/README.md

Lemme know if you get stuck. Thanks again :-)

Missing file target/nrf52.cfg

I'm trying to flash PineTime from Raspberry Pi according to README.md, now I'm at step 8) Flash the bootloader. I know there is flash protection, so I'm trying to run script/nrf52-pi/flash-unprotect.sh at first and later flash-boot.sh but there is an error:

pi@raspberrypi:~/pinetime-rust-mynewt $ ./scripts/nrf52-pi/flash-boot.sh
+ openocd/bin/openocd -f scripts/nrf52-pi/swd-pi.ocd -f scripts/nrf52/flash-boot.ocd
Open On-Chip Debugger 0.10.0+dev-01130-g9d1b46f5 (2020-07-19-22:23)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
scripts/nrf52-pi/swd-pi.ocd:13: Error: Can't find target/nrf52.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 26
at file "scripts/nrf52-pi/swd-pi.ocd", line 13

The target folder is stored in parent folder and its subfolders - not ~/pinetime-rust-mynewt/target/ but ~/openocd-spi/tcl/target/ - so find command can't look it up.

Broken build

Building the master, I've experienced following error

[~/t/pinetime/pinetime-rust-mynewt]$ scripts/build-app.sh                                                                                                                              [broken-build-fixed] 
+ mynewt_build_app=nrf52_my_sensor
+ rust_build_target=thumbv7em-none-eabihf
+ launch_config=launch-nrf52-pi.json
+ set +x

----- Building Rust app and Mynewt OS for thumbv7em-none-eabihf / nrf52_my_sensor...

----- Build Rust app
+ cargo build --target thumbv7em-none-eabihf
    Updating crates.io index
   Compiling app v2.1.1 (/home/fanda/t/pinetime/pinetime-rust-mynewt/rust/app)
error: proc macro panicked
   --> rust/app/src/app_network.rs:98:20
    |
98  |       let _payload = coap!( @json {        
    |  ____________________^
99  | |         //  Create `values` as an array of items under the root.
100 | |         //  Assume `val` contains `key: "t", val: 2870, geo: { lat, long }`. 
101 | |         //  Append to the `values` array the Sensor Key, Value and optional Geolocation:
...   |
107 | |         "device": &device_id,
108 | |     });
    | |______^
    |
    = help: message: index out of bounds: the len is 1 but the index is 1
    = note: this error originates in the macro `$crate::json_rep_set_text_string` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `app` due to 2 previous errors

When I change @json to @cbor build finishes with success, but the app might be broken.

Bootloader does not start properly after a watchdog reset/incoherent SPI state

I'm working on this issue in InfiniTime : race conditions occurs during sleep/wakeup and something put the devices (spi) into an incoherent state (I think it is disabled while a transaction is running). This bug must be fixed in InfiniTime, of course.

When this bug happens, it looks like the watch is totally frozen, because the screen stays black. This is strange because the watchdog should reset the MCU and the bootloader should be able to start again.

I did some checks and i'm positive that the watchdog works as intended and resets the MCU. But... the bootloader does not start. I cannot debug it right now, but I guess it is also stuck somewhere because of this incoherent state of the SPI device (weird, because the MCU has just been reset...).

I'm not 100% sure of my analysis, but I think we really should have a look at this in order to ensure that the bootloader is as robust as possible.

Build failes on Build Rust app

Hello i'm trying to build the Firmware Image via VisualStudioCode

After starting the application build process it fails with the following errors.


Building target targets/nrf52_my_sensor
Linking D://pinetime-rust-mynewt/bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.elf
Error: c:/program files (x86)/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: D:/
/pinetime-rust-mynewt/bin/targets/nrf52_my_sensor/app/libc/baselibc/libc_baselibc.a(start.o): in function _start': D:\****\pinetime-rust-mynewt/repos/apache-mynewt-core/libc/baselibc/src/start.c:39: undefined reference to main'
collect2.exe: error: ld returned 1 exit status

Could Not Find D:****\pinetime-rust-mynewt\target\thumbv7em-none-eabihf\debug\libapp.a
----- Build Rust app

D:*\pinetime-rust-mynewt>cargo build --target thumbv7em-none-eabihf
Compiling app v2.1.1 (D:*
\pinetime-rust-mynewt\rust\app)
error: proc macro panicked
--> rust\app\src\app_network.rs:98:20
|
98 | let _payload = coap!( @JSON {
| ______________^
99 | | // Create values as an array of items under the root.
100 | | // Assume val contains key: "t", val: 2870, geo: { lat, long }.
101 | | // Append to the values array the Sensor Key, Value and optional Geolocation:
... |
107 | | "device": &device_id,
108 | | });
| |
^
|
= help: message: index out of bounds: the len is 1 but the index is 1
= note: this error originates in the macro $crate::json_rep_set_text_string (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile app due to 2 previous errors
✅ ◾ ️Done!


I'm an experienced Embedded Softwae Developer.
I hoped to use the PineTime as starting point for complex embedded Rust applications.
Due to this fact im rather inexperienced in programming with Rust
I tried to debug the build with the proposed solution:


(in Nightly builds, run with -Z macro-backtrace for more info)

PS D:***\pinetime-rust-mynewt> cargo build -Z macro-backtrace
error: unknown -Z flag specified: macro-backtrace


Running on Windows 10 with Visual Code.


git log -r
commit eab7a64 (HEAD -> master, origin/master, origin/HEAD)
Author: Lee Lup Yuen [email protected]
Date: Wed Apr 21 09:46:00 2021 +0800

Update FUNDING.yml

commit 65e8519
Author: Lee Lup Yuen [email protected]
Date: Sun Apr 18 18:28:33 2021 +0800

Don't run workflow on PR

commit 158d767
Author: lupyuen [email protected]
Date: Fri Apr 9 09:16:41 2021 +0800

Standardise header and footer

Higher consumption on nRF52832 when boot from mcuboot

Hi @lupyuen,
I'm working with @JF002 on power consumption of Pinetime watch, using Infinitime from JF.

I noticed that consumption is higher when Infinitime is booted by mcuboot than when it is stand-alone. Difference is about 500µA.

As a example, I disabled watchdog in bootloader, and add a simple __WFE loop in main function of Infinitime.
Booting from mcuboot gives a consumption of 574µA, while booting in stand-alone configuration gives 170µA.

Resources may be used in mcuboot/mynewt and not de-initialized in mcuboot, nor in Infinitime.

Do you have any idea for me? How can I identify which resource is consuming power?

Thanks for your help.
Vincent

[FR] OTA istallation

without opening the watches.
I guess it's possible ad described (somewhere) but should be referenced from README

Send bootloader version to application

It would be useful if the application could somehow get the version of the running bootloader. This would allow

  • displaying this information to the user
  • different application behaviour, for example resetting the watchdog timer or not.

Tickle Watchdog to prevent reboot after 7 seconds

Hi @caspermeijn with reference to...

https://github.com/apache/mynewt-core/pull/2381/files

I'm now testing the new Sanity Interval, but using the old Watchdog Interval...

https://github.com/lupyuen/pinetime-rust-mynewt/blob/lvgl/apps/my_sensor_app/syscfg.yml#L119-L127

syscfg.vals:

    ###########################################################################
    # Watchdog Settings

    # The default PineTime bootloader will setup a 7 second watchdog
    SANITY_INTERVAL:      5000  #  Tickle the watchdog every 5 seconds, that the watchdog won't trigger a reboot
    # WATCHDOG_INTERVAL:  7000  #  If watchdog is not set, set it to 7 seconds

Note that I'm updating the apps/syscfg.yml, not the bsp/syscfg.yml.

This seems to work, PineTime is responding to BLE after 7 seconds. Previously it was hanging due to the watchdog being triggered.

So I suppose this validates your proposed fix for SANITY_INTERVAL.

Do we need to change WATCHDOG_INTERVAL? Or just leave it as default for now? Thanks.

install-pi.sh stops on non-existent path

----- Installing openocd-spi...
+ '[' '!' -d /home/pi/openocd-spi ']'
+ cp /home/pi/openocd-spi/src/openocd /home/pi/pinetime-rust-mynewt/openocd/bin/openocd
cp: cannot create regular file '/home/pi/pinetime-rust-mynewt/openocd/bin/openocd': No such file or directory

At first I had this script in subdirectory /home/pi/PineTime/pinetime-rust-mynewt/scripts/, so I moved the solution to /home/pi/ but the issue was still there. So I created directory openocd/bin by mkdir -p ../openocd/bin and run the script install-pi.sh again and it worked.

Expected behavior:

  1. script will autodetect path.
  2. required directory will be autocreated

How to activate bluetooth on pinetime after flashing mynewt

Hi,

I used your guide to flash mynewt with the counter app developed on rust.

now I want to connect my android flutter base app with the pinetime watch.

I managed to run the bluetoote flutter application on my android but it doesn't find the pinetime.

What am I missing?

Thanks

build-app.sh is missing some libraries

After running ./scripts/nrf52/build-boot.sh I executed ./scripts/build-app.sh and after some time it failed on error Undefined main, so I ran it again and it fails on this:

----- Build Rust app
+ cargo build --target thumbv7em-none-eabihf
error: failed to read `/home/pi/pinetime-rust-mynewt/rust/druid-embedded/druid/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

Expected behavior: druid toolkit will be available (pre-downloaded) in the directory ~/pinetime-rust-mynewt/rust/druid-embedded.

After trying to fix it by clonning repository druid-embedded, it continues with the same error for piet-embedded, kurbo-embedded and st7735-lcd-batch-rs.

Bluetooth adapter is not available

The code builded correctly but the app only shows a blue screen which says" Bluetooth adapter is not available". I'm using android lollipop on nexus 4 virtual machine.

build-app.sh can't build cortex-m

When build-app.sh tries to compile cortex-m it ends with error:

+ mynewt_build_app=nrf52_my_sensor
+ rust_build_target=thumbv7em-none-eabihf
+ launch_config=launch-nrf52-pi.json
+ set +x

----- Building Rust app and Mynewt OS for thumbv7em-none-eabihf / nrf52_my_sensor...

----- Build Rust app
+ cargo build --target thumbv7em-none-eabihf
   Compiling cortex-m v0.6.2
error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:11:24
   |
11 |         () => unsafe { asm!("bkpt" :::: "volatile") },
   |                        ----^^^^^^^^^^^^^^^^^^^^^^^^
   |                        |
   |                        help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:39:13
   |
39 |               asm!("1:
   |               ^---
   |               |
   |  _____________help: replace with: `llvm_asm!`
   | |
40 | |                   nop
41 | |                   subs $0, $$1
42 | |                   bne.n 1b"
...  |
45 | |                  :
46 | |                  : "volatile");
   | |_______________________________^
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:68:24
   |
68 |         () => unsafe { asm!("nop" :::: "volatile") },
   |                        ----^^^^^^^^^^^^^^^^^^^^^^^
   |                        |
   |                        help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:89:24
   |
89 |         () => unsafe { asm!("wfe" :::: "volatile") },
   |                        ----^^^^^^^^^^^^^^^^^^^^^^^
   |                        |
   |                        help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
   --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:110:24
    |
110 |         () => unsafe { asm!("wfi" :::: "volatile") },
    |                        ----^^^^^^^^^^^^^^^^^^^^^^^
    |                        |
    |                        help: replace with: `llvm_asm!`
    |
    = note: consider migrating to the new asm! syntax specified in RFC 2873
    = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
   --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:131:24
    |
131 |         () => unsafe { asm!("sev" :::: "volatile") },
    |                        ----^^^^^^^^^^^^^^^^^^^^^^^
    |                        |
    |                        help: replace with: `llvm_asm!`
    |
    = note: consider migrating to the new asm! syntax specified in RFC 2873
    = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
   --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:155:24
    |
155 |         () => unsafe { asm!("isb 0xF" ::: "memory" : "volatile") },
    |                        ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                        |
    |                        help: replace with: `llvm_asm!`
    |
    = note: consider migrating to the new asm! syntax specified in RFC 2873
    = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
   --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:183:24
    |
183 |         () => unsafe { asm!("dsb 0xF" ::: "memory" : "volatile") },
    |                        ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                        |
    |                        help: replace with: `llvm_asm!`
    |
    = note: consider migrating to the new asm! syntax specified in RFC 2873
    = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
   --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/asm.rs:209:24
    |
209 |         () => unsafe { asm!("dmb 0xF" ::: "memory" : "volatile") },
    |                        ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                        |
    |                        help: replace with: `llvm_asm!`
    |
    = note: consider migrating to the new asm! syntax specified in RFC 2873
    = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/interrupt.rs:13:13
   |
13 |             asm!("cpsid i" ::: "memory" : "volatile");
   |             ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |             |
   |             help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/interrupt.rs:40:15
   |
40 |         () => asm!("cpsie i" ::: "memory" : "volatile"),
   |               ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |               |
   |               help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/basepri.rs:11:17
   |
11 |                 asm!("mrs $0, BASEPRI" : "=r"(r) ::: "volatile");
   |                 ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                 |
   |                 help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/basepri.rs:40:19
   |
40 |             () => asm!("msr BASEPRI, $0" :: "r"(_basepri) : "memory" : "volatile"),
   |                   ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                   |
   |                   help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/basepri_max.rs:17:23
   |
17 |                 () => asm!("msr BASEPRI_MAX, $0" :: "r"(_basepri) : "memory" : "volatile"),
   |                       ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                       |
   |                       help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
   --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/control.rs:166:30
    |
166 |                     unsafe { asm!("mrs $0, CONTROL" : "=r"(r) ::: "volatile") }
    |                              ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                              |
    |                              help: replace with: `llvm_asm!`
    |
    = note: consider migrating to the new asm! syntax specified in RFC 2873
    = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
   --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/control.rs:197:17
    |
197 |                 asm!("msr CONTROL, $0" :: "r"(control) : "memory" : "volatile");
    |                 ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                 |
    |                 help: replace with: `llvm_asm!`
    |
    = note: consider migrating to the new asm! syntax specified in RFC 2873
    = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/faultmask.rs:37:30
   |
37 |                     unsafe { asm!("mrs $0, FAULTMASK" : "=r"(r) ::: "volatile") }
   |                              ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                              |
   |                              help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/msp.rs:10:22
   |
10 |             unsafe { asm!("mrs $0,MSP" : "=r"(r) ::: "volatile") }
   |                      ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                      |
   |                      help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/msp.rs:33:15
   |
33 |         () => asm!("msr MSP,$0" :: "r"(_bits) :: "volatile"),
   |               ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |               |
   |               help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/primask.rs:37:30
   |
37 |                     unsafe { asm!("mrs $0, PRIMASK" : "=r"(r) ::: "volatile") }
   |                              ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                              |
   |                              help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/psp.rs:10:22
   |
10 |             unsafe { asm!("mrs $0,PSP" : "=r"(r) ::: "volatile") }
   |                      ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                      |
   |                      help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/psp.rs:33:15
   |
33 |         () => asm!("msr PSP,$0" :: "r"(_bits) :: "volatile"),
   |               ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |               |
   |               help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/apsr.rs:58:17
   |
58 |                 asm!("mrs $0, APSR" : "=r"(r) ::: "volatile");
   |                 ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                 |
   |                 help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/lr.rs:12:22
   |
12 |             unsafe { asm!("mov $0,R14" : "=r"(r) ::: "volatile") }
   |                      ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                      |
   |                      help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/lr.rs:28:15
   |
28 |         () => asm!("mov R14,$0" :: "r"(_bits) :: "volatile"),
   |               ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |               |
   |               help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/pc.rs:12:22
   |
12 |             unsafe { asm!("mov $0,R15" : "=r"(r) ::: "volatile") }
   |                      ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                      |
   |                      help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: the legacy LLVM-style asm! syntax is no longer supported
  --> /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/cortex-m-0.6.2/src/register/pc.rs:28:15
   |
28 |         () => asm!("mov R15,$0" :: "r"(_bits) :: "volatile"),
   |               ----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |               |
   |               help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

error: aborting due to 27 previous errors

error: could not compile `cortex-m`.

To learn more, run the command again with --verbose.

Expected behavior: Script compiles cortex-m

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.