Closed japaric closed 3 months ago
I can fix this for cortex-m
Has kickstart been considered? It seems to have the features we require around custom variables and validation of those variables.
If nothing else, it may be relevant for how to implement these features, if use of cargo-generate
is really desired.
Just saw this thread while looking at the cargo-generate issues and thank you @jamesmunns for mentionning kickstart. I believe kickstart would fit the bill, except the validation of overlapping of memory as validation in kickstart is currently only regex based.
I was talking to a colleague of mine, and one thing that came up as missing is the extra help with MCU selection (initial setup), and weeding out all the chip crates. For example, one would like to do something like this and get the extra help (strawman syntax):
$ cargo [my_generator] [mcu] [optional chip crate] [optional extra crates]
Where it could be used as, and give the following help:
$ cargo generate --mcu cortex-m --chip stm32
Error: Cortex-M is not specific enough.
Maybe you meant: cortex-m0, cortex-m0p, cortex-m3, cortex-m4, cortex-m7
Okey, lets improve (I know there is an stm32
crate, but bear with me):
$ cargo generate --mcu cortex-m4 --chip stm32
Error: Too many matches for chip crates:
Maybe you meant: [list of crates]
I think a guiding feature like this could really help new users a lot and solve a real pain within embedded, and specifically setting up new project therein. Most of it would come from good suggestions.
Moreover, it would help new users in that they would not need to place the target in the .cargo/config
file (small thing but easy to miss).
However I am not sure how much of an extension would be needed to the two linked generators here to make something like this work.
Any comments/further ideas/thoughts?
@korken89 seems like an excellent idea!
I don't know how much control over cargo generate we have, but, mbed-cli
has a list of supported micros and boards you can ask it for which has come in handy for me. Also the addition of a --board
eg. --board=blue-pill
as a meta description that selects the other components could be neat.
@korken89 Sounds great but the syntax is a bit wonky. Why would you specify the core type as --mcu
? And why would you specify it at all if you have the specific chip?
@ryankurte You mean like https://platformio.org/ for Rust? That sounds like a terrific idea.
@ryankurte
Thanks! I was thinking something similar!
The whole issue is probably where all the metadata will come from, so that the system more or less becomes automated in additions and does not become a maintaining nightmare.
@therealprof Yeah, I agree that the syntax is wonky, it was mostly the overall idea I wanted to put forward. Any syntax can be bikesheded when/if it comes closer :)
And why would you specify it at all if you have the specific chip?
Exactly, if this metadata is available the system could say that the core is not needed. The syntax could be a bit more hierarchical:
Or something similar.
The core idea is simply to have the system be more automated and easy for beginners and advanced alike. I am however not sure where to propose and push it, as the selection of generator seems to happen now, but it can also be extended later.
@jamesmunns @Keats I don't have much insight into how cargo-generate
will get the features we need; that would be up to the Cargo team. At this stage our job is to submit feature requests.
@therealprof @ryankurte @korken89 that sounds interesting but could you leave a comment or open an issue in the cargo-generate issue tracker to make sure the use case doesn't get lost?
@dvc94ch @pftbest will you need more features than what's described in https://github.com/ashleygwilliams/cargo-generate/issues/17#issuecomment-409987029 to port the msp430 / riscv templates to cargo-generate?
@dvc94ch @pftbest will you need more features than what's described in ashleygwilliams/cargo-generate#17 (comment) to port the msp430 / riscv templates to cargo-generate?
@rust-embedded/msp430 @rust-embedded/riscv did you get a chance to try this?
Triage: implementation is blocked on cargo-generate gaining the features we need.
I created an issue in cargo-generate
for the possibility to use presets: https://github.com/ashleygwilliams/cargo-generate/issues/92
cortex-m-quickstart has moved to the cargo-generate format. As that's what we'll be using the embedded Rust book I'm going to remove this issue from the 2018 milestone to signal that the work required for the 2018 edition is done.
I'm going to leave this open to track the other arches (msp430 and rsicv) moving to / testing cargo-generate.
@rust-embedded/msp430 @rust-embedded/riscv
Are there any plans to update your quickstarts to cargo-generate? Can this issue be closed?
@jamesmunns I have this in my roadmap for RISC-V.
Updated riscv-rust-quickstart.
@jamesmunns
Are there any plans to update your quickstarts to cargo-generate? Can this issue be closed?
Once v0.2.0
crates are published, I will update msp430-quickstart
to use cargo-generate
; publishing is imminent.
@jamesmunns Long overdue, but msp430-quickstart
has been updated to use cargo-generate
. This issue can be closed I believe.
I just landed https://github.com/cargo-generate/cargo-generate/pull/445, which should solve the missing issues for this issue.
Please take a look as it'll be part of next cargo-generate
release
There have been a variety of templates available now including https://github.com/rust-embedded/cortex-m-quickstart and https://github.com/rust-embedded/msp430-quickstart under the WG umbrella.
Triage(2018-08-20)
The Cortex-M team has requested features to the cargo-generate folks. Implementation is blocked on cargo-generate gaining the features we need.
cargo-generate
is going to be the official solution for Cargo templates. The domain WGs are expected to providecargo-generate
templates for applications in their domain.Let's move the existing templates (
{cortex-m,msp430,riscv}-quickstart
) to thecargo-generate
format. If you need any feature to be added tocargo-generate
to port your template [open an issue] or leave a comment about your use case in one of the existing ones.Submit feature requests ASAP so there's enough time for them to be implemented. Also let's collect all the embedded WG feature requests in this issue so we can have the
cargo-generate
team prioritize them.Feature requests
cortex-m-quickstart
, custom variables and validation. https://github.com/ashleygwilliams/cargo-generate/issues/17#issuecomment-409987029cc ~@rust-embedded/cortex-m~ @adamgreig @korken89 @therealprof cc ~@rust-embedded/msp430~ @cr1901 @pftbest cc ~@rust-embedded/riscv~ @bradjc @danc86 @dvc94ch
I'm going to tentatively assign this to the RC1 milestone.