mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
rk27xx: Implement HAVE_INIT_ATTR magic
This reclaims over 7kB of ram. Change-Id: I4a89c9a673ada7959311f320900060f6db303c07
This commit is contained in:
parent
837cad0d38
commit
9cd3444e27
3 changed files with 42 additions and 10 deletions
|
|
@ -981,7 +981,8 @@ Lyre prototype 1 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
|
#if (defined(CPU_PP) || (CONFIG_CPU == AS3525) || (CONFIG_CPU == AS3525v2) || \
|
||||||
(CONFIG_CPU == IMX31L) || (CONFIG_CPU == IMX233)) \
|
(CONFIG_CPU == IMX31L) || (CONFIG_CPU == IMX233) || \
|
||||||
|
(CONFIG_CPU == RK27XX)) \
|
||||||
&& (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
|
&& (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER)
|
||||||
/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after
|
/* 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
|
* root_menu() has been called. Their code may be overwritten by other data or
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ STARTUP(target/arm/rk27xx/crt0.o)
|
||||||
#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
|
#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
|
||||||
#define CODECORIG (ENDAUDIOADDR)
|
#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 */
|
/* Where the codec buffer ends, and the plugin buffer starts */
|
||||||
#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
|
#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
|
||||||
|
|
||||||
|
|
@ -29,21 +33,14 @@ MEMORY
|
||||||
{
|
{
|
||||||
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
|
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
|
||||||
IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
|
IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
|
||||||
|
INIT : ORIGIN = INITORIG, LENGTH = INITSIZE
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
loadaddress = DRAMORIG;
|
loadaddress = DRAMORIG;
|
||||||
|
|
||||||
.intvect : {
|
|
||||||
_intvectstart = . ;
|
|
||||||
KEEP(*(.intvect))
|
|
||||||
_intvectend = . ;
|
|
||||||
} > IRAM AT > DRAM
|
|
||||||
_intvectcopy = LOADADDR(.intvect);
|
|
||||||
|
|
||||||
.text : {
|
.text : {
|
||||||
*(.init.text)
|
|
||||||
*(.text*)
|
*(.text*)
|
||||||
*(.icode*)
|
*(.icode*)
|
||||||
*(.glue_7*)
|
*(.glue_7*)
|
||||||
|
|
@ -61,7 +58,27 @@ SECTIONS
|
||||||
. = ALIGN(0x4);
|
. = ALIGN(0x4);
|
||||||
} > DRAM
|
} > 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)
|
*(.stack)
|
||||||
_stackbegin = .;
|
_stackbegin = .;
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,20 @@ entry_point:
|
||||||
strhi r1, [r2], #4
|
strhi r1, [r2], #4
|
||||||
bhi 1b
|
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 */
|
/* Initialise bss, ibss section to zero */
|
||||||
ldr r2, =_edata
|
ldr r2, =_edata
|
||||||
ldr r3, =_end
|
ldr r3, =_end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue