Skip to content

Instantly share code, notes, and snippets.

@standarddeviant
Created June 9, 2024 12:08
Show Gist options
  • Save standarddeviant/61d959381df84d44a81615cca0ad427e to your computer and use it in GitHub Desktop.
Save standarddeviant/61d959381df84d44a81615cca0ad427e to your computer and use it in GitHub Desktop.
Rust BLE recipe on nRF52840
let startdir = pwd
if not ('nrf-softdevice' | path exists) {
git clone https://github.com/embassy-rs/nrf-softdevice.git
}
cd ([nrf-softdevice examples] | path join)
if not ('uf2conv.py' | path exists) {
http get https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2families.json | save uf2families.json
http get https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2conv.py | save uf2conv.py
}
cargo build --bin ble_bas_peripheral --features nrf52840 --release
arm-none-eabi-objcopy -O ihex ..\target\thumbv7em-none-eabihf\release\ble_bas_peripheral .\ble_bas_peripheral.hex
mergehex -m s140_nrf52_7.3.0_softdevice.hex ble_bas_peripheral.hex -o merged.hex
python uf2conv.py -f 0xADA52840 -c -b 0x1000 -o app.uf2 merged.hex
cd $startdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment