Skip to content

Commit

Permalink
Merge pull request #2 from Xila-Project/Feature/Display
Browse files Browse the repository at this point in the history
Feature/display
  • Loading branch information
AlixANNERAUD authored Dec 22, 2023
2 parents 0b5cd41 + 512c51d commit 9cdfcfa
Show file tree
Hide file tree
Showing 15 changed files with 1,751 additions and 115 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ linker = "ldproxy"
runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x
rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110

[unstable]
build-std = ["std", "panic_abort"]
#[unstable]
#build-std = ["std", "panic_abort"]

[env]
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
Expand Down
5 changes: 3 additions & 2 deletions Build/src/Log.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[macro_export] macro_rules! Print_line {
#[macro_export]
macro_rules! Print_line {
($($tokens: tt)*) => {
println!("cargo:warning={}", format!($($tokens)*))
}
}
}
2 changes: 1 addition & 1 deletion Build/src/Main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod Log;

fn main() {
let Target = Target_type::Get_current();

Print_line!("Start Xila build");

Print_line!("Target architecture: {:?}", Target);
Expand Down
20 changes: 11 additions & 9 deletions Build/src/Target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub enum Architecture_type {
Arm,
Aarch64,
Xtensa,
RiscV
RiscV,
}

impl From<String> for Architecture_type {
Expand All @@ -30,7 +30,7 @@ pub enum Operating_system_type {
Linux,
MacOS,
ESP_IDF,
}
}

impl From<String> for Operating_system_type {
fn from(s: String) -> Self {
Expand Down Expand Up @@ -64,9 +64,9 @@ impl From<String> for Family_type {

#[derive(Debug, PartialEq)]
pub struct Target_type {
Architecture : Architecture_type,
Operating_system : Operating_system_type,
Family : Family_type,
Architecture: Architecture_type,
Operating_system: Operating_system_type,
Family: Family_type,
}

impl Target_type {
Expand All @@ -84,9 +84,11 @@ impl Target_type {

pub fn Get_current() -> Target_type {
Target_type {
Architecture : Architecture_type::from(std::env::var("CARGO_CFG_TARGET_ARCH").unwrap()),
Operating_system : Operating_system_type::from(std::env::var("CARGO_CFG_TARGET_OS").unwrap()),
Family : Family_type::from(std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap()),
Architecture: Architecture_type::from(std::env::var("CARGO_CFG_TARGET_ARCH").unwrap()),
Operating_system: Operating_system_type::from(
std::env::var("CARGO_CFG_TARGET_OS").unwrap(),
),
Family: Family_type::from(std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap()),
}
}
}
}
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ embedded-sdmmc = "0.6.0"
embedded-hal = "0.2.7"
fatfs = { version = "0.3.6" }
byteorder = "1.5.0"
lvgl = { version="0.6.2", features = [] }
embedded-graphics = "0.8.1"

[build-dependencies]
embuild = { version = "0.31.4", features = ["espidf"] }

[target.'cfg(target_arch = "x86_64")'.dependencies]
byteorder = "1.5.0"
sdl2 = { version = "0.36.0", features = [] }
lvgl = { version="0.6.2", features = [] }
embedded-graphics = "0.8.1"
50 changes: 30 additions & 20 deletions Export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ clear && echo "Setting up environment variables for Rust cross-compilation"

# Variables

Linux_environment_variables="DEP_LV_CONFIG_PATH=\"$PWD\""
Linux_target="--target x86_64-unknown-linux-gnu"
Windows_target="--target x86_64-pc-windows-gnu"

ESP32_environment_variables="MCU=esp32"
ESP32_environment_variables="MCU=esp32 DEP_LV_CONFIG_PATH='pwd'"
ESP32_target="--target xtensa-esp32-espidf --features ESP32"
ESP32_S3_environment_variables="MCU=esp32s3"
ESP32_S3_environment_variables="MCU=esp32s3 DEP_LV_CONFIG_PATH='pwd'"
ESP32_S3_target="--target xtensa-esp32s3-espidf --features ESP32_S3"

Cargo="clear && cargo"
Cargo="cargo"

# Remove all aliases
{
Expand All @@ -25,33 +26,42 @@ unalias run_linux
unalias run_windows
unalias run_esp32
unalias run_esp32_s3
unalias test_linux
unalias test_windows
unalias test_esp32
unalias test_esp32_s3
unalias check_linux
unalias check_windows
unalias check_esp32
unalias check_esp32_s3
unalias clean
} &> /dev/null

# Aliases
Clear="clear &&"
Cargo_build="$Cargo build"
alias build_linux="$Cargo_build $Linux_target"
alias build_windows="$Cargo_build $Windows_target"
alias build_esp32="$ESP32_environment_variables $Cargo_build $ESP32_target"
alias build_esp32_s3="$ESP32_S3_environment_variables $Cargo_build $ESP32_S3_target"
alias build_linux="$Clear $Linux_environment_variables $Cargo_build $Linux_target"
alias build_windows="$Clear $Cargo_build $Windows_target"
alias build_esp32="$Clear $ESP32_environment_variables $Cargo_build $ESP32_target"
alias build_esp32_s3="$Clear $ESP32_S3_environment_variables $Cargo_build $ESP32_S3_target"

Cargo_run="$Cargo run"
alias run_linux="$Cargo_run $Linux_target"
alias run_windows="$Cargo_run $Windows_target"
alias run_esp32="$ESP32_environment_variables $Cargo_run $ESP32_target"
alias run_esp32_s3="$ESP32_S3_environment_variables $Cargo_run $ESP32_S3_target"
alias run_linux="$Clear $Linux_environment_variables $Cargo_run $Linux_target"
alias run_windows="$Clear $Cargo_run $Windows_target"
alias run_esp32="$Clear $ESP32_environment_variables $Cargo_run $ESP32_target"
alias run_esp32_s3="$Clear $ESP32_S3_environment_variables $Cargo_run $ESP32_S3_target"

Cargo_test="$Cargo test"
alias test_linux="$Cargo_test $Linux_target"
alias test_windows="$Cargo_test $Windows_target"
alias test_esp32="$ESP32_environment_variables $Cargo_test $ESP32_target"
alias test_esp32_s3="$ESP32_S3_environment_variables $Cargo_test $ESP32_S3_target"
Cargo_test="RUST_MIN_STACK=8388608 $Cargo test"
alias test_linux="$Clear $Linux_environment_variables $Cargo_test $Linux_target"
alias test_windows="$Clear $Cargo_test $Windows_target"
alias test_esp32="$Clear $ESP32_environment_variables $Cargo_test $ESP32_target"
alias test_esp32_s3="$Clear $ESP32_S3_environment_variables $Cargo_test $ESP32_S3_target"

Cargo_check="$Cargo check"
alias check_linux="$Cargo_check $Linux_target"
alias check_windows="$Cargo_check $Windows_target"
alias check_esp32="$ESP32_environment_variables $Cargo_check $ESP32_target"
alias check_esp32_s3="$ESP32_S3_environment_variables $Cargo_check $ESP32_S3_target"
alias check_linux="$Clear $Linux_environment_variables $Cargo_check $Linux_target"
alias check_windows="$Clear $Cargo_check $Windows_target"
alias check_esp32="$Clear $ESP32_environment_variables $Cargo_check $ESP32_target"
alias check_esp32_s3="$Clear $ESP32_S3_environment_variables $Cargo_check $ESP32_S3_target"

alias clean="$Cargo clean"

Expand Down
Loading

0 comments on commit 9cdfcfa

Please sign in to comment.