Code Monkey home page Code Monkey logo

nrfdfu-rs's Introduction

nRF DFU Flashing Tool

crates.io

nrfdfu-rs is an implementation of the protocol used by the bootloader on the nRF family of microcontrollers. It can be used to flash an ELF firmware file onto devices such as the nRF52840 Dongle.

This tool was written to replace pc-nrfutil in our trainings, so it implements a subset of the features found there.

Usage

Run the following command to install the nrfdfu executable on your system:

$ cargo install nrfdfu

The tool is designed to be passed an ELF file as follows:

$ nrfdfu path/to/firmware.elf

This allows using it as a Cargo runner to automatically flash your Rust firmware during cargo run. Place the following in .cargo/config.toml to use nrfdfu as the Cargo runner:

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "nrfdfu"

nrfdfu-rs's People

Contributors

japaric avatar jonas-schievink avatar nexoscp avatar

Stargazers

 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

Forkers

nexoscp markbirss

nrfdfu-rs's Issues

fails to flash with no segments

I am trying to flash a nrf52 dongle w/ the rubble demo https://github.com/jonas-schievink/rubble/tree/044b5370c2b32a73ed47833ab96c1b0cb5a4b797/demos/nrf52-demo

Initially I had trouble with the nrfutil 6.1.0 which is used by dongle-flash from one of the ferrous systems workshops, and hence found this alternative.

So this works fine with debug builds where the elf info is present, I accidentally made a copy & paste mistake, that included

[profile.release.build-override]
codegen-units = 8
debug = false
debug-assertions = false
opt-level = 0
overflow-checks = false

which lead to

error: no loadable program segments found

which really should be

error: missing debug info, assure your binary is built with `debug=true`

which provides some information on what to do

( I ❤️ this tool and a lot of other things you do! )

Final data packet fails to update CRC

When the final data object is sent, the CRC response from the bootloader does not include the contained data, and executing the data object results in an "operation not permitted in the current state" error.

Some observations:

  • Generating an init packet from the [1,2,3] test-firmware and flashing that using Nordic's pc-nrfutil implementation results in the same behavior.
  • Using Nordic's tool to generate the DFU package from the [1,2,3] firmware results in an init packet that specifies an image size of 4 Bytes instead of 3.

The debug output of Nordic's tool indicates that a 0xff byte is appended to the firmware data:

2021-05-03 17:39:27,515 Serial: Streaming Data: len:4 offset:0 crc:0x00000000
2021-05-03 17:39:27,515 SLIP: --> [8, 1, 2, 3, 255]
2021-05-03 17:39:27,516 SLIP: --> [3]
2021-05-03 17:39:27,517 SLIP: <-- [96, 3, 1, 4, 0, 0, 0, 89, 208, 83, 156]
2021-05-03 17:39:27,517 SLIP: --> [4]
2021-05-03 17:39:27,518 SLIP: <-- [96, 4, 1]
2021-05-03 17:39:27,518 Image sent in 0.18145108222961426s

ELF-File not reconized

Build the "blinky" example from https://github.com/nrf-rs/adafruit-nrf52-bluefruit-le

Ensured i got a elf file:
file target/thumbv7em-none-eabihf/release/examples/blinky
target/thumbv7em-none-eabihf/release/examples/blinky: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped

Tried to use nrfdfu and got this error:
nrfdfu target/thumbv7em-none-eabihf/release/examples/blinky
error: no loadable program segments found; ensure that the linker is invoked correctly (passing the linker script)

Not sure where to go from here.

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.