From 6e8cae1c57a72bec09ba842e017d6b1c9bc5951e Mon Sep 17 00:00:00 2001 From: Alix ANNERAUD Date: Thu, 9 Nov 2023 00:44:41 +0100 Subject: [PATCH] Move environment variable in Export.sh --- .cargo/config.toml | 18 +++++++----------- Cargo.toml | 25 +++++++------------------ Export.sh | 32 +++++++++++++++++++------------- 3 files changed, 33 insertions(+), 42 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 84b4b0a..8f0cb18 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,22 +1,18 @@ -[build] -#target = "x86_64-unknown-linux-gnu" -target = "xtensa-esp32s3-espidf" - [target.xtensa-esp32s3-espidf] linker = "ldproxy" # runner = "espflash --monitor" # Select this runner for espflash v1.x.x 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"] +[target.xtensa-esp32-espidf] +linker = "ldproxy" +# runner = "espflash --monitor" # Select this runner for espflash v1.x.x +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"] [env] -MCU="esp32s3" # Note: this variable is not used by the pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "v5.1.1" - - - +ESP_IDF_VERSION = "v5.1.1" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 8971d6a..d0f2917 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,29 +5,16 @@ authors = ["Alix ANNERAUD "] edition = "2021" resolver = "2" rust-version = "1.71" -build = "Build/Main.rs" +build = "Build/src/Main.rs" [profile.release] -opt-level = "s" +opt-level = "s" # Optimize binary size [profile.dev] -debug = true # Symbols are nice and they don't increase the size on Flash -opt-level = "z" - - -#[build] -#target = "x86_64-unknown-linux-gnu" -#target = "xtensa-esp32s3-espidf" +debug = true # Symbols are nice and they don't increase the size on Flash. +opt-level = "z" # Optimize binary size and turn off loop vectorization. [features] -# default = ["Linux"] - - -Native_file_system = [] -Native = ["Native_file_system"] - -Linux = ["Native"] - ESP32 = ["Xtensa"] ESP32_S3 = ["Xtensa"] @@ -44,7 +31,7 @@ embassy = [ "esp-idf-svc/embassy-time-driver", ] -[target.xtensa-esp32s3-espidf.dependencies] +[target.'cfg( target_os = "espidf" )'.dependencies] esp-idf-sys = { version = "0.33.5", features = ["binstart"] } esp-idf-hal = "0.42.4" log = { version = "0.4", default-features = false } @@ -53,9 +40,11 @@ embedded-sdmmc = "0.6.0" embedded-hal = "0.2.7" fatfs = { version = "0.3.6" } byteorder = "1.5.0" +wamr-sys = { git = "https://github.com/AlixANNERAUD/wamr-sys.git" } [build-dependencies] embuild = { version = "0.31.4", features = ["espidf"] } [target.'cfg(target_arch = "x86_64")'.dependencies] byteorder = "1.5.0" +wamr-sys = { git = "https://github.com/AlixANNERAUD/wamr-sys.git" } diff --git a/Export.sh b/Export.sh index ac28421..21e191d 100644 --- a/Export.sh +++ b/Export.sh @@ -4,16 +4,21 @@ clear && echo "Setting up environment variables for Rust cross-compilation" # Variables -Linux_target="--target x86_64-unknown-linux-gnu --features Linux" -Windows_target="--target x86_64-pc-windows-gnu --features Windows" -ESP32_target="--target xtensa-esp32s3-espidf --features ESP32" + +Linux_target="--target x86_64-unknown-linux-gnu" +Windows_target="--target x86_64-pc-windows-gnu" + +ESP32_environment_variables="MCU=esp32" +ESP32_target="--target xtensa-esp32-espidf --features ESP32" +ESP32_S3_environment_variables="MCU=esp32s3" ESP32_S3_target="--target xtensa-esp32s3-espidf --features ESP32_S3" Cargo="clear && cargo" # Remove all aliases -unalias build_linux -unalias build_windows +{ +unalias build_linux +unalias build_windows unalias build_esp32 unalias build_esp32_s3 unalias run_linux @@ -21,31 +26,32 @@ unalias run_windows unalias run_esp32 unalias run_esp32_s3 unalias clean +} &> /dev/null # Aliases Cargo_build="$Cargo build" alias build_linux="$Cargo_build $Linux_target" alias build_windows="$Cargo_build $Windows_target" -alias build_esp32="$Cargo_build $ESP32_target" -alias build_esp32_s3="$Cargo_build $ESP32_S3_target" +alias build_esp32="$ESP32_environment_variables $Cargo_build $ESP32_target" +alias build_esp32_s3="$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="$Cargo_run $ESP32_target" -alias run_esp32_s3="$Cargo_run $ESP32_S3_target" +alias run_esp32="$ESP32_environment_variables $Cargo_run $ESP32_target" +alias run_esp32_s3="$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="$Cargo_test $ESP32_target" -alias test_esp32_s3="$Cargo_test $ESP32_S3_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_check="$Cargo check" alias check_linux="$Cargo_check $Linux_target" alias check_windows="$Cargo_check $Windows_target" -alias check_esp32="$Cargo_check $ESP32_target" -alias check_esp32_s3="$Cargo_check $ESP32_S3_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 clean="$Cargo clean"