summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/rk27xx
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2014-01-10 08:56:40 +0100
committerMarcin Bukat <marcin.bukat@gmail.com>2014-01-10 09:01:08 +0100
commit9cd3444e272bbffc5ca6dcf172577b0e7885a3d2 (patch)
treee606ccba81fa96bbe21abc5e78ba688566fd762d /firmware/target/arm/rk27xx
parent837cad0d382e5600e68bb4ed6d499e6053fa50e5 (diff)
downloadrockbox-9cd3444e272bbffc5ca6dcf172577b0e7885a3d2.tar.gz
rockbox-9cd3444e272bbffc5ca6dcf172577b0e7885a3d2.zip
rk27xx: Implement HAVE_INIT_ATTR magic
This reclaims over 7kB of ram. Change-Id: I4a89c9a673ada7959311f320900060f6db303c07
Diffstat (limited to 'firmware/target/arm/rk27xx')
-rw-r--r--firmware/target/arm/rk27xx/app.lds35
-rw-r--r--firmware/target/arm/rk27xx/crt0.S14
2 files changed, 40 insertions, 9 deletions
diff --git a/firmware/target/arm/rk27xx/app.lds b/firmware/target/arm/rk27xx/app.lds
index 1675da491c..fb2cc54db6 100644
--- a/firmware/target/arm/rk27xx/app.lds
+++ b/firmware/target/arm/rk27xx/app.lds
@@ -22,6 +22,10 @@ STARTUP(target/arm/rk27xx/crt0.o)
#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
#define CODECORIG (ENDAUDIOADDR)
+/* .init is copied to codec buffer */
+#define INITORIG CODECORIG
+#define INITSIZE CODECSIZE
+
/* Where the codec buffer ends, and the plugin buffer starts */
#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
@@ -29,21 +33,14 @@ MEMORY
{
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+ INIT : ORIGIN = INITORIG, LENGTH = INITSIZE
}
SECTIONS
{
loadaddress = DRAMORIG;
- .intvect : {
- _intvectstart = . ;
- KEEP(*(.intvect))
- _intvectend = . ;
- } > IRAM AT > DRAM
- _intvectcopy = LOADADDR(.intvect);
-
.text : {
- *(.init.text)
*(.text*)
*(.icode*)
*(.glue_7*)
@@ -61,7 +58,27 @@ SECTIONS
. = ALIGN(0x4);
} > DRAM
- .stack (NOLOAD) :
+ /* NOLOAD sections at end start here. Any part of the binary image past
+ * this point is discarded or copied elsewhere. */
+ _noloaddram = .;
+
+ .intvect : {
+ _intvectstart = . ;
+ KEEP(*(.intvect))
+ _intvectend = . ;
+ } > IRAM AT > DRAM
+ _intvectcopy = LOADADDR(.intvect);
+
+ .init : {
+ . = ALIGN(4);
+ _initstart = .;
+ *(.init*)
+ *(.initdata*)
+ _initend = .;
+ } > INIT AT > DRAM
+ _initcopy = LOADADDR(.init);
+
+ .stack _noloaddram (NOLOAD) :
{
*(.stack)
_stackbegin = .;
diff --git a/firmware/target/arm/rk27xx/crt0.S b/firmware/target/arm/rk27xx/crt0.S
index 2a6b2cc329..fb5f02dbdc 100644
--- a/firmware/target/arm/rk27xx/crt0.S
+++ b/firmware/target/arm/rk27xx/crt0.S
@@ -149,6 +149,20 @@ entry_point:
strhi r1, [r2], #4
bhi 1b
+#ifdef HAVE_INIT_ATTR
+ /* Copy init section to the codec buffer
+ * before .bss zeroing
+ */
+ ldr r2, =_initstart
+ ldr r3, =_initend
+ ldr r4, =_initcopy
+1:
+ cmp r3, r2
+ ldrhi r1, [r4], #4
+ strhi r1, [r2], #4
+ bhi 1b
+#endif
+
/* Initialise bss, ibss section to zero */
ldr r2, =_edata
ldr r3, =_end