Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from cargo-generate to kickstart #47

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .genignore

This file was deleted.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
# TODO(1) fix `authors` and `name` if you didn't use `cargo-generate`
# TODO(1) fix `authors` and `name` if you didn't use `kickstart`
authors = ["{{authors}}"]
name = "{{project-name}}"
name = "{{project_name}}"
edition = "2018"
version = "0.1.0"

Expand Down Expand Up @@ -76,4 +76,4 @@ overflow-checks = false # <-
# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
# defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,22 @@ $ cargo install flip-link
$ cargo install probe-run
```

#### 3. [`cargo-generate`]:
#### 3. [`kickstart`]:

```
$ cargo install cargo-generate
$ cargo install kickstart
```

[`cargo-generate`]: https://crates.io/crates/cargo-generate
[`kickstart`]: https://crates.io/crates/kickstart

> *Note:* You can also just clone this repository instead of using `cargo-generate`, but this involves additional manual adjustments.
> *Note:* You can also just clone this repository instead of using `kickstart`, but this involves additional manual adjustments.

## Setup

#### 1. Initialize the project template

``` console
$ cargo generate \
--git https://github.com/knurling-rs/app-template \
--branch main \
--name my-app
$ kickstart https://github.com/knurling-rs/app-template
```

If you look into your new `my-app` folder, you'll find that there are a few `TODO`s in the files marking the properties you need to set.
Expand All @@ -49,14 +46,14 @@ Let's walk through them together now.

Pick a chip from `probe-run --list-chips` and enter it into `.cargo/config.toml`.

If, for example, you have a nRF52840 Development Kit from one of [our workshops], replace `{{chip}}` with `nRF52840_xxAA`.
If, for example, you have a nRF52840 Development Kit from one of [our workshops], replace `$CHIP` with `nRF52840_xxAA`.

[our workshops]: https://github.com/ferrous-systems/embedded-trainings-2020

``` diff
# .cargo/config.toml
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
-runner = "probe-run --chip {{chip}}"
-runner = "probe-run --chip $CHIP"
+runner = "probe-run --chip nRF52840_xxAA"
```

Expand Down
2 changes: 0 additions & 2 deletions cargo-generate.toml

This file was deleted.

26 changes: 26 additions & 0 deletions template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name = "knurling-app-template"

description = """
Quickly set up a `probe-run` + `defmt` + `flip-link` embedded project
"""

kickstart_version = 1

ignore = [".github"]

[[variables]]
name = "project_name"
prompt = "Enter the project name"
default = "app-template"
validation = "^([a-zA-Z_][a-zA-Z0-9_-]+)$"

[[variables]]
name = "crate_name"
prompt = "Enter the crate name (usually the project name with `-` replaced by `_`)"
default = "app_template"
validation = "^([a-zA-Z_][a-zA-Z0-9_]+)$"

[[variables]]
name = "authors"
prompt = "Enter the project authors"
default = "Nobody <[email protected]>"
4 changes: 2 additions & 2 deletions testsuite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
# TODO(1) fix `authors` if you didn't use `cargo-generate`
# TODO(1) fix `authors` if you didn't use `kickstart`
authors = ["{{authors}}"]
name = "testsuite"
publish = false
Expand All @@ -11,7 +11,7 @@ name = "test"
harness = false

[dependencies]
{{project-name}} = { path = ".." }
{{project_name}} = { path = ".." }
cortex-m = "0.6.3"
cortex-m-rt = "0.6.12"
defmt = "0.1.0"
Expand Down