Skip to content

Commit

Permalink
honestly, no idea at this point, bunch of stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
noahbliss committed Feb 17, 2024
1 parent 03356e1 commit 1fef266
Show file tree
Hide file tree
Showing 59 changed files with 4,157 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[build]
#target = "xtensa-esp32s3-none-elf"
#target = "thumbv7em-none-eabihf"
[target.xtensa-esp32s3-none-elf]
runner = "espflash flash --monitor"
Expand All @@ -7,5 +8,5 @@ rustflags = [
"-C", "link-arg=-Tlinkall.x",
"-C", "link-arg=-nostartfiles",
"-C", "link-arg=-Trom_functions.x",
"-C", "target-feature=-loop",
#"-C", "target-feature=-loop",
]
21 changes: 16 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn main() {
let target = match target.as_str() {
"thumbv7em-none-eabihf" => "thumbv7em-none-eabihf",
"xtensa-esp32s3-none-elf" => "xtensa-esp32s3-none-elf",
"xtensa-esp32s3-espidf" => "xtensa-esp32s3-espidf",
_ => "thumbv7em-none-eabihf",
};
println!("Target we are using: {}", target);
Expand All @@ -28,8 +29,12 @@ fn main() {
.extra_warnings(true)
.compile("log");
xmpath.join("lib/arm")
} else if target.eq("xtensa-esp32s3-none-elf") {
cc::Build::new().file("c_src/wrapper.c").include("c_src");
} else if target.eq("xtensa-esp32s3-none-elf") | target.eq("xtensa-esp32s3-espidf") {
cc::Build::new()
.file("c_src/wrapper.c")
.include("c_src")
.warnings_into_errors(true)
.extra_warnings(true);
xmpath.join("lib/xtensa")
} else {
panic!("Target is not set or not supported.");
Expand All @@ -43,7 +48,13 @@ fn main() {
);
println!("cargo:rerun-if-changed=c_src/wrapper.c");

let headers = xmpath.join("include");
let headers = match target.into() {

Check warning on line 51 in build.rs

View workflow job for this annotation

GitHub Actions / stable / clippy

[clippy] reported by reviewdog 🐶 warning: useless conversion to the same type: `&str` --> build.rs:51:25 | 51 | let headers = match target.into() { | ^^^^^^^^^^^^^ help: consider removing `.into()`: `target` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default Raw Output: build.rs:51:25:w:warning: useless conversion to the same type: `&str` --> build.rs:51:25 | 51 | let headers = match target.into() { | ^^^^^^^^^^^^^ help: consider removing `.into()`: `target` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default __END__

Check warning on line 51 in build.rs

View workflow job for this annotation

GitHub Actions / beta / clippy

[clippy] reported by reviewdog 🐶 warning: useless conversion to the same type: `&str` --> build.rs:51:25 | 51 | let headers = match target.into() { | ^^^^^^^^^^^^^ help: consider removing `.into()`: `target` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default Raw Output: build.rs:51:25:w:warning: useless conversion to the same type: `&str` --> build.rs:51:25 | 51 | let headers = match target.into() { | ^^^^^^^^^^^^^ help: consider removing `.into()`: `target` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default __END__
"thumbv7em-none-eabihf" => xmpath.join("include/arm"),
"xtensa-esp32s3-none-elf" => xmpath.join("include/xtensa"),
"xtensa-esp32s3-espidf" => xmpath.join("include/xtensa"),
_ => panic!("Honestly shouldn't arrive here."),
};
//let headers = xmpath.join("include");
if !headers.exists() {
panic!("headers not found");
}
Expand All @@ -55,9 +66,9 @@ fn main() {
.layout_tests(false)
.generate_cstr(true)
.use_core()
} else if target.eq("xtensa-esp32s3-none-elf") {
} else if target.eq("xtensa-esp32s3-none-elf") | target.eq("xtensa-esp32s3-espidf") {
bindgen::Builder::default()
.clang_arg("--target=xtensa-esp32s3-none-elf")
.clang_arg("--target=xtensa")
.clang_arg(format!("-I{}", headers.display()))
.layout_tests(false)
.generate_cstr(true)
Expand Down
5 changes: 3 additions & 2 deletions c_src/wrapper.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#ifndef WRAPPER_H
#define WRAPPER_H

#include "../rss/include/acc_definitions_common.h"
#include "../rss/include/arm/acc_definitions_common.h"
#include <stdarg.h>
#include <stdio.h>

void c_log_stub(acc_log_level_t level, const char *module, const char *format, ...);
void c_log_stub(acc_log_level_t level, const char *module, const char *format,
...);

#endif // WRAPPER_H
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1fef266

Please sign in to comment.