Skip to content

Commit

Permalink
Make runner command selectable
Browse files Browse the repository at this point in the history
  • Loading branch information
ithinuel committed Feb 28, 2024
1 parent 1a85e03 commit 59a65ff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
14 changes: 12 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
# Choose a default "cargo run" tool (see README for more info)
# - `probe-rs` provides flashing and defmt via a hardware debugger, and stack unwind on panic
# - elf2uf2-rs loads firmware over USB when the rp2040 is in boot mode
runner = "probe-rs run --chip RP2040 --protocol swd"
# runner = "probe-rs run --chip RP2040 --protocol swd"
# runner = "elf2uf2-rs -d"

{% case flash_method -%}
{%- when "probe-rs" -%}
runner = "probe-rs run --chip RP2040 --protocol swd"
{%- when "elf2uf2-rs" -%}
runner = "elf2uf2-rs -d"
{%- when "none" -%}
{%- else -%}
{%- if flash_method != "" -%}
runner = "{{ flash_method_custom }}"
{%- endif -%}
{%- endcase %}
rustflags = [
"-C", "linker=flip-link",
"-C", "link-arg=--nmagic",
Expand Down
15 changes: 12 additions & 3 deletions cargo-generate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
cargo_generate_version = ">=0.9.0"

[hooks]
pre = [
"cargo-generate/remove_rprs.rhai"
]
pre = ["cargo-generate/remove_rprs.rhai"]

[placeholders]
flash_method = { prompt = "Which flashing method do you intend to use?", choices = [
"probe-rs",
"elf2uf2-rs",
"custom",
"none"
], default = "probe-rs", type = "string" }

[conditional.'flash_method == "custom"'.placeholders]
flash_method_custom = { prompt = "Enter the runner command to use", type = "string" }

0 comments on commit 59a65ff

Please sign in to comment.