diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index cc0be3abd5..fac47d8c45 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds @@ -36,7 +36,6 @@ OUTPUT_FORMAT(elf32-littlemips) #elif CONFIG_CPU==DM320 -/* Give this 1 meg to allow it to align to the MMU boundary */ #ifndef LCD_NATIVE_WIDTH #define LCD_NATIVE_WIDTH LCD_WIDTH #endif @@ -45,9 +44,17 @@ OUTPUT_FORMAT(elf32-littlemips) #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_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) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA diff --git a/firmware/export/dm320.h b/firmware/export/dm320.h index 01f206bfc9..bd6ca15407 100644 --- a/firmware/export/dm320.h +++ b/firmware/export/dm320.h @@ -30,13 +30,17 @@ #if !defined(__ASSEMBLER__) && !defined(__LD__) /* These variables are created during linking (app/boot.lds) */ extern unsigned long _lcdbuf; +#ifdef MROBE_500 extern unsigned long _lcdbuf2; +#endif extern unsigned long _ttbstart; #endif #define TTB_BASE_ADDR (_ttbstart) /* End of memory */ #define FRAME ((short *) (&_lcdbuf)) /* Right after TTB */ +#ifdef MROBE_500 #define FRAME2 ((short *) (&_lcdbuf2)) /* Right after FRAME */ +#endif #define PHY_IO_BASE 0x00030000 #define DM320_REG(addr) (*(volatile unsigned short *)(PHY_IO_BASE + (addr))) diff --git a/firmware/target/arm/tms320dm320/app.lds b/firmware/target/arm/tms320dm320/app.lds index 6ceb512d21..b35ace1ce6 100644 --- a/firmware/target/arm/tms320dm320/app.lds +++ b/firmware/target/arm/tms320dm320/app.lds @@ -14,22 +14,29 @@ STARTUP(target/arm/tms320dm320/crt0.o) #define LCD_NATIVE_HEIGHT LCD_HEIGHT #endif -#define LCD_FUDGE LCD_NATIVE_WIDTH%32 - -#define LCD_BUFFER_SIZE ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2) - /* 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) +#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 DRAMSIZE (MEMORYSIZE * 0x100000) - -#define DRAMORIG CONFIG_SDRAM_START +/* End of the audio buffer, where the codec buffer starts */ +#define ENDAUDIOADDR \ + (DRAMORIG + DRAMSIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA) #define FLASHORIG 0x00100000 #define FLASHSIZE 0x00800000 @@ -44,10 +51,6 @@ PRO_STACK_SIZE = 0x2000; IRQ_STACK_SIZE = 0x600; FIQ_STACK_SIZE = 0x400; -/* End of the audio buffer, where the codec buffer starts */ -#define ENDAUDIOADDR \ - (DRAMORIG + DRAMSIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA) - MEMORY { DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE @@ -105,7 +108,7 @@ SECTIONS *(.rodata*) } > DRAM - .data : + .data : { . = ALIGN(0x4); *(.data*) @@ -142,12 +145,12 @@ SECTIONS } > ITCM /* Program stack space */ - .pro_stack (NOLOAD): + .pro_stack (NOLOAD): { . = ALIGN(0x4); *(.stack) stackbegin = .; /* Variable for thread.c */ - _pro_stack_end = .; + _pro_stack_end = .; . += PRO_STACK_SIZE; _pro_stack_start = .; stackend = .; /* Variable for tread.c */ @@ -193,31 +196,48 @@ SECTIONS pluginbuf = .; . += PLUGIN_BUFFER_SIZE; } > DRAM - + _endsdram = .; +#ifdef MROBE_500 .ttbtable (NOLOAD) : { . = ALIGN (0x4000); _ttbstart = .; . += TTB_SIZE; } > DRAM - + /* The LCD buffer should be at the end of memory to protect against - * overflowing something else when the YUV blitter is fudging the screen + * overflowing something else when the YUV blitter is fudging the screen * size. */ - + .lcdbuffer (NOLOAD) : { _lcdbuf = .; . += LCD_BUFFER_SIZE; } > DRAM - + .lcdbuffer2 (NOLOAD) : { _lcdbuf2 = .; . += LCD_BUFFER_SIZE; } > DRAM +#else + .lcdbuffer (NOLOAD) : + { + . = ALIGN(32); + _lcdbuf = .; + . += LCD_BUFFER_SIZE; + } > DRAM + + /* Place TTB at the end of RAM to minimize alignment losses */ + .ttbtable (NOLOAD) : + { + . = ALIGN (0x4000); + _ttbstart = .; + . += TTB_SIZE; + } > DRAM +#endif } diff --git a/firmware/target/arm/tms320dm320/boot.lds b/firmware/target/arm/tms320dm320/boot.lds index 2db687d533..8b075f43df 100644 --- a/firmware/target/arm/tms320dm320/boot.lds +++ b/firmware/target/arm/tms320dm320/boot.lds @@ -14,22 +14,28 @@ STARTUP(target/arm/tms320dm320/crt0.o) #define LCD_NATIVE_HEIGHT LCD_HEIGHT #endif -#define LCD_FUDGE LCD_NATIVE_WIDTH%32 - -#define LCD_BUFFER_SIZE ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2) - /* 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) - -/* Bootloader only uses/knows about the upper 32 M */ -#define DRAMORIG CONFIG_SDRAM_START+0x02000000 -#define DRAMSIZE (MEMORYSIZE * 0x80000) +#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 IRAMORIG 0x00000000 #define IRAMSIZE 0x4000 @@ -59,9 +65,6 @@ PRO_STACK_SIZE = 0x2000; IRQ_STACK_SIZE = 0x400; FIQ_STACK_SIZE = 0x400; -/* End of the audio buffer, where the codec buffer starts */ -#define TTB_BEGIN (DRAMORIG + DRAMSIZE - LCD_TTB_AREA) - MEMORY { DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE @@ -148,7 +151,7 @@ SECTIONS } > IRAM AT> FLASH _iramcopy = LOADADDR(.iram); - + .ibss (NOLOAD) : { . = ALIGN(0x4); @@ -158,12 +161,12 @@ SECTIONS } > IRAM /* Program stack space */ - .pro_stack (NOLOAD): + .pro_stack (NOLOAD): { . = ALIGN(0x4); *(.stack) stackbegin = .; /* Variable for thread.c */ - _pro_stack_end = .; + _pro_stack_end = .; . += PRO_STACK_SIZE; _pro_stack_start = .; stackend = .; /* Variable for tread.c */ @@ -186,28 +189,45 @@ SECTIONS . += FIQ_STACK_SIZE; _fiq_stack_start = .; } > IRAM - + +#ifdef MROBE_500 .ttbtable TTB_BEGIN (NOLOAD) : { . = ALIGN (0x4000); _ttbstart = .; . += TTB_SIZE; } > DRAM - + /* The LCD buffer should be at the end of memory to protect against - * overflowing something else when the YUV blitter is fudging the screen + * overflowing something else when the YUV blitter is fudging the screen * size. */ - + .lcdbuffer (NOLOAD) : { _lcdbuf = .; . += LCD_BUFFER_SIZE; } > DRAM - + .lcdbuffer2 (NOLOAD) : { _lcdbuf2 = .; . += LCD_BUFFER_SIZE; } > DRAM +#else + .lcdbuffer LCD_BEGIN (NOLOAD) : + { + . = ALIGN(32); + _lcdbuf = .; + . += LCD_BUFFER_SIZE; + } > DRAM + + /* Place TTB at the end of RAM to minimize alignment losses */ + .ttbtable (NOLOAD) : + { + . = ALIGN (0x4000); + _ttbstart = .; + . += TTB_SIZE; + } > DRAM +#endif }