Skip to content

Commit

Permalink
Merge pull request #44 from arkedge/feature/run-subobc-example-on-c2a…
Browse files Browse the repository at this point in the history
…-runtime

Run examples/subobc on c2a-sils-runtime
  • Loading branch information
sksat authored Aug 3, 2023
2 parents 418e99e + b2bec28 commit ab19e2a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ members = [
"./hal/wdt-noop",

"./hal/uart-kble",

"./examples/subobc",
]

[workspace.dependencies]
c2a-core = { path = "." }

c2a-sils-runtime = { path = "./sils-runtime" }
c2a-wdt-noop = { path = "./hal/wdt-noop" }
c2a-uart-kble = { path = "./hal/uart-kble" }

[package]
name = "c2a-core"
version.workspace = true
Expand Down
17 changes: 17 additions & 0 deletions examples/subobc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "c2a-example-subobc"
version.workspace = true
edition = "2021"

[dependencies]
c2a-core.workspace = true

# runtime
c2a-sils-runtime.workspace = true

# ifimpl
c2a-uart-kble.workspace = true
c2a-wdt-noop.workspace = true

[build-dependencies]
cmake = "0.1"
22 changes: 22 additions & 0 deletions examples/subobc/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
fn main() {
// Build C2A & link
let mut c2a_cmake = cmake::Config::new(".");
let libc2a = c2a_cmake
.very_verbose(true)
.define("USE_32BIT_COMPILER", "ON")
.define("BUILD_C2A_AS_C99", "ON")
.define("BUILD_C2A_AS_SILS_FW", "ON")
.define("USE_SCI_COM_WINGS", "OFF")
.build_target("C2A");

println!("cargo:rerun-if-changed=./CMakeLists.txt");
println!("cargo:rerun-if-changed=./src/src_core");
println!("cargo:rerun-if-changed=./src/src_user");

let libc2a = libc2a.build();
println!(
"cargo:rustc-link-search=native={}/build", // no install step in libC2A
libc2a.display()
);
println!("cargo:rustc-link-lib=static=C2A");
}
9 changes: 9 additions & 0 deletions examples/subobc/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use c2a_sils_runtime as c2a_runtime;

extern crate c2a_uart_kble;
extern crate c2a_wdt_noop;

fn main() {
c2a_runtime::c2a_init();
c2a_runtime::c2a_main();
}

0 comments on commit ab19e2a

Please sign in to comment.