1
0
Fork 0
forked from len0rd/rockbox

Sansa AMS: Use IRAM (in app linker script and crt0.S)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19137 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2008-11-18 17:15:56 +00:00
parent b18eda1c95
commit 678b6d02ac
2 changed files with 56 additions and 17 deletions

View file

@ -38,20 +38,11 @@ SECTIONS
{ {
loadaddress = 0x30000000; loadaddress = 0x30000000;
.vectors DRAMORIG :
{
_vectorstart = .;
*(.vectors*);
*(.init.text)
. = ALIGN(0x4);
} > DRAM
.text : .text :
{ {
_textstart = .; _textstart = .;
*(.text) *(.text)
*(.text*) *(.text*)
*(.icode)
*(.glue_7) *(.glue_7)
*(.glue_7t) *(.glue_7t)
. = ALIGN(0x4); . = ALIGN(0x4);
@ -63,14 +54,12 @@ SECTIONS
*(.rodata*) *(.rodata*)
*(.rodata.str1.1) *(.rodata.str1.1)
*(.rodata.str1.4) *(.rodata.str1.4)
*(.irodata*)
. = ALIGN(0x4); . = ALIGN(0x4);
} > DRAM } > DRAM
.data : .data :
{ {
*(.data*) *(.data*)
*(.idata*)
. = ALIGN(0x4); . = ALIGN(0x4);
} > DRAM } > DRAM
@ -93,12 +82,40 @@ SECTIONS
{ {
_edata = .; _edata = .;
*(.bss*) *(.bss*)
*(.ibss*)
*(COMMON) *(COMMON)
. = ALIGN(0x4); . = ALIGN(0x4);
_end = .; _end = .;
} > DRAM } > DRAM
.vectors IRAMORIG:
{
_vectors_start = .;
*(.init.text)
} > IRAM AT > DRAM
_vectorscopy = LOADADDR(.vectors);
.ibss (NOLOAD) :
{
_iedata = .;
*(.qharray)
*(.ibss)
. = ALIGN(0x4);
_iend = .;
} > IRAM
.iram _iend :
{
_iramstart = .;
*(.icode)
*(.irodata)
*(.idata)
. = ALIGN(0x4);
_iramend = .;
} > IRAM AT> DRAM
_iramcopy = LOADADDR(.iram);
.audiobuf (NOLOAD) : .audiobuf (NOLOAD) :
{ {
. = ALIGN(4); . = ALIGN(4);

View file

@ -50,22 +50,43 @@ start:
.word irq_handler .word irq_handler
.word fiq_handler .word fiq_handler
vectors_end: _vectorsend:
.text .text
newstart: newstart:
msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
#if CONFIG_CPU==AS3525 && !defined(BOOTLOADER) /* relocate vectors */ #if CONFIG_CPU==AS3525 && !defined(BOOTLOADER)
/* relocate vectors */
mov r1, #0 @ destination mov r1, #0 @ destination
ldr r2, =start @ source ldr r2, =_vectorscopy @ source
ldr r3, =vectors_end @ end ldr r3, =_vectorsend @ end
1: ldr r0, [r2], #4 1: ldr r0, [r2], #4
str r0, [r1], #4 str r0, [r1], #4
cmp r3, r2 cmp r1, r3
bne 1b bne 1b
/* Zero out IBSS */
ldr r2, =_iedata
ldr r3, =_iend
mov r4, #0
1:
cmp r3, r2
strhi r4, [r2], #4
bhi 1b
/* Copy the IRAM */
ldr r2, =_iramcopy
ldr r3, =_iramstart
ldr r4, =_iramend
1:
cmp r4, r3
ldrhi r5, [r2], #4
strhi r5, [r3], #4
bhi 1b
#endif #endif
/* Initialise bss section to zero */ /* Initialise bss section to zero */
@ -102,6 +123,7 @@ newstart:
/* Switch back to supervisor mode */ /* Switch back to supervisor mode */
msr cpsr_c, #0xd3 msr cpsr_c, #0xd3
bl main bl main