Skip to content

Commit

Permalink
Move environment variable in Export.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
AlixANNERAUD committed Nov 8, 2023
1 parent bfc3151 commit 6e8cae1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 42 deletions.
18 changes: 7 additions & 11 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -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"
25 changes: 7 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,16 @@ authors = ["Alix ANNERAUD <[email protected]>"]
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"]

Expand All @@ -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 }
Expand All @@ -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" }
32 changes: 19 additions & 13 deletions Export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,54 @@
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
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"

Expand Down

0 comments on commit 6e8cae1

Please sign in to comment.