From c9172d4ff818efac4ea239710bf71e47ce88369c Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 5 Mar 2026 16:16:45 +0000 Subject: [PATCH] plugins: clean up target DRAM/IRAM mapping defines Move the definition of DRAMSIZE into the SoC-specific ifdef block below. This keeps the memory map defines for a SoC together in one place and as a result it is much easier to understand. Change-Id: Ie7293616a3c572b381cfeab3531751562c19a9c4 --- apps/plugins/plugin.lds | 91 +++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 53 deletions(-) diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index 41348e4010..e35e3dcefe 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds @@ -15,108 +15,85 @@ OUTPUT_FORMAT(elf32-littlemips) #error Unknown CPU architecture #endif -#if CONFIG_CPU==IMX31L -#define DRAMSIZE ((MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE \ - - CODEC_SIZE - QHARRAY_SIZE - FRAME_SIZE - TTB_SIZE) - -#elif CONFIG_CPU==DM320 -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA - -#elif CONFIG_CPU==S3C2440 -/* must be 16Kb (0x4000) aligned */ -#define TTB_SIZE (0x4000) -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE - -#elif CONFIG_CPU==TCC7801 -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE - -#elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2 -#define DRAMORIG DRAM_ORIG -#if defined(AMS_LOWMEM) || (CONFIG_CPU == AS3525v2) -#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - TTB_SIZE) -#else -#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE) -#endif -#elif CONFIG_CPU==S5L8702 || CONFIG_CPU==S5L8720 -#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE) -#elif CONFIG_CPU==IMX233 -#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - FRAME_SIZE - TTB_SIZE) -#elif CONFIG_CPU == JZ4732 || CONFIG_CPU == JZ4760B -/* fake 'iram' region occupies first 16k */ -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - 0x4000 -#elif CONFIG_CPU==X1000 -#define DRAMSIZE (X1000_DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE) -#endif - - /* default to full RAM (minus codecs&plugins) unless specified otherwise */ -#ifndef DRAMSIZE -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE -#endif - /* MCF5249 have 96KB of IRAM */ #if CONFIG_CPU == MCF5249 #define DRAMORIG 0x31000000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAMORIG 0x1000c000 #define IRAMSIZE 0xc000 /* MCF5250 have 128KB of IRAM */ #elif CONFIG_CPU == MCF5250 #define DRAMORIG 0x31000000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAMORIG 0x1000c800 #define IRAMSIZE 0x13800 #elif CONFIG_CPU == PP5022 || CONFIG_CPU == PP5024 /* PP5022/24 have 128KB of IRAM */ #define DRAMORIG 0x00000000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAMORIG 0x4000c000 #define IRAMSIZE 0x14000 #elif defined(CPU_PP) /* all other PP's have 96KB of IRAM */ #define DRAMORIG 0x00000000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAMORIG 0x4000c000 #define IRAMSIZE 0x0c000 -#elif CONFIG_CPU == IMX31L || CONFIG_CPU == S3C2440 +#elif CONFIG_CPU == IMX31L #define DRAMORIG 0x0 +#define DRAMSIZE ((MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE \ + - CODEC_SIZE - QHARRAY_SIZE - FRAME_SIZE - TTB_SIZE) +#define IRAM DRAM +#define IRAMSIZE 0 + +#elif CONFIG_CPU == S3C2440 +#define DRAMORIG 0x0 +#define DRAMSIZE ((MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE \ + - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE) #define IRAM DRAM #define IRAMSIZE 0 #elif CONFIG_CPU==DM320 #define DRAMORIG CONFIG_SDRAM_START +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA #define IRAM DRAM /* The bit of IRAM that is available is used in the core */ #define IRAMSIZE 0 -#elif defined(CPU_TCC780X) +#elif CONFIG_CPU==TCC7801 #define DRAMORIG 0x20000000 -#if CONFIG_CPU==TCC7801 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE #define IRAMORIG 0x1000c000 #define IRAMSIZE 0xc000 -#else -#define IRAM DRAM -#define IRAMSIZE 0 -#endif -#elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2 -#if defined(AMS_LOWMEM) || (CONFIG_CPU == AS3525v2) +#elif CONFIG_CPU==AS3525 && !defined(AMS_LOWMEM) +#define DRAMORIG DRAM_ORIG +#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE) +#define IRAMORIG (IRAM_ORIG + 0x20000) +#define IRAMSIZE (IRAM_ORIG + IRAM_SIZE - IRAMORIG) + +#elif CONFIG_CPU==AS3525v2 || (CONFIG_CPU == AS3525 && defined(AMS_LOWMEM)) +#define DRAMORIG DRAM_ORIG +#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - TTB_SIZE) #define IRAMSIZE 0 /* simulates no IRAM since codec is already entirely in IRAM */ #define CODEC_ORIGIN (IRAM_ORIG + IRAM_SIZE - CODEC_SIZE) #define PLUGIN_ORIGIN (DRAM_ORIG + DRAMSIZE) -#else -#define IRAMORIG (IRAM_ORIG + 0x20000) -#define IRAMSIZE (IRAM_ORIG + IRAM_SIZE - IRAMORIG) -#endif #elif CONFIG_CPU==S5L8700 /* S5L8700 have 256KB of IRAM */ #define DRAMORIG 0x08000000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAMORIG (0x00000000 + (48*1024)) #define IRAMSIZE (208*1024) #elif CONFIG_CPU==S5L8701 /* S5L8701 have 176KB of IRAM */ #define DRAMORIG 0x08000000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAMORIG (0x00000000 + (48*1024)) #define IRAMSIZE (128*1024) @@ -124,6 +101,7 @@ OUTPUT_FORMAT(elf32-littlemips) /* S5L8702 have 256KB of IRAM */ /* IRAM1 (2nd 128KB block) is not used because it is slower than DRAM */ #define DRAMORIG 0x08000000 +#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE) #define IRAMORIG (0x00000000 + (48*1024)) #define IRAMSIZE (80*1024) @@ -131,38 +109,45 @@ OUTPUT_FORMAT(elf32-littlemips) /* S5L8720 have 192KB of IRAM */ /* TODO: check if IRAM1 is also slow as in S5L8702 above */ #define DRAMORIG 0x08000000 +#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE) #define IRAMORIG (0x00000000 + (56*1024)) #define IRAMSIZE (136*1024) #elif CONFIG_CPU == JZ4732 || CONFIG_CPU == JZ4760B +/* fake 'iram' region occupies first 16k */ #define DRAMORIG 0x80004000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE - 0x4000 +/* The bit of IRAM that is available is used in the core */ #define IRAM DRAM #define IRAMSIZE 0 -/* The bit of IRAM that is available is used in the core */ #elif CONFIG_CPU == X1000 #define DRAMORIG X1000_DRAM_BASE +#define DRAMSIZE (X1000_DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE) #define IRAM DRAM #define IRAMSIZE 0 #elif CONFIG_CPU == RK27XX #define DRAMORIG 0x60000000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAM DRAM #define IRAMSIZE 0 #elif CONFIG_CPU == IMX233 /* The IRAM is too small and already partly used by the core */ #define DRAMORIG CACHED_DRAM_ADDR +#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - FRAME_SIZE - TTB_SIZE) #define IRAM DRAM #define IRAMSIZE 0 #elif CONFIG_CPU == STM32H743 #define DRAMORIG STM32_SDRAM1_BASE +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - CODEC_SIZE #define IRAM DRAM #define IRAMSIZE 0 #else -# error "DRAMORIG not defined!" +# error "DRAM/IRAM memory map not defined!" #endif #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE