mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 22:55:26 +00:00
Require float-save-restore in esp-wifi (#2322)
* Add failing test case * Make sure task contexts are properly initialised * Require float-save-restore for esp-wifi
This commit is contained in:
parent
0142703112
commit
ba8daafb0b
@ -44,6 +44,8 @@ portable_atomic_enum = { version = "0.3.1", features = ["portable-atomic"] }
|
||||
bt-hci = { version = "0.1.1", optional = true }
|
||||
esp-config = { version = "0.1.0", path = "../esp-config" }
|
||||
|
||||
xtensa-lx-rt = { version = "0.17.1", path = "../xtensa-lx-rt", optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
esp-build = { version = "0.1.0", path = "../esp-build" }
|
||||
esp-config = { version = "0.1.0", path = "../esp-config", features = ["build"] }
|
||||
@ -83,16 +85,19 @@ esp32h2 = [
|
||||
esp32 = [
|
||||
"esp-hal/esp32",
|
||||
"esp-wifi-sys/esp32",
|
||||
"xtensa-lx-rt/float-save-restore",
|
||||
]
|
||||
# Target the ESP32-S2.
|
||||
esp32s2 = [
|
||||
"esp-hal/esp32s2",
|
||||
"esp-wifi-sys/esp32s2",
|
||||
"xtensa-lx-rt/float-save-restore",
|
||||
]
|
||||
# Target the ESP32-S3.
|
||||
esp32s3 = [
|
||||
"esp-hal/esp32s3",
|
||||
"esp-wifi-sys/esp32s3",
|
||||
"xtensa-lx-rt/float-save-restore",
|
||||
]
|
||||
|
||||
## Enable Async support
|
||||
|
@ -22,7 +22,7 @@ pub fn allocate_main_task() -> *mut Context {
|
||||
}
|
||||
|
||||
let ptr = malloc(size_of::<Context>() as u32) as *mut Context;
|
||||
core::ptr::write_bytes(ptr, 0, 1);
|
||||
core::ptr::write(ptr, Context::new());
|
||||
(*ptr).next = ptr;
|
||||
*ctx_now = ptr;
|
||||
ptr
|
||||
@ -37,7 +37,7 @@ fn allocate_task() -> *mut Context {
|
||||
}
|
||||
|
||||
let ptr = malloc(size_of::<Context>() as u32) as *mut Context;
|
||||
core::ptr::write_bytes(ptr, 0, 1);
|
||||
core::ptr::write(ptr, Context::new());
|
||||
(*ptr).next = (**ctx_now).next;
|
||||
(**ctx_now).next = ptr;
|
||||
ptr
|
||||
|
@ -11,6 +11,17 @@ pub struct Context {
|
||||
pub allocated_stack: *const u8,
|
||||
}
|
||||
|
||||
impl Context {
|
||||
pub fn new() -> Self {
|
||||
Context {
|
||||
trap_frame: TrapFrame::default(),
|
||||
thread_semaphore: 0,
|
||||
next: core::ptr::null_mut(),
|
||||
allocated_stack: core::ptr::null(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn task_create(
|
||||
task: extern "C" fn(*mut c_types::c_void),
|
||||
param: *mut c_types::c_void,
|
||||
|
@ -11,6 +11,17 @@ pub struct Context {
|
||||
pub allocated_stack: *const u8,
|
||||
}
|
||||
|
||||
impl Context {
|
||||
pub fn new() -> Self {
|
||||
Context {
|
||||
trap_frame: TrapFrame::new(),
|
||||
thread_semaphore: 0,
|
||||
next: core::ptr::null_mut(),
|
||||
allocated_stack: core::ptr::null(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn task_create(
|
||||
task: extern "C" fn(*mut c_types::c_void),
|
||||
param: *mut c_types::c_void,
|
||||
@ -28,7 +39,7 @@ pub fn task_create(
|
||||
|
||||
// stack must be aligned by 16
|
||||
let task_stack_ptr = stack as usize + task_stack_size;
|
||||
let stack_ptr = task_stack_ptr - (task_stack_ptr % 0x10);
|
||||
let stack_ptr = task_stack_ptr - (task_stack_ptr % 16);
|
||||
(*ctx).trap_frame.A1 = stack_ptr as u32;
|
||||
|
||||
(*ctx).trap_frame.PS = 0x00040000 | (1 & 3) << 16; // For windowed ABI set WOE and CALLINC (pretend task was 'call4'd).
|
||||
|
@ -249,18 +249,21 @@ esp32c3 = [
|
||||
"esp-hal/esp32c3",
|
||||
"esp-hal-embassy/esp32c3",
|
||||
"esp-wifi?/esp32c3",
|
||||
"esp-wifi?/phy-enable-usb",
|
||||
]
|
||||
esp32c6 = [
|
||||
"esp-backtrace/esp32c6",
|
||||
"esp-hal/esp32c6",
|
||||
"esp-hal-embassy/esp32c6",
|
||||
"esp-wifi?/esp32c6",
|
||||
"esp-wifi?/phy-enable-usb",
|
||||
]
|
||||
esp32h2 = [
|
||||
"esp-backtrace/esp32h2",
|
||||
"esp-hal/esp32h2",
|
||||
"esp-hal-embassy/esp32h2",
|
||||
"esp-wifi?/esp32h2",
|
||||
"esp-wifi?/phy-enable-usb",
|
||||
]
|
||||
esp32s2 = [
|
||||
"embedded-test/xtensa-semihosting",
|
||||
@ -275,6 +278,7 @@ esp32s3 = [
|
||||
"esp-hal/esp32s3",
|
||||
"esp-hal-embassy/esp32s3",
|
||||
"esp-wifi?/esp32s3",
|
||||
"esp-wifi?/phy-enable-usb",
|
||||
]
|
||||
# Async & Embassy:
|
||||
embassy = [
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
//% CHIPS: esp32 esp32s2 esp32s3
|
||||
//% FEATURES: esp-wifi esp-alloc
|
||||
//% FEATURES: esp-wifi esp-alloc xtensa-lx-rt/float-save-restore
|
||||
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
Loading…
x
Reference in New Issue
Block a user