mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-27 07:45:28 +00:00
fix comp time and rename feature to psram
This commit is contained in:
44
Cargo.lock
generated
44
Cargo.lock
generated
@@ -161,12 +161,6 @@ version = "0.8.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
|
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bit_field"
|
|
||||||
version = "0.10.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitfield"
|
name = "bitfield"
|
||||||
version = "0.13.2"
|
version = "0.13.2"
|
||||||
@@ -972,18 +966,6 @@ dependencies = [
|
|||||||
"nb 1.1.0",
|
"nb 1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "embedded-iconoir"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c52b9899b636b56d4e66834f7a90766d0bc6600c0f067d91ed0711b11fa3f5c8"
|
|
||||||
dependencies = [
|
|
||||||
"bit_field",
|
|
||||||
"embedded-graphics",
|
|
||||||
"paste",
|
|
||||||
"static_assertions",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-io"
|
name = "embedded-io"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
@@ -1144,12 +1126,6 @@ version = "1.0.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "foldhash"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "funty"
|
name = "funty"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
@@ -1348,7 +1324,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hash32",
|
"hash32",
|
||||||
"serde",
|
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1502,7 +1477,6 @@ dependencies = [
|
|||||||
"embedded-text",
|
"embedded-text",
|
||||||
"goblin",
|
"goblin",
|
||||||
"heapless",
|
"heapless",
|
||||||
"kolibri-embedded-gui",
|
|
||||||
"num_enum 0.7.4",
|
"num_enum 0.7.4",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"panic-probe",
|
"panic-probe",
|
||||||
@@ -1516,18 +1490,6 @@ dependencies = [
|
|||||||
"trouble-host",
|
"trouble-host",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "kolibri-embedded-gui"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "011f8f415e8c2f03e4ad752afcf1bb156a18926250401b1fe29d8feda644c140"
|
|
||||||
dependencies = [
|
|
||||||
"embedded-graphics",
|
|
||||||
"embedded-iconoir",
|
|
||||||
"foldhash",
|
|
||||||
"heapless",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lalrpop"
|
name = "lalrpop"
|
||||||
version = "0.19.12"
|
version = "0.19.12"
|
||||||
@@ -2352,12 +2314,6 @@ version = "1.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "static_assertions"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "static_cell"
|
name = "static_cell"
|
||||||
version = "2.1.1"
|
version = "2.1.1"
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ doctest = false
|
|||||||
bench = false
|
bench = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rp235x", "defmt", "fps"]
|
default = ["rp235x", "defmt"]
|
||||||
pimoroni2w = ["rp235x"]
|
pimoroni2w = ["rp235x", "psram"]
|
||||||
rp2040 = ["embassy-rp/rp2040"]
|
# rp2040 = ["embassy-rp/rp2040"] # unsupported, ram too small for fb
|
||||||
rp235x = ["embassy-rp/rp235xb"]
|
rp235x = ["embassy-rp/rp235xb"]
|
||||||
trouble = ["dep:bt-hci", "dep:cyw43", "dep:cyw43-pio", "dep:trouble-host"]
|
trouble = ["dep:bt-hci", "dep:cyw43", "dep:cyw43-pio", "dep:trouble-host"]
|
||||||
|
psram = ["dep:embedded-alloc"]
|
||||||
|
fps = []
|
||||||
defmt = [
|
defmt = [
|
||||||
"dep:defmt",
|
"dep:defmt",
|
||||||
"panic-probe/print-defmt",
|
"panic-probe/print-defmt",
|
||||||
@@ -30,7 +32,6 @@ defmt = [
|
|||||||
# "cyw43/defmt",
|
# "cyw43/defmt",
|
||||||
# "cyw43-pio/defmt",
|
# "cyw43-pio/defmt",
|
||||||
]
|
]
|
||||||
fps = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-executor = { version = "0.9", features = [
|
embassy-executor = { version = "0.9", features = [
|
||||||
@@ -79,7 +80,6 @@ st7365p-lcd = { git = "https://github.com/legitcamper/st7365p-lcd-rs", rev = "a7
|
|||||||
embedded-graphics = { version = "0.8.1" }
|
embedded-graphics = { version = "0.8.1" }
|
||||||
embedded-text = "0.7.2"
|
embedded-text = "0.7.2"
|
||||||
embedded-layout = "0.4.2"
|
embedded-layout = "0.4.2"
|
||||||
kolibri-embedded-gui = "0.1.0"
|
|
||||||
|
|
||||||
strum = { version = "0.27.2", default-features = false }
|
strum = { version = "0.27.2", default-features = false }
|
||||||
rand = { version = "0.9.0", default-features = false }
|
rand = { version = "0.9.0", default-features = false }
|
||||||
@@ -91,7 +91,9 @@ spin = "0.10.0"
|
|||||||
num_enum = { version = "0.7.4", default-features = false }
|
num_enum = { version = "0.7.4", default-features = false }
|
||||||
goblin = { version = "0.10.1", default-features = false, features = ["elf32"] }
|
goblin = { version = "0.10.1", default-features = false, features = ["elf32"] }
|
||||||
talc = "4.4.3"
|
talc = "4.4.3"
|
||||||
embedded-alloc = { version = "0.6.0", features = ["allocator_api"] }
|
embedded-alloc = { version = "0.6.0", features = [
|
||||||
|
"allocator_api",
|
||||||
|
], optional = true }
|
||||||
bumpalo = "3.19.0"
|
bumpalo = "3.19.0"
|
||||||
|
|
||||||
abi_sys = { path = "../abi_sys" }
|
abi_sys = { path = "../abi_sys" }
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ use embedded_graphics::draw_target::DrawTarget;
|
|||||||
use embedded_sdmmc::LfnBuffer;
|
use embedded_sdmmc::LfnBuffer;
|
||||||
use heapless::spsc::Queue;
|
use heapless::spsc::Queue;
|
||||||
|
|
||||||
|
#[cfg(feature = "psram")]
|
||||||
|
use crate::heap::HEAP;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
display::FRAMEBUFFER,
|
display::FRAMEBUFFER,
|
||||||
framebuffer::FB_PAUSED,
|
framebuffer::FB_PAUSED,
|
||||||
@@ -20,10 +23,14 @@ const _: AllocAbi = alloc;
|
|||||||
pub extern "C" fn alloc(layout: CLayout) -> *mut u8 {
|
pub extern "C" fn alloc(layout: CLayout) -> *mut u8 {
|
||||||
// SAFETY: caller guarantees layout is valid
|
// SAFETY: caller guarantees layout is valid
|
||||||
unsafe {
|
unsafe {
|
||||||
if cfg!(feature = "pimoroni2w") {
|
#[cfg(feature = "psram")]
|
||||||
crate::heap::HEAP.alloc(layout.into())
|
{
|
||||||
} else {
|
return HEAP.alloc(layout.into());
|
||||||
alloc::alloc::alloc(layout.into())
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "psram"))]
|
||||||
|
{
|
||||||
|
return alloc::alloc::alloc(layout.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,12 +38,14 @@ pub extern "C" fn alloc(layout: CLayout) -> *mut u8 {
|
|||||||
const _: DeallocAbi = dealloc;
|
const _: DeallocAbi = dealloc;
|
||||||
pub extern "C" fn dealloc(ptr: *mut u8, layout: CLayout) {
|
pub extern "C" fn dealloc(ptr: *mut u8, layout: CLayout) {
|
||||||
// SAFETY: caller guarantees ptr and layout are valid
|
// SAFETY: caller guarantees ptr and layout are valid
|
||||||
unsafe {
|
#[cfg(feature = "psram")]
|
||||||
if cfg!(feature = "pimoroni2w") {
|
{
|
||||||
crate::heap::HEAP.dealloc(ptr, layout.into())
|
unsafe { HEAP.dealloc(ptr, layout.into()) }
|
||||||
} else {
|
|
||||||
alloc::alloc::dealloc(ptr, layout.into())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "psram"))]
|
||||||
|
{
|
||||||
|
unsafe { alloc::alloc::dealloc(ptr, layout.into()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ use embedded_graphics::{
|
|||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||||
use st7365p_lcd::ST7365P;
|
use st7365p_lcd::ST7365P;
|
||||||
|
|
||||||
|
#[cfg(feature = "psram")]
|
||||||
|
use crate::heap::HEAP;
|
||||||
|
|
||||||
#[cfg(feature = "fps")]
|
#[cfg(feature = "fps")]
|
||||||
pub use framebuffer::fps::{FPS_CANVAS, FPS_COUNTER};
|
pub use framebuffer::fps::{FPS_CANVAS, FPS_COUNTER};
|
||||||
|
|
||||||
@@ -32,18 +35,21 @@ pub static mut FRAMEBUFFER: Option<AtomicFrameBuffer> = None;
|
|||||||
|
|
||||||
fn init_fb() {
|
fn init_fb() {
|
||||||
unsafe {
|
unsafe {
|
||||||
FRAMEBUFFER = Some(if cfg!(not(feature = "pimoroni2w")) {
|
#[cfg(feature = "psram")]
|
||||||
static mut BUF: [u16; framebuffer::SIZE] = [0; framebuffer::SIZE];
|
{
|
||||||
AtomicFrameBuffer::new(&mut BUF)
|
let slab = HEAP.alloc(Layout::array::<u16>(framebuffer::SIZE).unwrap()) as *mut u16;
|
||||||
} else {
|
|
||||||
let slab = crate::heap::HEAP.alloc(Layout::array::<u16>(framebuffer::SIZE).unwrap())
|
|
||||||
as *mut u16;
|
|
||||||
let buf = core::slice::from_raw_parts_mut(slab, framebuffer::SIZE);
|
let buf = core::slice::from_raw_parts_mut(slab, framebuffer::SIZE);
|
||||||
|
|
||||||
let mut fb = AtomicFrameBuffer::new(buf);
|
let mut fb = AtomicFrameBuffer::new(buf);
|
||||||
fb.clear(Rgb565::BLACK).unwrap();
|
fb.clear(Rgb565::BLACK).unwrap();
|
||||||
fb
|
FRAMEBUFFER = Some(fb);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "psram"))]
|
||||||
|
{
|
||||||
|
static mut BUF: [u16; framebuffer::SIZE] = [0; framebuffer::SIZE];
|
||||||
|
FRAMEBUFFER = Some(AtomicFrameBuffer::new(&mut BUF));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,29 +12,30 @@ mod abi;
|
|||||||
mod display;
|
mod display;
|
||||||
mod elf;
|
mod elf;
|
||||||
mod framebuffer;
|
mod framebuffer;
|
||||||
#[allow(unused)]
|
|
||||||
mod heap;
|
|
||||||
mod peripherals;
|
mod peripherals;
|
||||||
#[allow(unused)]
|
|
||||||
mod psram;
|
|
||||||
mod scsi;
|
mod scsi;
|
||||||
mod storage;
|
mod storage;
|
||||||
mod ui;
|
mod ui;
|
||||||
mod usb;
|
mod usb;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
#[cfg(feature = "pimoroni2w")]
|
#[cfg(feature = "psram")]
|
||||||
use crate::{heap::init_qmi_psram_heap, psram::init_psram_qmi};
|
#[allow(unused)]
|
||||||
|
mod heap;
|
||||||
|
#[cfg(feature = "psram")]
|
||||||
|
#[allow(unused)]
|
||||||
|
mod psram;
|
||||||
|
|
||||||
|
#[cfg(feature = "psram")]
|
||||||
|
use crate::{heap::HEAP, heap::init_qmi_psram_heap, psram::init_psram, psram::init_psram_qmi};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
abi::{KEY_CACHE, MS_SINCE_LAUNCH},
|
abi::{KEY_CACHE, MS_SINCE_LAUNCH},
|
||||||
display::{FRAMEBUFFER, display_handler, init_display},
|
display::{FRAMEBUFFER, display_handler, init_display},
|
||||||
heap::HEAP,
|
|
||||||
peripherals::{
|
peripherals::{
|
||||||
conf_peripherals,
|
conf_peripherals,
|
||||||
keyboard::{KeyState, read_keyboard_fifo},
|
keyboard::{KeyState, read_keyboard_fifo},
|
||||||
},
|
},
|
||||||
psram::init_psram,
|
|
||||||
scsi::MSC_SHUTDOWN,
|
scsi::MSC_SHUTDOWN,
|
||||||
storage::{SDCARD, SdCard},
|
storage::{SDCARD, SdCard},
|
||||||
ui::{SELECTIONS, clear_selection, ui_handler},
|
ui::{SELECTIONS, clear_selection, ui_handler},
|
||||||
@@ -270,22 +271,22 @@ async fn setup_display(display: Display, spawner: Spawner) {
|
|||||||
|
|
||||||
// psram is kind of useless on the pico calc
|
// psram is kind of useless on the pico calc
|
||||||
// ive opted to use the pimoroni with on onboard xip psram instead
|
// ive opted to use the pimoroni with on onboard xip psram instead
|
||||||
async fn setup_psram(psram: Psram) {
|
// async fn setup_psram(psram: Psram) {
|
||||||
let psram = init_psram(
|
// let psram = init_psram(
|
||||||
psram.pio, psram.sclk, psram.mosi, psram.miso, psram.cs, psram.dma1, psram.dma2,
|
// psram.pio, psram.sclk, psram.mosi, psram.miso, psram.cs, psram.dma1, psram.dma2,
|
||||||
)
|
// )
|
||||||
.await;
|
// .await;
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
// #[cfg(feature = "defmt")]
|
||||||
defmt::info!("psram size: {}", psram.size);
|
// defmt::info!("psram size: {}", psram.size);
|
||||||
|
|
||||||
if psram.size == 0 {
|
// if psram.size == 0 {
|
||||||
#[cfg(feature = "defmt")]
|
// #[cfg(feature = "defmt")]
|
||||||
defmt::info!("\u{1b}[1mExternal PSRAM was NOT found!\u{1b}[0m");
|
// defmt::info!("\u{1b}[1mExternal PSRAM was NOT found!\u{1b}[0m");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[cfg(feature = "pimoroni2w")]
|
#[cfg(feature = "psram")]
|
||||||
async fn setup_qmi_psram() {
|
async fn setup_qmi_psram() {
|
||||||
Timer::after_millis(250).await;
|
Timer::after_millis(250).await;
|
||||||
let psram_qmi_size = init_psram_qmi(&embassy_rp::pac::QMI, &embassy_rp::pac::XIP_CTRL);
|
let psram_qmi_size = init_psram_qmi(&embassy_rp::pac::QMI, &embassy_rp::pac::XIP_CTRL);
|
||||||
@@ -322,7 +323,7 @@ async fn kernel_task(
|
|||||||
watchdog: Peri<'static, WATCHDOG>,
|
watchdog: Peri<'static, WATCHDOG>,
|
||||||
display: Display,
|
display: Display,
|
||||||
sd: Sd,
|
sd: Sd,
|
||||||
psram: Psram,
|
_psram: Psram,
|
||||||
mcu: Mcu,
|
mcu: Mcu,
|
||||||
usb: Peri<'static, USB>,
|
usb: Peri<'static, USB>,
|
||||||
) {
|
) {
|
||||||
@@ -337,7 +338,7 @@ async fn kernel_task(
|
|||||||
Timer::after_millis(100).await;
|
Timer::after_millis(100).await;
|
||||||
|
|
||||||
// setup_psram(psram).await;
|
// setup_psram(psram).await;
|
||||||
#[cfg(feature = "pimoroni2w")]
|
#[cfg(feature = "psram")]
|
||||||
setup_qmi_psram().await;
|
setup_qmi_psram().await;
|
||||||
|
|
||||||
Timer::after_millis(100).await;
|
Timer::after_millis(100).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user