From 014b099986557f919418fff3250560a3ce4f545d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Hlusi=C4=8Dka?= Date: Sun, 1 Mar 2026 00:51:46 +0100 Subject: [PATCH] Significantly increase internal RAM heap size --- firmware/Cargo.lock | 55 +++++++++++++++++++++++++----- firmware/acid-firmware/src/main.rs | 54 +++++++++++++++-------------- firmware/acid-firmware/src/ram.rs | 2 +- 3 files changed, 75 insertions(+), 36 deletions(-) diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock index 414d2d1..86792da 100644 --- a/firmware/Cargo.lock +++ b/firmware/Cargo.lock @@ -2068,18 +2068,17 @@ dependencies = [ [[package]] name = "esp-backtrace" version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3318413fb566c7227387f67736cf70cd74d80a11f2bb31c7b95a9eb48d079669" +source = "git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899#114977583886be4ed866ad7b7c6f16865148e899" dependencies = [ "cfg-if", "document-features", - "esp-config 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "esp-metadata-generated 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "esp-config 0.6.1 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", + "esp-metadata-generated 0.3.0 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", "esp-println", "heapless 0.9.2", "riscv", "semihosting", - "xtensa-lx 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "xtensa-lx 0.13.0 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", ] [[package]] @@ -2113,6 +2112,18 @@ dependencies = [ "somni-expr", ] +[[package]] +name = "esp-config" +version = "0.6.1" +source = "git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899#114977583886be4ed866ad7b7c6f16865148e899" +dependencies = [ + "document-features", + "esp-metadata-generated 0.3.0 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", + "serde", + "serde_yaml", + "somni-expr", +] + [[package]] name = "esp-config" version = "0.6.1" @@ -2212,6 +2223,11 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a93e39c8ad8d390d248dc7b9f4b59a873f313bf535218b8e2351356972399e3" +[[package]] +name = "esp-metadata-generated" +version = "0.3.0" +source = "git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899#114977583886be4ed866ad7b7c6f16865148e899" + [[package]] name = "esp-metadata-generated" version = "0.3.0" @@ -2235,12 +2251,11 @@ dependencies = [ [[package]] name = "esp-println" version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a30e6c9fbcc01c348d46706fef8131c7775ab84c254a3cd65d0cd3f6414d592" +source = "git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899#114977583886be4ed866ad7b7c6f16865148e899" dependencies = [ "document-features", - "esp-metadata-generated 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "esp-sync 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "esp-metadata-generated 0.3.0 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", + "esp-sync 0.1.1 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", "log", "portable-atomic", ] @@ -2358,6 +2373,20 @@ dependencies = [ "xtensa-lx 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "esp-sync" +version = "0.1.1" +source = "git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899#114977583886be4ed866ad7b7c6f16865148e899" +dependencies = [ + "cfg-if", + "document-features", + "embassy-sync 0.6.2", + "embassy-sync 0.7.2", + "esp-metadata-generated 0.3.0 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", + "riscv", + "xtensa-lx 0.13.0 (git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899)", +] + [[package]] name = "esp-sync" version = "0.1.1" @@ -8562,6 +8591,14 @@ dependencies = [ "critical-section", ] +[[package]] +name = "xtensa-lx" +version = "0.13.0" +source = "git+https://github.com/Limeth/esp-hal.git?rev=114977583886be4ed866ad7b7c6f16865148e899#114977583886be4ed866ad7b7c6f16865148e899" +dependencies = [ + "critical-section", +] + [[package]] name = "xtensa-lx" version = "0.13.0" diff --git a/firmware/acid-firmware/src/main.rs b/firmware/acid-firmware/src/main.rs index b82ec54..f1ca8c6 100644 --- a/firmware/acid-firmware/src/main.rs +++ b/firmware/acid-firmware/src/main.rs @@ -454,32 +454,34 @@ async fn initialize_display_and_renderer( let st7701s = display_peripherals.into_display().await; static FRAMEBUFFER: StaticCell = StaticCell::new(); - let framebuffer = FRAMEBUFFER.init(Framebuffer::new( - dma_ch0, - spi2.into(), - st7701s.dpi, - BurstConfig { - internal_memory: InternalBurstConfig::Enabled, - external_memory: ExternalBurstConfig::Size32, - }, - // The burst config (16/32/64) doesn't seem to affect the alignment of the row size. - // - // | | ( displayed range ) | - // | [ pad ] [ pad ] - // | [ DMA-transmissible range ] - // [ DMA-t. left overscan ] | | | - // 0 112 120 360 368 (index of u16 pixel) - // ^ aligned ^ aligned ^ aligned - // - // TODO: Compute the appropriate ranges to pass to the renderer and DPI peripheral. - // The renderer should pass the size of the `pad`ding to the GUI is parameters, - // to align the content to the displayed range. - 112, - 368 - 112, - 960, - 16, - true, - )); + let framebuffer = FRAMEBUFFER.init_with(move || { + Framebuffer::new( + dma_ch0, + spi2.into(), + st7701s.dpi, + BurstConfig { + internal_memory: InternalBurstConfig::Enabled, + external_memory: ExternalBurstConfig::Size32, + }, + // The burst config (16/32/64) doesn't seem to affect the alignment of the row size. + // + // | | ( displayed range ) | + // | [ pad ] [ pad ] + // | [ DMA-transmissible range ] + // [ DMA-t. left overscan ] | | | + // 0 112 120 360 368 (index of u16 pixel) + // ^ aligned ^ aligned ^ aligned + // + // TODO: Compute the appropriate ranges to pass to the renderer and DPI peripheral. + // The renderer should pass the size of the `pad`ding to the GUI is parameters, + // to align the content to the displayed range. + 112, + 368 - 112, + 960, + 16, + true, + ) + }); info!("Framebuffer created!"); diff --git a/firmware/acid-firmware/src/ram.rs b/firmware/acid-firmware/src/ram.rs index c72e610..faf9cfd 100644 --- a/firmware/acid-firmware/src/ram.rs +++ b/firmware/acid-firmware/src/ram.rs @@ -13,7 +13,7 @@ use log::{info, warn}; // ``` /// Total heap size -pub const HEAP_SIZE: usize = 112 * 1024; +pub const HEAP_SIZE: usize = 196 * 1024; /// Size of the app core's stack pub const STACK_SIZE_CORE_APP: usize = 80 * 1024;