Fix Rust build of printerdemo_mcu on the s2 kaluga kit

- Update compiler flags
- Update to latest HAL
- Remove floating pointer arithmetic functions that are now implemented
This commit is contained in:
Simon Hausmann 2023-08-11 10:26:19 +02:00
parent 9edd8d1dce
commit 9c614e00a7
3 changed files with 20 additions and 31 deletions

View file

@ -52,7 +52,7 @@ embedded-time = { version = "0.12.0", optional = true }
embedded-display-controller = { version = "0.1.0", optional = true }
ft5336 = { version = "0.2", optional = true }
esp32s2-hal = { version = "0.9", optional = true }
esp32s2-hal = { version = "0.11", optional = true }
esp32s3-hal = { version = "0.9", optional = true }
xtensa-lx-rt = { version = "0.15", optional = true }
display-interface-spi = { version = "0.4", optional = true }

View file

@ -63,9 +63,11 @@ impl slint::platform::Platform for EspBackend {
// Disable the RTC and TIMG watchdog timers
let mut rtc_cntl = Rtc::new(peripherals.RTC_CNTL);
let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks);
let timer_group0 =
TimerGroup::new(peripherals.TIMG0, &clocks, &mut system.peripheral_clock_control);
let mut wdt0 = timer_group0.wdt;
let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks);
let timer_group1 =
TimerGroup::new(peripherals.TIMG1, &clocks, &mut system.peripheral_clock_control);
let mut wdt1 = timer_group1.wdt;
rtc_cntl.rwdt.disable();
@ -159,29 +161,3 @@ impl<
.unwrap();
}
}
// FIXME: implement properly upstream
#[no_mangle]
extern "C" fn fmaxf(a: f32, b: f32) -> f32 {
if a > b {
a
} else {
b
}
}
#[no_mangle]
extern "C" fn fminf(a: f32, b: f32) -> f32 {
if a < b {
a
} else {
b
}
}
#[no_mangle]
extern "C" fn fmodf() {
unimplemented!("fmodf");
}
#[no_mangle]
extern "C" fn fmod(a: f64, b: f64) -> f64 {
((a as u32) % (b as u32)) as f64
}

View file

@ -10,8 +10,21 @@ rustflags = [
"-C",
"target-feature=+s32c1i",
# Tell the `core` library that we have atomics, even though it's not
# specified in the target definition
# tell the core library have atomics even though it's not specified in the target definition
"--cfg",
'target_has_atomic_load_store',
"--cfg",
'target_has_atomic_load_store="8"',
"--cfg",
'target_has_atomic_load_store="16"',
"--cfg",
'target_has_atomic_load_store="32"',
"--cfg",
'target_has_atomic_load_store="ptr"',
# enable cas
"--cfg",
'target_has_atomic',
"--cfg",
'target_has_atomic="8"',
"--cfg",