summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/app.lds14
-rw-r--r--firmware/target/arm/crt0-pp.S13
-rw-r--r--firmware/target/arm/crt0.S21
-rw-r--r--firmware/target/arm/sandisk/app.lds16
4 files changed, 58 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/app.lds b/firmware/target/arm/as3525/app.lds
index eb5b28f852..6e610d6e15 100644
--- a/firmware/target/arm/as3525/app.lds
+++ b/firmware/target/arm/as3525/app.lds
@@ -99,6 +99,8 @@ SECTIONS
_iramend = .;
} > IRAM AT> DRAM
+ _iramcopy = LOADADDR(.iram);
+
.ibss (NOLOAD) :
{
_iedata = .;
@@ -108,9 +110,17 @@ SECTIONS
_iend = .;
} > IRAM
- _iramcopy = LOADADDR(.iram);
+ .init ENDAUDIOADDR :
+ {
+ . = ALIGN(4);
+ _initstart = .;
+ *(.init)
+ _initend = .;
+ } AT> DRAM
+
+ _initcopy = LOADADDR(.init);
- .stack (NOLOAD) :
+ .stack _iramcopy (NOLOAD) :
{
*(.stack)
stackbegin = .;
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S
index 9c996960cc..4e16df0f7a 100644
--- a/firmware/target/arm/crt0-pp.S
+++ b/firmware/target/arm/crt0-pp.S
@@ -213,6 +213,19 @@ cpu_init:
strhi r5, [r3], #4
bhi 1b
+#ifdef INIT_ATTR
+ /* copy init code to codec buffer */
+ ldr r2, =_initstart
+ ldr r3, =_initend
+ ldr r4, =_initcopy
+
+1:
+ cmp r3, r2
+ ldrhi r5, [r4], #4
+ strhi r5, [r2], #4
+ bhi 1b
+#endif
+
/* Zero out IBSS */
ldr r2, =_iedata
ldr r3, =_iend
diff --git a/firmware/target/arm/crt0.S b/firmware/target/arm/crt0.S
index 238cfdd65a..6284bcb16c 100644
--- a/firmware/target/arm/crt0.S
+++ b/firmware/target/arm/crt0.S
@@ -71,6 +71,7 @@ newstart:
bhi 1b
/* Copy the IRAM */
+ /* must be done before bss is zeroed */
ldr r2, =_iramcopy
ldr r3, =_iramstart
ldr r4, =_iramend
@@ -79,6 +80,23 @@ newstart:
ldrhi r5, [r2], #4
strhi r5, [r3], #4
bhi 1b
+
+#endif
+
+#ifdef INIT_ATTR
+ /* copy init data to codec buffer */
+ /* must be done before bss is zeroed */
+ ldr r2, =_initcopy
+ ldr r3, =_initstart
+ ldr r4, =_initend
+1:
+ cmp r4, r3
+ ldrhi r5, [r2], #4
+ strhi r5, [r3], #4
+ bhi 1b
+
+ mov r2, #0
+ mcr p15, 0, r2, c7, c5, 0 @ Invalidate ICache
#endif
/* Initialise bss section to zero */
@@ -89,7 +107,7 @@ newstart:
cmp r3, r2
strhi r4, [r2], #4
bhi 1b
-
+
/* Set up some stack and munge it with 0xdeadbeef */
ldr sp, =stackend
ldr r2, =stackbegin
@@ -115,7 +133,6 @@ newstart:
/* Switch back to supervisor mode */
msr cpsr_c, #0xd3
-
bl main
diff --git a/firmware/target/arm/sandisk/app.lds b/firmware/target/arm/sandisk/app.lds
index 3010644b72..ec26fdbe38 100644
--- a/firmware/target/arm/sandisk/app.lds
+++ b/firmware/target/arm/sandisk/app.lds
@@ -37,8 +37,8 @@ STARTUP(target/arm/crt0-pp.o)
MEMORY
{
- DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
- IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+ DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
+ IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
}
SECTIONS
@@ -126,6 +126,17 @@ SECTIONS
_iramcopy = LOADADDR(.iram);
+
+ .init ENDAUDIOADDR :
+ {
+ . = ALIGN(4);
+ _initstart = .;
+ *(.init)
+ _initend = .;
+ } AT> DRAM
+
+ _initcopy = LOADADDR(.init);
+
.idle_stacks (NOLOAD) :
{
*(.idle_stacks)
@@ -175,6 +186,7 @@ SECTIONS
.audiobuf (NOLOAD) :
{
_audiobuffer = .;
+ . = ALIGN(0x4);
audiobuffer = .;
} > DRAM