Skip to content

Commit

Permalink
Move examples to separate project
Browse files Browse the repository at this point in the history
  • Loading branch information
mvirkkunen committed Apr 27, 2021
1 parent e41d104 commit af1dcd7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 28 deletions.
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]

members = [
"examples-cortex-m",
"rtt-target",
"panic-rtt-target",
"panic-test",
Expand All @@ -9,3 +9,10 @@ members = [
[patch.crates-io]
rtt-target = { path = "./rtt-target" }
panic-rtt-target = { path = "./panic-rtt-target" }

# This is for the examples/tests
[profile.release]
codegen-units = 1
lto = true
opt-level = "s"
panic = "abort"
21 changes: 21 additions & 0 deletions examples-cortex-m/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "examples-cortex-m"
version = "0.1.0"
authors = ["Matti Virkkunen <mvirkkunen@gmail.com>"]
edition = "2018"

[dependencies]
cortex-m = "0.7.1"
cortex-m-rt = "0.6.12"
panic-halt = "0.2.0"
rtt-target = { path = "../rtt-target", features = ["cortex-m"] }
ufmt = "0.1.0"

[[bin]]
name = "custom"

[[bin]]
name = "print"

[[bin]]
name = "ufmt"
10 changes: 10 additions & 0 deletions examples-cortex-m/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::{env, error::Error, fs::File, io::Write, path::PathBuf};

fn main() -> Result<(), Box<dyn Error>> {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());

println!("cargo:rustc-link-search={}", out_dir.display());
File::create(out_dir.join("memory.x"))?.write_all(include_bytes!("memory.x"))?;

Ok(())
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 0 additions & 27 deletions rtt-target/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,5 @@ ufmt-write = "0.1.0"
cortex-m = { version = "0.7.1", optional = true }
riscv = { version = "0.6.0", optional = true }

# Dependencies used only for examples
ufmt = { version = "0.1.0", optional = true }
cortex-m-rt = { version = "0.6.12", optional = true }
panic-halt = { version = "0.2.0", optional = true }

[features]
examples-cortex-m = ["cortex-m", "cortex-m-rt", "panic-halt", "ufmt"]

[[example]]
name = "cortex-m-custom"
required-features = ["examples-cortex-m"]

[[example]]
name = "cortex-m-print"
required-features = ["examples-cortex-m"]

[[example]]
name = "cortex-m-ufmt"
required-features = ["examples-cortex-m"]

# This is for the examples
[profile.release]
codegen-units = 1
lto = true
opt-level = "s"
panic = "abort"

[package.metadata.docs.rs]
features = ["cortex-m"]

0 comments on commit af1dcd7

Please sign in to comment.