stm32h7: move LCD framebuffer to AXI SRAM

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit d15bb5f8488715901809cf8373f9994fcb24a2a8
Author: Aidan MacDonald <[email protected]>
Date:   Thu Jan 22 14:20:36 2026 +0000

    stm32h7: move LCD framebuffer to AXI SRAM
    
    Framebuffer access consumes a lot of SDRAM bandwidth.
    Moving it to AXI SRAM should be a big improvement as
    it's around 8x faster (2x clock speed, 4x bus width).
    
    Also take advantage of explicitly assigning sections
    to the special :NONE segment, which means they will
    not appear in any ELF program header and thus aren't
    visible to the bootloader. They can then overlap
    areas used by the bootloader -- by the time they're
    written, the bootloader will be long gone -- making
    it easier to make efficient use of SRAM.
    
    Change-Id: I2392fd23b17472cc08dc5fe4556f6def3cc186ed

diff --git a/firmware/export/config/echor1.h b/firmware/export/config/echor1.h
index 3674419c17..8d70ebe081 100644
--- a/firmware/export/config/echor1.h
+++ b/firmware/export/config/echor1.h
@@ -37,6 +37,7 @@
 #define HAVE_LCD_BITMAP
 #define HAVE_LCD_ENABLE
 #define HAVE_LCD_SHUTDOWN
+#define IRAM_LCDFRAMEBUFFER __attribute__((section(".framebuffer")))
 
 /* Backlight defines */
 #define HAVE_BACKLIGHT
diff --git a/firmware/target/arm/stm32/app.lds b/firmware/target/arm/stm32/app.lds
index fc8bd381f7..d51ed57858 100644
--- a/firmware/target/arm/stm32/app.lds
+++ b/firmware/target/arm/stm32/app.lds
@@ -7,9 +7,16 @@ STARTUP(target/arm/stm32/crt0-stm32h7.o)
 
 MEMORY
 {
-    DTCM  (rw)  : ORIGIN = STM32_DTCM_BASE,   LENGTH = STM32_DTCM_SIZE
-    ITCM  (rx)  : ORIGIN = STM32_ITCM_BASE,   LENGTH = STM32_ITCM_SIZE
-    SDRAM (rwx) : ORIGIN = STM32_SDRAM1_BASE, LENGTH = MEMORYSIZE * 1024 * 1024
+    DTCM     (rw)  : ORIGIN = STM32_DTCM_BASE,     LENGTH = STM32_DTCM_SIZE
+    ITCM     (rx)  : ORIGIN = STM32_ITCM_BASE,     LENGTH = STM32_ITCM_SIZE
+    SRAM_AXI (rw)  : ORIGIN = STM32_SRAM_AXI_BASE, LENGTH = STM32_SRAM_AXI_SIZE
+    SDRAM    (rwx) : ORIGIN = STM32_SDRAM1_BASE,   LENGTH = MEMORYSIZE * 1024 * 1024
+}
+
+PHDRS
+{
+    itcm PT_LOAD;
+    sdram PT_LOAD;
 }
 
 SECTIONS
@@ -19,7 +26,7 @@ SECTIONS
         KEEP(*(.vectors.arm));
         KEEP(*(.vectors.platform));
         *(.icode*);
-    } > ITCM
+    } > ITCM :itcm
 
     .stack (NOLOAD) : ALIGN(8)
     {
@@ -30,7 +37,12 @@ SECTIONS
         stackbegin = .;
         . += 0x2000;
         stackend = .;
-    } > DTCM
+    } > DTCM :NONE
+
+    .framebuffer (NOLOAD) :
+    {
+        *(.framebuffer);
+    } > SRAM_AXI :NONE
 
     .text :
     {
@@ -38,17 +50,17 @@ SECTIONS
 
         *(.init*);
         *(.text*);
-    } > SDRAM
+    } > SDRAM :sdram
 
     .rodata :
     {
         *(.rodata*);
-    } > SDRAM
+    } > SDRAM :sdram
 
     .data :
     {
         *(.data*);
-    } > SDRAM
+    } > SDRAM :sdram
 
     .bss (NOLOAD) :
     {
@@ -56,7 +68,7 @@ SECTIONS
         *(.bss*);
         *(COMMON);
         _bssend = .;
-    } > SDRAM
+    } > SDRAM :sdram
 
     audiobuffer = ALIGN(32);
     audiobufend = ORIGIN(SDRAM) + LENGTH(SDRAM) - CODEC_SIZE - PLUGIN_BUFFER_SIZE;
diff --git a/firmware/target/arm/stm32/boot.lds b/firmware/target/arm/stm32/boot.lds
index 06d3471303..01fc514286 100644
--- a/firmware/target/arm/stm32/boot.lds
+++ b/firmware/target/arm/stm32/boot.lds
@@ -52,6 +52,11 @@ SECTIONS
         . += 0x2000;
         stackend = .;
     } > SRAM_AXI
+
+    .framebuffer (NOLOAD) :
+    {
+        *(.framebuffer);
+    } > SRAM_AXI
 }
 
 EXTERN(__vectors_arm);
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.