eupn / stm32wb-hal

[WIP] embedded-hal for the STM32WB family of microcontrollers
20 stars 10 forks source link

help? "right" way to work on this locally? #14

Closed karlp closed 3 years ago

karlp commented 3 years ago

Not really a great issue, but haven't found a better place to ask, and you probably had to to it yourself.

What's the "right" way of working on this project locally? I have a downstream "app" that uses stm32wb55, so I've added to it's Cargo.toml

# No releases of this yet.
stm32wb55 = { git = "https://github.com/eupn/stm32wb55", rev="fc16aeb208785" }
stm32wb-hal = { version = "0.1.14", features = ["xG-package"], path = "../rust-eupn-stm32wb-hal"}

The path on the -hal project is meant to pull from my local clone, but it doesn't pass the features along, so "cargo update; cargo build" in my own app just gives me:

karlp@strem:~/src/red-heart (rtic-style *)$ cargo update
    Updating git repository `https://github.com/danielgallagher0/bluetooth-hci`
    Updating crates.io index
    Updating git repository `https://github.com/eupn/stm32wb55`
karlp@strem:~/src/red-heart (rtic-style *)$ cargo run
   Compiling stm32wb-hal v0.1.14
   Compiling indexmap v1.7.0
   Compiling cortex-m-rtic v0.5.8
   Compiling generic-array v0.13.3
   Compiling generic-array v0.12.4
   Compiling heapless v0.7.5
   Compiling generic-array v0.14.4
error: failed to run custom build command for `stm32wb-hal v0.1.14`

Caused by:
  process didn't exit successfully: `/home/karlp/src/red-heart/target/debug/build/stm32wb-hal-af817ad112180049/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at '

  Must select exactly one package for linker script generation!
  Choices: 'xC-package', 'xE-package' or 'xG-package'

  ', /home/karlp/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32wb-hal-0.1.14/build.rs:19:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
karlp@strem:~/src/red-heart (rtic-style *)$

If I enter my own clone directory, I can manually patch the feature in, so that cargo build in that directory works, but, that doesn't seem to get propagated anywhere... (and it doesn't seem like a very nice way of doing things anyway)

karlp@strem:~/src/rust-eupn-stm32wb-hal (more-power *)$ git diff
diff --git a/Cargo.toml b/Cargo.toml
index 4d72e96..111d4c9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -63,7 +63,7 @@ xG-package = []

 rt = ["stm32wb-pac/rt"]

-default = [ "rt" ]
+default = [ "rt", "xG-package" ]

 [dev-dependencies]
 cortex-m-rtfm = "0.5"

cargo install Seemed like it might be correct, but that's only for binaries, not libraries, it says.

karlp commented 3 years ago

Apparently: https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#testing-a-bugfix is what you need, ie

[dependencies]
...
stm32wb-hal = { version = "0.1.14", features = ["xG-package"] }
...
[patch.crates-io]
stm32wb-hal = { path = "../rust-eupn-stm32wb-hal-your-local-path" }