Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sajattack/uf2conv-rs
Converts binary files to Microsoft's UF2 format https://github.com/Microsoft/uf2
https://github.com/sajattack/uf2conv-rs
bootloader embedded rust uf2
Last synced: 2 months ago
JSON representation
Converts binary files to Microsoft's UF2 format https://github.com/Microsoft/uf2
- Host: GitHub
- URL: https://github.com/sajattack/uf2conv-rs
- Owner: sajattack
- License: mit
- Created: 2018-10-10T07:28:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-17T19:25:53.000Z (about 3 years ago)
- Last Synced: 2024-10-25T06:30:35.899Z (3 months ago)
- Topics: bootloader, embedded, rust, uf2
- Language: Rust
- Homepage:
- Size: 14.6 KB
- Stars: 28
- Watchers: 7
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- rust-embedded - uf2 - [![crates.io](https://img.shields.io/crates/v/uf2.svg)](https://crates.io/crates/uf2) (Tools / Paid and commercially available materials)
- awesome-embedded-rust - uf2 - [![crates.io](https://img.shields.io/crates/v/uf2.svg)](https://crates.io/crates/uf2) (Tools / Paid and commercially available materials)
README
# uf2conv
Adds a uf2 header [Microsofts HID Flashing Format (UF2)](https://github.com/microsoft/uf2/blob/86e101e3a282553756161fe12206c7a609975e70/README.md) for copying over to UF2 bootloader mass storage devices. UF2 is factory programmed extensively by [Microsoft MakeCode](https://www.microsoft.com/en-us/makecode) and [Adafruit](https://www.adafruit.com/) hardware.
## Install
`cargo install uf2conv`## Usage
```bash
$ uf2conv
error: The following required arguments were not provided:
USAGE:
uf2conv --base --family --outputFor more information try --help
```Base usage you'll want to give the --base memory address for your chip. This is where the code starts after the bootloader. In the case of embedded rust, thats found in your memory.x where you'll find `FLASH (rx) : ORIGIN = 0x00000000+0x4000` or `FLASH (rx) : ORIGIN = 0x00000000 + 16K` Where 16K in bytes is 16384 decimal or 0x4000 hex base.
```bash
$ uf2conv pygamer_blinky_basic.bin --base 0x4000 --output pygamer_blinky_basic.uf2
```And you can copy that uf2 file to your embedded device's drive that appears when you enter bootloader mode.
## Rust: How to get a bin file
Use [cargo-binutils](https://github.com/rust-embedded/cargo-binutils) which replaces the `cargo build` command to find and convert elf files into binary.
Install the dependencies
```bash
$ rustup component add llvm-tools-preview
$ cargo install uf2conv cargo-binutils
```Then in your embedded project, say [PyGamer](https://github.com/atsamd-rs/atsamd/tree/master/boards/pygamer)
```bash
$ cargo objcopy --example blinky_basic --features unproven --release -- -O binary pygamer_blinky_basic.bin
$ uf2conv pygamer_blinky_basic.bin --base 0x4000 --output pygamer_blinky_basic.uf2
```