firmware: cleanup duplicated DM320 LCD memory defines

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit a24142b23488c378351b7199131b3ae715aa6ac8
Author: Aidan MacDonald <[email protected]>
Date:   Fri Mar 6 10:55:51 2026 +0000

    firmware: cleanup duplicated DM320 LCD memory defines
    
    Move the rather large block of code that's been copied
    in three separate linker scripts into the CPU header.
    
    Change-Id: I9f38e4901fa4ff699f00d97064a9cdaf7cfd6aab

diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index b36afbf4b0..41348e4010 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -20,27 +20,6 @@ OUTPUT_FORMAT(elf32-littlemips)
                   - CODEC_SIZE - QHARRAY_SIZE - FRAME_SIZE - TTB_SIZE)
 
 #elif CONFIG_CPU==DM320
-
-#ifndef LCD_NATIVE_WIDTH
-#define LCD_NATIVE_WIDTH LCD_WIDTH
-#endif
-
-#ifndef LCD_NATIVE_HEIGHT
-#define LCD_NATIVE_HEIGHT LCD_HEIGHT
-#endif
-
-#ifdef MROBE_500
-/* Give this 1 meg to allow it to align to the MMU boundary */
-#define LCD_FUDGE       LCD_NATIVE_WIDTH%32
-#define LCD_BUFFER_SIZE ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2)
-#define LCD_TTB_AREA    0x100000*((LCD_BUFFER_SIZE>>19)+1)
-#else
-/* must be 16Kb (0x4000) aligned */
-#define TTB_SIZE        (0x4000)
-#define LCD_BUFFER_SIZE (LCD_NATIVE_WIDTH*LCD_NATIVE_HEIGHT*2)
-#define LCD_TTB_AREA    (TTB_SIZE + LCD_BUFFER_SIZE)
-#endif
-
 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA
 
 #elif CONFIG_CPU==S3C2440
diff --git a/firmware/export/dm320.h b/firmware/export/dm320.h
index 6679c40790..07e31d89ce 100644
--- a/firmware/export/dm320.h
+++ b/firmware/export/dm320.h
@@ -46,6 +46,27 @@ extern unsigned long _ttbstart;
 #define FRAME2            ((short *) (&_lcdbuf2))  /* Right after FRAME */
 #endif
 
+#ifndef LCD_NATIVE_WIDTH
+#define LCD_NATIVE_WIDTH LCD_WIDTH
+#endif
+
+#ifndef LCD_NATIVE_HEIGHT
+#define LCD_NATIVE_HEIGHT LCD_HEIGHT
+#endif
+
+/* must be 16Kb (0x4000) aligned */
+#define TTB_SIZE        (0x4000)
+
+#ifdef MROBE_500
+/* Give this 1 meg to allow it to align to the MMU boundary */
+#define LCD_FUDGE       (LCD_NATIVE_WIDTH%32)
+#define LCD_BUFFER_SIZE ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2)
+#define LCD_TTB_AREA    (0x100000*((LCD_BUFFER_SIZE>>19)+1))
+#else
+#define LCD_BUFFER_SIZE (LCD_NATIVE_WIDTH*LCD_NATIVE_HEIGHT*2)
+#define LCD_TTB_AREA    (TTB_SIZE + LCD_BUFFER_SIZE)
+#endif
+
 #define PHY_IO_BASE      0x00030000
 #define DM320_REG(addr)  (*(volatile unsigned short *)(PHY_IO_BASE + (addr)))
 #define PHY_IO_BASE2     0x00060000
diff --git a/firmware/target/arm/tms320dm320/app.lds b/firmware/target/arm/tms320dm320/app.lds
index b35ace1ce6..87281c82bf 100644
--- a/firmware/target/arm/tms320dm320/app.lds
+++ b/firmware/target/arm/tms320dm320/app.lds
@@ -1,4 +1,6 @@
+#define __ASSEMBLER__
 #include "config.h"
+#include "cpu.h"
 
 ENTRY(_start)
 
@@ -6,34 +8,9 @@ OUTPUT_FORMAT(elf32-littlearm)
 OUTPUT_ARCH(arm)
 STARTUP(target/arm/tms320dm320/crt0.o)
 
-#ifndef LCD_NATIVE_WIDTH
-#define LCD_NATIVE_WIDTH LCD_WIDTH
-#endif
-
-#ifndef LCD_NATIVE_HEIGHT
-#define LCD_NATIVE_HEIGHT LCD_HEIGHT
-#endif
-
-/* must be 16Kb (0x4000) aligned */
-#define TTB_SIZE        0x4000
-
 #define DRAMSIZE        (MEMORYSIZE * 0x100000)
 #define DRAMORIG        CONFIG_SDRAM_START
 
-
-#ifdef MROBE_500
-#define LCD_FUDGE       LCD_NATIVE_WIDTH%32
-#define LCD_BUFFER_SIZE ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2)
-/* Give this some memory to allow it to align to the MMU boundary.
- * Note that since there are two buffers (YUV/RGB) it calculates the approximate
- * memory needed in steps of 1 Meg.
- */
-#define LCD_TTB_AREA    (0x100000*((LCD_BUFFER_SIZE>>19)+1))
-#else
-#define LCD_BUFFER_SIZE (LCD_NATIVE_WIDTH*LCD_NATIVE_HEIGHT*2)
-#define LCD_TTB_AREA    (TTB_SIZE + LCD_BUFFER_SIZE)
-#endif
-
 /* End of the audio buffer, where the codec buffer starts */
 #define ENDAUDIOADDR  \
     (DRAMORIG + DRAMSIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA)
diff --git a/firmware/target/arm/tms320dm320/boot.lds b/firmware/target/arm/tms320dm320/boot.lds
index 8b075f43df..c903c866ba 100644
--- a/firmware/target/arm/tms320dm320/boot.lds
+++ b/firmware/target/arm/tms320dm320/boot.lds
@@ -1,4 +1,6 @@
+#define __ASSEMBLER__
 #include "config.h"
+#include "cpu.h"
 
 ENTRY(_vectors)
 
@@ -6,36 +8,11 @@ OUTPUT_FORMAT(elf32-littlearm)
 OUTPUT_ARCH(arm)
 STARTUP(target/arm/tms320dm320/crt0.o)
 
-#ifndef LCD_NATIVE_WIDTH
-#define LCD_NATIVE_WIDTH LCD_WIDTH
-#endif
-
-#ifndef LCD_NATIVE_HEIGHT
-#define LCD_NATIVE_HEIGHT LCD_HEIGHT
-#endif
-
-/* must be 16Kb (0x4000) aligned */
-#define TTB_SIZE         (0x4000)
-
 /* Bootloader only uses/knows about the upper 32 M */
 #define DRAMSIZE    (MEMORYSIZE * 0x100000 / 2)
 #define DRAMORIG    CONFIG_SDRAM_START+DRAMSIZE
 
-#ifdef MROBE_500
-#define LCD_FUDGE       LCD_NATIVE_WIDTH%32
-#define LCD_BUFFER_SIZE ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2)
-/* Give this some memory to allow it to align to the MMU boundary.
- * Note that since there are two buffers (YUV/RGB) it calculates the approximate
- * memory needed in steps of 1 Meg.
- */
-#define LCD_TTB_AREA    (0x100000*((LCD_BUFFER_SIZE>>19)+1))
-/* End of the audio buffer, where the codec buffer starts */
-#define TTB_BEGIN       (DRAMORIG + DRAMSIZE - LCD_TTB_AREA)
-#else
-#define LCD_BUFFER_SIZE (LCD_NATIVE_WIDTH*LCD_NATIVE_HEIGHT*2)
-#define LCD_TTB_AREA    (TTB_SIZE + LCD_BUFFER_SIZE)
-#define LCD_BEGIN       (DRAMORIG + DRAMSIZE - LCD_TTB_AREA)
-#endif
+#define LCD_BEGIN   (DRAMORIG + DRAMSIZE - LCD_TTB_AREA)
 
 #define IRAMORIG    0x00000000
 #define IRAMSIZE    0x4000
@@ -191,7 +168,7 @@ SECTIONS
     } > IRAM
 
 #ifdef MROBE_500
-    .ttbtable TTB_BEGIN (NOLOAD) :
+    .ttbtable LCD_BEGIN (NOLOAD) :
     {
         . = ALIGN (0x4000);
         _ttbstart = .;
-- 
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.