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
|
||||
|
||||
#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)
|
||||
/* 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
|
||||
|
|
|
|||
|
|
@ -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 = .;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue