summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-09-13 23:38:45 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-09-13 23:38:45 +0000
commitddb96f1b6533748585591e362579bd4528febd23 (patch)
treeea7173e043521ac6cc0de26718a0135959289f4f /firmware/target/arm
parent3d46b080fda6f271da0949f1338667c7805b145e (diff)
imx233/fuze+: fix ctr0 to use a fresh stack and update firmware linker script
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30523 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/imx233/app.lds23
-rw-r--r--firmware/target/arm/imx233/crt0.S11
2 files changed, 18 insertions, 16 deletions
diff --git a/firmware/target/arm/imx233/app.lds b/firmware/target/arm/imx233/app.lds
index a4fb8af0f1..a961222749 100644
--- a/firmware/target/arm/imx233/app.lds
+++ b/firmware/target/arm/imx233/app.lds
@@ -9,9 +9,6 @@ STARTUP(target/arm/imx233/crt0.o)
#define PLUGINSIZE PLUGIN_BUFFER_SIZE
#define CODECSIZE CODEC_SIZE
-#define DRAMORIG DRAM_ORIG
-#define IRAMORIG IRAM_ORIG
-
#define IRAMSIZE IRAM_SIZE
#define DRAMSIZE (DRAM_SIZE - PLUGINSIZE - CODECSIZE - FRAME_SIZE - TTB_SIZE)
@@ -28,26 +25,24 @@ STARTUP(target/arm/imx233/crt0.o)
MEMORY
{
- IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+ IRAM : ORIGIN = IRAM_ORIG, LENGTH = IRAMSIZE
DRAM : ORIGIN = CACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE
- UNCACHED_DRAM : ORIGIN = UNCACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE
+ UDRAM : ORIGIN = UNCACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE
}
SECTIONS
{
+ loadaddress = UNCACHED_DRAM_ADDR;
+ _loadaddress = UNCACHED_DRAM_ADDR;
+
.text :
{
*(.text*)
- } > DRAM
-
- .data :
- {
*(.data*)
*(.rodata*)
- _dataend = . ;
} > DRAM
- .iram :
+ .itext :
{
_iramstart = .; // always 0
*(.vectors)
@@ -59,7 +54,7 @@ SECTIONS
_iramend = .;
} > IRAM AT> DRAM
- _iramcopy = LOADADDR(.iram);
+ _iramcopy = LOADADDR(.itext);
.ibss (NOLOAD) :
{
@@ -75,6 +70,7 @@ SECTIONS
. = ALIGN(4);
_initstart = .;
*(.init)
+ . = ALIGN(0x4);
_initend = .;
} AT> DRAM
@@ -88,6 +84,9 @@ SECTIONS
stackend = .;
} > DRAM
+ /* physical address of the stack */
+ stackend_phys = stackend - CACHED_DRAM_ADDR + UNCACHED_DRAM_ADDR;
+
/* treat .bss and .ncbss as a single section */
.bss (NOLOAD) :
{
diff --git a/firmware/target/arm/imx233/crt0.S b/firmware/target/arm/imx233/crt0.S
index ab0250f6b6..393411b83a 100644
--- a/firmware/target/arm/imx233/crt0.S
+++ b/firmware/target/arm/imx233/crt0.S
@@ -33,9 +33,9 @@
ldr pc, =irq_handler
ldr pc, =fiq_handler
-/* When starting, we are running at 0x40000000 but the code
- * assumes DRAM is somewhere else (for caching) so we first need to
- * setup the MMU and then jump to the right location */
+/* When starting, we are running at 0x4xxxxxxx (uncached) but the code
+ * assumes DRAM is somewhere else (cached) so we first need to
+ * setup the MMU and then jump to the right location. */
.text
.global start
start:
@@ -49,9 +49,12 @@ start:
bic r0, r1
mcr p15, 0, r0, c1, c0, 0
+ /* To call the C code we need a stack, since the stack is in virtual memory
+ * use the stack's physical address */
+ ldr sp, =stackend_phys
+
/* Enable MMU */
bl memory_init
-
/* Jump to real location */
ldr pc, =remap
remap: