forked from len0rd/rockbox
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>
This commit is contained in:
parent
d55e5698e5
commit
b31c856b84
3 changed files with 29 additions and 3 deletions
|
@ -982,7 +982,7 @@ Lyre prototype 1 */
|
|||
|
||||
#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
|
||||
(CONFIG_CPU == IMX31L) || (CONFIG_CPU == IMX233) || \
|
||||
(CONFIG_CPU == RK27XX)) \
|
||||
(CONFIG_CPU == RK27XX) || defined(CPU_COLDFIRE)) \
|
||||
&& (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
|
||||
/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after
|
||||
* root_menu() has been called. Their code may be overwritten by other data or
|
||||
|
|
|
@ -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 = .;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue