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

Run examples/subobc on c2a-sils-runtime #44

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}