From e1e810183701218be753ce70d131b48255478acf Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Tue, 10 Feb 2009 11:34:15 +0000 Subject: Gigabeat S: Place SDMA code load address starting in uninitialized section address and copy it to the plugin buffer since it only needed very early in initialization. Will save about 6K in RAM. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19963 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/imx31/app.lds | 24 +++++++++++++++++------- firmware/target/arm/imx31/crt0.S | 20 ++++++++++++++++++++ firmware/target/arm/imx31/sdma_script_code.h | 6 ++++-- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/firmware/target/arm/imx31/app.lds b/firmware/target/arm/imx31/app.lds index 4ab4665062..4ee7ac45d4 100644 --- a/firmware/target/arm/imx31/app.lds +++ b/firmware/target/arm/imx31/app.lds @@ -91,16 +91,18 @@ SECTIONS } AT> DRAM _vectorscopy = LOADADDR(.vectors); - - .stack : + + .stack (NOLOAD) : { *(.stack) stackbegin = .; . += 0x2000; stackend = .; } > DRAM + + _sdmacodecopy = stackbegin; - .bss : + .bss (NOLOAD) : { _edata = .; *(.bss*) @@ -110,30 +112,38 @@ SECTIONS _end = .; } > DRAM - .audiobuf ALIGN(4) : + .audiobuf (NOLOAD) : { + . = ALIGN(0x4); _audiobuffer = .; audiobuffer = .; } > DRAM - .audiobufend ENDAUDIOADDR: + .audiobufend ENDAUDIOADDR (NOLOAD) : { audiobufend = .; _audiobufend = .; } > DRAM - .codec ENDAUDIOADDR: + .codec ENDAUDIOADDR (NOLOAD) : { codecbuf = .; _codecbuf = .; } - .plugin ENDADDR: + .plugin ENDADDR (NOLOAD) : { _pluginbuf = .; pluginbuf = .; } + .sdma _pluginbuf : AT( _sdmacodecopy ) + { + _sdmacodestart = .; + *(.sdmacode); + _sdmacodeend = .; + } + .devbss (NOLOAD) : { _devbssdata = .; diff --git a/firmware/target/arm/imx31/crt0.S b/firmware/target/arm/imx31/crt0.S index 8459753f87..d51de7215a 100644 --- a/firmware/target/arm/imx31/crt0.S +++ b/firmware/target/arm/imx31/crt0.S @@ -231,6 +231,26 @@ remap_end: bhi 1b #endif /* BOOTLOADER */ +#ifndef BOOTLOADER + /* Copy discardable SDMA code - loaded in the stack section + * and so must be done first. Destination is the plugin buffer + * which is safe when SDMA init takes place just after kernel + * init. */ + ldr r4, =_sdmacodecopy + ldr r3, =_sdmacodeend + ldr r2, =_sdmacodestart +1: + cmp r3, r2 + ldrhi r5, [r4], #4 + strhi r5, [r2], #4 + bhi 1b + + /* Make buffer coherent */ + ldr r0, =_sdmacodestart + sub r1, r3, r0 + bl clean_dcache_range +#endif /* BOOTLOADER */ + /* Initialise bss section to zero */ ldr r2, =_edata ldr r3, =_end diff --git a/firmware/target/arm/imx31/sdma_script_code.h b/firmware/target/arm/imx31/sdma_script_code.h index b80c39534b..1e75267a76 100644 --- a/firmware/target/arm/imx31/sdma_script_code.h +++ b/firmware/target/arm/imx31/sdma_script_code.h @@ -356,7 +356,8 @@ /*! * Code download for i.MX system revision = 1.0 */ -static __attribute__((aligned(4))) const short sdma_code_1[RAM_CODE_SIZE_1] = +static __attribute__((aligned(4), section(".sdmacode"))) + const short sdma_code_1[RAM_CODE_SIZE_1] = { 0xc0ec, 0x7d59, 0x0970, 0x0111, 0x5111, 0x5ad1, 0x5bd9, 0xc0fe, 0x5ce1, 0x7d02, 0x0200, 0x9806, 0x08ff, 0x0011, 0x28ff, 0x00bc, @@ -851,7 +852,8 @@ static __attribute__((aligned(4))) const short sdma_code_1[RAM_CODE_SIZE_1] = /*! * Code download for i.MX system revision > 1.0 */ -static __attribute__((aligned(4))) const short sdma_code_2[RAM_CODE_SIZE_2] = +static __attribute__((aligned(4), section(".sdmacode"))) + const short sdma_code_2[RAM_CODE_SIZE_2] = { 0x0870, 0x0011, 0x5010, 0xc0ec, 0x7d61, 0x5ac0, 0x5bc8, 0x5ef8, 0xc0fe, 0x56f8, 0x7d02, 0x0200, 0x9806, 0x6ec3, 0x6d07, 0x5df0, -- cgit v1.2.3