stm32h7: detect unsupported SDMMC transfers to ITCM

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 047871c58a0a2e1af318d98abb2ed4bc98d69964
Author: Aidan MacDonald <[email protected]>
Date:   Tue Dec 30 00:30:11 2025 +0000

    stm32h7: detect unsupported SDMMC transfers to ITCM
    
    Change-Id: I4916829155d334148bf9683a9a66a125ef90a1f4

diff --git a/firmware/target/arm/stm32/sdmmc-stm32h7.c b/firmware/target/arm/stm32/sdmmc-stm32h7.c
index 448545a9cd..0bb0c323f9 100644
--- a/firmware/target/arm/stm32/sdmmc-stm32h7.c
+++ b/firmware/target/arm/stm32/sdmmc-stm32h7.c
@@ -45,7 +45,7 @@
 #define DATA_SUCCESS_BITS \
     __reg_orm(SDMMC_STAR, DATAEND)
 #define DATA_ERROR_BITS \
-    __reg_orm(SDMMC_STAR, DTIMEOUT, DABORT, DCRCFAIL, TXUNDERR, RXOVERR)
+    __reg_orm(SDMMC_STAR, IDMATE, DTIMEOUT, DABORT, DCRCFAIL, TXUNDERR, RXOVERR)
 #define DATA_END_BITS \
     (DATA_SUCCESS_BITS | DATA_ERROR_BITS)
 
@@ -284,6 +284,16 @@ int stm32h7_sdmmc_submit_command(void *controller,
             (uintptr_t)buff_addr < STM32_DTCM_BASE + STM32_DTCM_SIZE)
             panicf("%s: buffer in DTCM not supported", __func__);
 
+        /*
+         * Must assign to a variable to prevent GCC from whining
+         * about 'limited range of data type', because the ITCM
+         * is mapped at address 0.
+         */
+        static const uintptr_t itcm_base = STM32_ITCM_BASE;
+        if ((uintptr_t)buff_addr >= itcm_base &&
+            (uintptr_t)buff_addr < itcm_base + STM32_ITCM_SIZE)
+            panicf("%s: buffer in ITCM not supported", __func__);
+
         /* Set block size */
         uint32_t dctrl = 0;
         uint32_t dblocksize = find_first_set_bit(cmd->block_len);
-- 
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.