summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2014-01-10 21:46:43 +0100
committerMarcin Bukat <marcin.bukat@gmail.com>2014-01-17 19:03:06 +0100
commitb31c856b842096e5128a86a8316083190527d467 (patch)
tree648a14c99b81f279d2cc6767f262d27ed5abc1e0 /firmware/target/coldfire
parentd55e5698e587dda405ec53cceb6f3642768bd198 (diff)
downloadrockbox-b31c856b842096e5128a86a8316083190527d467.tar.gz
rockbox-b31c856b842096e5128a86a8316083190527d467.zip
coldfire: Implement HAVE_INIT_ATTR magic
This reclaims ~6kB of ram. Change-Id: Iafdc661b1cf4445669c08c79205043792b8d14c3 Reviewed-on: http://gerrit.rockbox.org/718 Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r--firmware/target/coldfire/app.lds17
-rw-r--r--firmware/target/coldfire/crt0.S13
2 files changed, 28 insertions, 2 deletions
diff --git a/firmware/target/coldfire/app.lds b/firmware/target/coldfire/app.lds
index 5364157fdd..457c71c97c 100644
--- a/firmware/target/coldfire/app.lds
+++ b/firmware/target/coldfire/app.lds
@@ -20,6 +20,11 @@ STARTUP(target/coldfire/crt0.o)
/* End of the audio buffer, where the codec buffer starts */
#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)
@@ -28,6 +33,7 @@ MEMORY
{
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+ INIT : ORIGIN = INITORIG, LENGTH = INITSIZE
}
SECTIONS
@@ -45,7 +51,7 @@ SECTIONS
.text :
{
. = ALIGN(0x200);
- *(.init.text)
+ KEEP(*(.startup*));
*(.text*)
. = ALIGN(0x4);
} > DRAM
@@ -90,6 +96,15 @@ SECTIONS
_iramcopy = LOADADDR(.iram);
_noloaddram = LOADADDR(.iram);
+ .init :
+ {
+ _initstart = .;
+ *(.init*)
+ *(.initdata*)
+ _initend = .;
+ } > INIT AT > DRAM
+ _initcopy = LOADADDR(.init);
+
.ibss (NOLOAD) :
{
_iedata = .;
diff --git a/firmware/target/coldfire/crt0.S b/firmware/target/coldfire/crt0.S
index 881fcf908f..5e73131894 100644
--- a/firmware/target/coldfire/crt0.S
+++ b/firmware/target/coldfire/crt0.S
@@ -21,7 +21,7 @@
#include "config.h"
#include "cpu.h"
- .section .init.text,"ax",@progbits
+ .section .startup,"ax",@progbits
.global start
start:
@@ -290,6 +290,17 @@ start:
/* .iram copy is done first since it is reclaimed for other
* uninitialized sections */
+ /* copy .init section */
+ lea _initcopy,%a2
+ lea _initstart,%a3
+ lea _initend,%a4
+ bra.b .initstart
+.initloop:
+ move.l (%a2)+,(%a3)+
+.initstart:
+ cmp.l %a3,%a4
+ bhi.b .initloop
+
/* copy the .iram section */
lea _iramcopy,%a2
lea _iramstart,%a3