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

cargo embassy init generates invalid project if chip name is incorrect #14

Open
Luctins opened this issue Jun 26, 2024 · 4 comments
Open

Comments

@Luctins
Copy link

Luctins commented Jun 26, 2024

After running cargo embassy init <project_name> --chip STM32H563ZITx, the generated project doesn't contain the embassy_stm32 dependency with the chip passed from command line as as a feature, so it fails to compile.

❯ cargo embassy init test_project --chip STM32H563ZITx
  Finished in 17s
❯ cd test_project
❯ cargo b
error: failed to parse manifest at `<redacted>/test_project/Cargo.toml`

Caused by:
  feature `debug` includes `embassy-stm32/defmt`, but `embassy-stm32` is not a dependency

Tested using cargo-embassy v0.2.1 installed with cargo install.

@AdinAck
Copy link
Owner

AdinAck commented Jun 26, 2024

This is because your chip identifier includes the package type at the end, Tx. The chip identifier you provide should be in the form of what embassy expects for the chip feature.

Would be nice if cargo embassy had some kind of warning about this instead of silently failing...

@Luctins Luctins changed the title cargo embassy init <projectname> for stm32 missing stm32 dependency cargo embassy init generates invalid project if chip name is incorrect Jun 26, 2024
@Luctins
Copy link
Author

Luctins commented Jun 26, 2024

Updated the title to reflect the actual issue. Also tested without the Tx and indeed it works.

Is there a logical place we could check for this? I would be interested in trying to fix this.

@AdinAck
Copy link
Owner

AdinAck commented Jun 26, 2024

Any help would be much appreciated!

What I believe is happening is the chip identifier is parsed and passed to embassy as a feature here, which of course is not a valid feature so the cargo add fails.

I guess the simplest option would be to report when these subroutines fail, and the cherry on top would be to add a convenience message explaining that the reason it failed was because of the invalid feature.

@Luctins
Copy link
Author

Luctins commented Jun 26, 2024

That seems like a good place to start, I'll open a PR when possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants