Skip to content

Commit

Permalink
Allow building psram examples in debug mode in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Sep 4, 2024
1 parent e8afa15 commit 303e174
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/actions/check-esp-hal/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ runs:
--target=${{ inputs.target }} \
esp-hal
- name: Build (examples)
env:
CI: 1
shell: bash
run: cargo +${{ inputs.toolchain }} xtask build-examples esp-hal ${{ inputs.device }} --debug
8 changes: 8 additions & 0 deletions examples/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ fn main() {
if cfg!(feature = "esp-wifi") {
println!("cargo::rustc-link-arg=-Trom_functions.x");
}

// Allow building examples in CI in debug mode
println!("cargo:rustc-check-cfg=cfg(is_not_release)");
println!("cargo:rerun-if-env-changed=CI");
#[cfg(debug_assertions)]
if std::env::var("CI").is_err() {
println!("cargo::rustc-cfg=is_not_release");
}
}
2 changes: 1 addition & 1 deletion examples/src/bin/embassy_rmt_rx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use esp_println::{print, println};

const WIDTH: usize = 80;

#[cfg(debug_assertions)]
#[cfg(is_not_release)]
compile_error!("Run this example in release mode");

#[embassy_executor::task]
Expand Down
6 changes: 3 additions & 3 deletions examples/src/bin/psram_octal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ fn init_psram_heap() {
}
}

#[cfg(is_not_release)]
compile_error!("PSRAM example must be built in release mode!");

#[entry]
fn main() -> ! {
#[cfg(debug_assertions)]
compile_error!("This example MUST be built in release mode!");

let peripherals = esp_hal::init(esp_hal::Config::default());

psram::init_psram(peripherals.PSRAM);
Expand Down
8 changes: 4 additions & 4 deletions examples/src/bin/psram_quad.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This shows how to use PSRAM as heap-memory via esp-alloc
//!
//! You need an ESP32, ESP32-S2, or ESP32-S3 with at least 2 MB of PSRAM memory.
//! You need an ESP32, ESP32-S2 or ESP32-S3 with at least 2 MB of PSRAM memory.

//% CHIPS: esp32 esp32s2 esp32s3
//% FEATURES: psram-2m
Expand All @@ -25,11 +25,11 @@ fn init_psram_heap() {
}
}

#[cfg(is_not_release)]
compile_error!("PSRAM example must be built in release mode!");

#[entry]
fn main() -> ! {
#[cfg(debug_assertions)]
compile_error!("PSRAM example must be built in release mode!");

let peripherals = esp_hal::init(esp_hal::Config::default());

psram::init_psram(peripherals.PSRAM);
Expand Down

0 comments on commit 303e174

Please sign in to comment.