Skip to content

Instantly share code, notes, and snippets.

@jacobrosenthal
Created November 7, 2021 05:07
Show Gist options
  • Save jacobrosenthal/0a834bc77576a40dc90de5de833f788a to your computer and use it in GitHub Desktop.
Save jacobrosenthal/0a834bc77576a40dc90de5de833f788a to your computer and use it in GitHub Desktop.
nordic dfu cargo make
# cargo make first
[tasks.first]
dependencies = ["erase", "flash-softdevice", "flash-bootloader", "reset"]
# cargo make --env APP=1 flash
[tasks.flash]
dependencies = ["flash-application", "reset"]
# cargo make --env APP=1 pkg
[tasks.pkg]
condition = { env_set = ["APP"] }
command = "nrfutil"
args = [
"pkg",
"generate",
"--hw-version",
"52",
"--application-version",
"${APP}",
"--application",
"target/nrf52840-mdk.hex",
"--sd-req",
"0x100",
"--key-file",
"private.key",
"target/app_dfu_package.zip"
]
dependencies = ["objcopy-application"]
####
[tasks.erase]
install_crate = "probe-rs-cli"
command = "probe-rs-cli"
args = ["erase", "--chip", "nRF52840_xxAA"]
[tasks.flash-softdevice]
install_crate = "probe-rs-cli"
command = "probe-rs-cli"
args = [
"download",
"--format",
"hex",
"s140_nrf52_7.2.0_softdevice.hex",
"--chip",
"nRF52840_xxAA"
]
[tasks.flash-bootloader]
install_crate = "probe-rs-cli"
command = "probe-rs-cli"
args = [
"download",
"--format",
"hex",
"nrf52840_xxaa_s140.hex",
"--chip",
"nRF52840_xxAA"
]
[tasks.reset]
install_crate = "probe-rs-cli"
command = "probe-rs-cli"
args = ["reset", "--chip", "nRF52840_xxAA"]
[tasks.objcopy-application]
install_crate = "cargo-objcopy"
command = "cargo"
args = ["objcopy", "--release", "--", "-O", "ihex", "target/nrf52840-mdk.hex"]
dependencies = ["install-llvm-tools-preview"]
[tasks.build-settings]
condition = { env_set = ["APP"] }
command = "nrfutil"
args = [
"settings",
"generate",
"--family",
"NRF52840",
"--application",
"target/nrf52840-mdk.hex",
"--application-version",
"${APP}",
"--bootloader-version",
"0",
"--bl-settings-version",
"2",
"target/bootloader_setting.hex"
]
dependencies = ["objcopy-application"]
[tasks.flash-settings]
install_crate = "probe-rs-cli"
command = "probe-rs-cli"
args = [
"download",
"--format",
"hex",
"target/bootloader_setting.hex",
"--chip",
"nRF52840_xxAA"
]
[tasks.flash-application]
install_crate = "probe-rs-cli"
command = "probe-rs-cli"
args = [
"download",
"--format",
"hex",
"target/nrf52840-mdk.hex",
"--chip",
"nRF52840_xxAA"
]
dependencies = ["build-settings", "flash-settings"]
[tasks.install-llvm-tools-preview]
install_crate = { rustup_component_name = "llvm-tools-preview" }
[tasks.install-probe-rs-cli]
install_crate = "probe-rs-cli"
[tasks.install-cargo-objcopy]
install_crate = "cargo-objcopy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment