Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Housekeeping: fix warnings, rename some examples, etc. #1786

Merged
merged 5 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ jobs:
- soc: esp32h2
rust-target: riscv32imac-unknown-none-elf
# Xtensa devices:
- soc: esp32
- soc: esp32s2
- soc: esp32s3

Expand Down
5 changes: 3 additions & 2 deletions esp-backtrace/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![allow(rustdoc::bare_urls, unused_macros)]
#![cfg_attr(
any(nightly_before_2024_06_12, nightly_since_2024_06_12),
target_arch = "xtensa",
feature(asm_experimental_arch),
feature(panic_info_message)
)]
Comment on lines 2 to 6
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, this is just protecting against a single nightly version which is past us now. These changes were made to prevent a warning when building with newer nightly versions.

#![cfg_attr(target_arch = "xtensa", feature(asm_experimental_arch))]
#![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://github.com/avatars/u/46717278")]
#![no_std]
Expand Down Expand Up @@ -159,6 +159,7 @@ unsafe fn __user_exception(cause: arch::ExceptionCause, context: arch::Context)
#[cfg(feature = "semihosting")]
semihosting::process::abort();

#[cfg(not(feature = "semihosting"))]
halt();
}

Expand Down
5 changes: 4 additions & 1 deletion esp-hal-embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ document-features = "0.2.8"
embassy-executor = { version = "0.5.0", optional = true }
embassy-time-driver = { version = "0.1.0", features = [ "tick-hz-1_000_000" ] }
esp-hal = { version = "0.18.0", path = "../esp-hal" }
log = { version = "0.4.22", optional = true }
portable-atomic = "1.6.0"
log = { version = "0.4.22", optional = true }

[build-dependencies]
cfg-if = "1.0.0"
Expand All @@ -45,3 +45,6 @@ log = ["dep:log"]
executors = ["dep:embassy-executor"]
## Use the executor-integrated `embassy-time` timer queue.
integrated-timers = ["embassy-executor?/integrated-timers"]

[lints.rust]
unexpected_cfgs = "allow"
5 changes: 3 additions & 2 deletions esp-println/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ portable-atomic = { version = "1.6.0", optional = true, default-features = fal
esp-build = { version = "0.1.0", path = "../esp-build" }

[features]
default = ["dep:critical-section", "colors", "auto"]
log = ["dep:log"]
default = ["critical-section", "colors", "auto"]
critical-section = ["dep:critical-section"]
log = ["dep:log"]

# You must enable exactly 1 of the below features to support the correct chip:
esp32 = []
Expand Down
2 changes: 1 addition & 1 deletion examples/src/bin/etm_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn main() -> ! {
..Default::default()
}),
);
let mut timer0 = timg0.timer0;
let timer0 = timg0.timer0;

// Configure ETM to stop timer0 when alarm is triggered
let event = timer0.on_alarm();
Expand Down
6 changes: 3 additions & 3 deletions examples/src/bin/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ fn main() -> ! {
println!("SYSTIMER Current value = {}", SystemTimer::now());

critical_section::with(|cs| {
let mut alarm0 = systimer.alarm0.into_periodic();
let alarm0 = systimer.alarm0.into_periodic();
alarm0.set_interrupt_handler(systimer_target0);
alarm0.set_period(1u32.secs());
alarm0.enable_interrupt(true);

let mut alarm1 = systimer.alarm1;
let alarm1 = systimer.alarm1;
alarm1.set_interrupt_handler(systimer_target1);
alarm1.set_target(SystemTimer::now() + (SystemTimer::TICKS_PER_SECOND * 2));
alarm1.enable_interrupt(true);

let mut alarm2 = systimer.alarm2;
let alarm2 = systimer.alarm2;
alarm2.set_interrupt_handler(systimer_target2);
alarm2.set_target(SystemTimer::now() + (SystemTimer::TICKS_PER_SECOND * 3));
alarm2.enable_interrupt(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const PASSWORD: &str = env!("PASSWORD");

#[entry]
fn main() -> ! {
#[cfg(feature = "log")]
esp_println::logger::init_logger(log::LevelFilter::Info);

let peripherals = Peripherals::take();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion hil-test/tests/aes_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use esp_hal::{
dma::{Dma, DmaPriority},
dma_buffers,
peripherals::Peripherals,
prelude::*,
};

const DMA_BUFFER_SIZE: usize = 16;
Expand Down
1 change: 1 addition & 0 deletions hil-test/tests/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use esp_hal::{

static SWINT0: Mutex<RefCell<Option<SoftwareInterrupt<0>>>> = Mutex::new(RefCell::new(None));

#[allow(unused)] // TODO: Remove attribute when interrupt latency test re-enabled
struct Context {
sw0_trigger_addr: u32,
}
Expand Down
4 changes: 1 addition & 3 deletions hil-test/tests/pcnt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#![no_std]
#![no_main]

use core::ops::Deref;

use defmt_rtt as _;
use esp_backtrace as _;
use esp_hal::{delay::Delay, gpio::GpioPin, pcnt::Pcnt};
Expand Down Expand Up @@ -44,7 +42,7 @@ mod tests {
let system = SystemControl::new(peripherals.SYSTEM);
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();

let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);

Context {
pcnt: Pcnt::new(peripherals.PCNT, None),
Expand Down
2 changes: 1 addition & 1 deletion hil-test/tests/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod tests {
#[cfg(feature = "esp32")]
{
let mut rsamulti =
RsaMultiplication::<operand_sizes::Op512, esp_hal::Blocking>::new(ctx.rsa);
RsaMultiplication::<operand_sizes::Op512, esp_hal::Blocking>::new(&mut ctx.rsa);
rsamulti.start_multiplication(operand_a, operand_b);
rsamulti.read_results(&mut outbuf);
}
Expand Down
14 changes: 9 additions & 5 deletions hil-test/tests/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ mod tests {

#[cfg(not(feature = "esp32s2"))]
{
#[cfg(not(any(feature = "esp32c3", feature = "esp32c2")))]
#[cfg(not(any(feature = "esp32", feature = "esp32c3", feature = "esp32c2")))]
{
// 9600 baud, RC FAST clock source:
ctx.uart.change_baud(9600, ClockSource::RcFast, &ctx.clocks);
Expand All @@ -110,17 +110,21 @@ mod tests {
}

// 19,200 baud, XTAL clock source:
ctx.uart.change_baud(19_200, ClockSource::Xtal, &ctx.clocks);
ctx.uart.write(55).ok();
let read = block!(ctx.uart.read());
assert_eq!(read, Ok(55));
#[cfg(not(feature = "esp32"))]
{
ctx.uart.change_baud(19_200, ClockSource::Xtal, &ctx.clocks);
ctx.uart.write(55).ok();
let read = block!(ctx.uart.read());
assert_eq!(read, Ok(55));
}

// 921,600 baud, APB clock source:
ctx.uart.change_baud(921_600, ClockSource::Apb, &ctx.clocks);
ctx.uart.write(253).ok();
let read = block!(ctx.uart.read());
assert_eq!(read, Ok(253));
}

#[cfg(feature = "esp32s2")]
{
// 9600 baud, REF TICK clock source:
Expand Down