rockbox/firmware/target/arm/tms320dm320/app.lds
Tomasz Moń 60e2cd6de9 DM320: Regorganize LCD and TTB memory layout
Do not introduce any change for M:Robe 500 as it uses the two LCD frames
in non-obvious way.

Sansa Connect and Creative ZVM use only single front framebuffer.
Place TTB at DRAM end to minimize memory loss due to alignment.
Reserve as little as possible memory for the LCD frames.
On Sansa Connect this change extends audio buffer by 858 KiB.

Change-Id: I21bdeec4cfba86d71803a39acd651a87e73767e6
2021-07-09 09:24:38 +00:00

243 lines
4.9 KiB
Text

#include "config.h"
ENTRY(_start)
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)
#define FLASHORIG 0x00100000
#define FLASHSIZE 0x00800000
#define ITCMORIG 0x00000000
#define ITCMSIZE 0x4000
#define DTCMORIG 0x00020000
#define DTCMSIZE 0x4000
PRO_STACK_SIZE = 0x2000;
IRQ_STACK_SIZE = 0x600;
FIQ_STACK_SIZE = 0x400;
MEMORY
{
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
ITCM : ORIGIN = ITCMORIG, LENGTH = ITCMSIZE
DTCM : ORIGIN = DTCMORIG, LENGTH = DTCMSIZE
}
SECTIONS
{
/* Set up variables needed for memory initialization */
_sdram_start = DRAMORIG;
_sdram_sizem = ((_endsdram - _sdram_start) / 0x100000);
_flash_start = FLASHORIG;
_flash_sizem = (FLASHSIZE / 0x100000);
/* crt0.S initialization */
.init :
{
. = ALIGN(0x4);
loadaddress = .;
_loadaddress = .;
*(.init)
} > DRAM
.vectors ITCMORIG :
{
. = ALIGN(0x4);
_vectorsstart = .;
KEEP(*(.vectors));
_vectorsend = .;
} > ITCM AT> DRAM
_vectorscopy = LOADADDR(.vectors);
.text :
{
. = ALIGN(0x4);
*(.text*)
} > DRAM
/* Thumb interworking sections - for some reason LD dies even if these
* sections are empty.
*/
.glue :
{
. = ALIGN(0x4);
*(.glue_7) /* ARM calling Thumb */
*(.glue_7t) /* Thumb calling ARM */
} > DRAM
.rodata :
{
. = ALIGN(0x4);
*(.rodata*)
} > DRAM
.data :
{
. = ALIGN(0x4);
*(.data*)
} > DRAM
.iram :
{
. = ALIGN(0x4);
_iramstart = .;
*(.icode*)
*(.irodata*)
*(.idata*)
_iramend = .;
} > ITCM AT> DRAM
_iramcopy = LOADADDR(.iram);
.bss (NOLOAD) :
{
. = ALIGN(0x4);
_bss_start = .;
*(.bss*)
*(COMMON)
_bss_end = .;
_end = .;
} > DRAM
.ibss (NOLOAD) :
{
. = ALIGN(0x4);
_ibss_start = .;
*(.ibss*)
_ibss_end = .;
} > ITCM
/* Program stack space */
.pro_stack (NOLOAD):
{
. = ALIGN(0x4);
*(.stack)
stackbegin = .; /* Variable for thread.c */
_pro_stack_end = .;
. += PRO_STACK_SIZE;
_pro_stack_start = .;
stackend = .; /* Variable for tread.c */
} > ITCM
/* IRQ stack space */
.irq_stack (NOLOAD):
{
. = ALIGN(0x4);
_irq_stack_end = .;
. += IRQ_STACK_SIZE;
_irq_stack_start = .;
} > ITCM
/* FIQ stack space */
.fiq_stack (NOLOAD):
{
. = ALIGN(0x4);
_fiq_stack_end = .;
. += FIQ_STACK_SIZE;
_fiq_stack_start = .;
} > ITCM
.audiobuf (NOLOAD) :
{
. = ALIGN(4);
audiobuffer = .;
} > DRAM
.audiobufend ENDAUDIOADDR (NOLOAD) :
{
audiobufend = .;
} > DRAM
.codec ENDAUDIOADDR (NOLOAD) :
{
codecbuf = .;
. += CODEC_SIZE;
} > DRAM
.plugin (NOLOAD) :
{
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
* 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
}