firmware: make config.h IRAM usage defines more readable

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit b8b55128b132ed6e82e1c4e39e67b019f7ae2902
Author: Aidan MacDonald <[email protected]>
Date:   Tue Jan 13 12:34:47 2026 +0000

    firmware: make config.h IRAM usage defines more readable
    
    Split up the single massive '#if' condition into several
    smaller blocks to make it easier to understand what is
    happening. Compiled binaries should remain unchanged.
    
    Change-Id: I65359cb55c60d71d5a424cafda83c83bddb20974

diff --git a/firmware/export/config.h b/firmware/export/config.h
index b38732d554..cf79b84fe2 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -1177,32 +1177,53 @@ Lyre prototype 1 */
 #define NO_PROF_ATTR
 #endif
 
-/* IRAM usage */
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE) &&   /* Not for hosted environments */ \
-    (defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \
-    defined(CPU_PP) ||  /* PortalPlayer: core, plugins, codecs */ \
-    (CONFIG_CPU == AS3525 && MEMORYSIZE > 2 && !defined(BOOTLOADER)) || /* AS3525 +2MB: core, plugins, codecs */ \
-    (CONFIG_CPU == AS3525 && MEMORYSIZE <= 2 && !defined(PLUGIN) && !defined(CODEC) && !defined(BOOTLOADER)) || /* AS3525 2MB: core only */ \
-    (CONFIG_CPU == AS3525v2 && !defined(PLUGIN) && !defined(CODEC) && !defined(BOOTLOADER)) || /* AS3525v2: core only */ \
+/* IRAM usage; not for hosted environments */
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
+
+/* Core, plugins, and codecs for straightforward targets */
+#if defined(CPU_COLDFIRE) || \
+    defined(CPU_PP) || \
+    defined(CPU_S5L87XX) || \
     (CONFIG_CPU == PNX0101) || \
-    (CONFIG_CPU == TCC7801) || \
-    (CONFIG_CPU == IMX233 && !defined(PLUGIN) && !defined(CODEC)) || /* IMX233: core only */ \
-    defined(CPU_S5L87XX)) || /* Samsung S5L87XX: core, plugins, codecs */ \
-    ((CONFIG_CPU == JZ4732 || CONFIG_CPU == JZ4760B) && !defined(PLUGIN) && !defined(CODEC)) /* Jz47XX: core only */
-#define ICODE_ATTR      __attribute__ ((section(".icode")))
-#define ICONST_ATTR     __attribute__ ((section(".irodata")))
-#define IDATA_ATTR      __attribute__ ((section(".idata")))
-#define IBSS_ATTR       __attribute__ ((section(".ibss")))
-#define USE_IRAM
-#if (CONFIG_CPU != AS3525 || MEMORYSIZE > 2) \
-    && CONFIG_CPU != JZ4732 && CONFIG_CPU != JZ4760B && CONFIG_CPU != AS3525v2 && CONFIG_CPU != IMX233
-#define PLUGIN_USE_IRAM
+    (CONFIG_CPU == TCC7801)
+# define USE_IRAM
+# define PLUGIN_USE_IRAM
+
+/* AS3525 +2MB: core, plugins, codecs */
+#elif (CONFIG_CPU == AS3525) && (MEMORYSIZE > 2) && !defined(BOOTLOADER)
+# define USE_IRAM
+# define PLUGIN_USE_IRAM
+
+/* AS3525 2MB: core only */
+#elif (CONFIG_CPU == AS3525) && (MEMORYSIZE <= 2) && !defined(BOOTLOADER) && \
+      !defined(CODEC) && !defined(PLUGIN)
+# define USE_IRAM
+
+/* AS2525v2: core only */
+#elif (CONFIG_CPU == AS3525v2) && !defined(BOOTLOADER) && !defined(CODEC) && !defined(PLUGIN)
+# define USE_IRAM
+
+/* IMX233: core only */
+#elif (CONFIG_CPU == IMX233) && !defined(PLUGIN) && !defined(CODEC)
+# define USE_IRAM
+
+/* JZ47xx: core only */
+#elif (CONFIG_CPU == JZ4732 || CONFIG_CPU == JZ4760B) && !defined(PLUGIN) && !defined(CODEC)
+# define USE_IRAM
 #endif
+
+#endif /* (CONFIG_PLATFORM & PLATFORM_NATIVE) */
+
+#ifdef USE_IRAM
+# define ICODE_ATTR     __attribute__ ((section(".icode")))
+# define ICONST_ATTR    __attribute__ ((section(".irodata")))
+# define IDATA_ATTR     __attribute__ ((section(".idata")))
+# define IBSS_ATTR      __attribute__ ((section(".ibss")))
 #else
-#define ICODE_ATTR
-#define ICONST_ATTR
-#define IDATA_ATTR
-#define IBSS_ATTR
+# define ICODE_ATTR
+# define ICONST_ATTR
+# define IDATA_ATTR
+# define IBSS_ATTR
 #endif
 
 #if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
-- 
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.