Repository containing examples for multiple targets?

I have a repository (driver-examples) where I have written many example programs for several drivers all of them running on the STM32F3Discovery board.
As the bluepill board is more popular, I wanted to add examples for it too.

Adding bluepill examples together does not work

It seems not possible to add bluepill examples together as the dependencies cause errors.
This kind of makes sense as they will pull in settings for two different devices. i.e. after adding the dependencies:

panic-halt = "0.2"
[dependencies.stm32f1xx-hal]
version = "0.2.0"
features = ["stm32f103", "rt"]

When running cargo build --example ad9833-midi-player-f3 --target thumbv7em-none-eabihf (notice that this is an f3 example which was fine beforehand)
I get this error:

rust-lld: error: 
          ERROR(cortex-m-rt): The interrupt vectors are missing.
          Possible solutions, from most likely to less likely:
          - Link to a svd2rust generated device crate
          - Disable the 'device' feature of cortex-m-rt to build a generic application (a dependency
          may be enabling it)
          - Supply the interrupt handlers yourself. Check the documentation for details.

A bluepill example program would build fine, though.

Cargo workspace does not work either

I tried creating a cargo workspace where there is one package for each target. See this branch.
Again, bluepill examples build fine, but f3 examples do not. Running cargo build --example ad9833-midi-player-f3 --target thumbv7em-none-eabihf

Returns this error:

rust-lld: error: [...]/driver-examples/target/thumbv7em-none-eabihf/debug/build/cortex-m-rt-17b6d453c0b47b92/out/link.x:207: cannot find linker script device.x
          >>> INCLUDE device.x
          >>>         ^

Explanation / Solutions?

I know I can simply remove the cargo workspace file and keep the two independent folders (packages).
However, do you know of any other solution which would allow running
both these commands from the top folder?

  • cargo run --example <bluepill-example> --target...
  • cargo run --example <f3-example> --target...