summaryrefslogtreecommitdiff
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
parent3d46b080fda6f271da0949f1338667c7805b145e (diff)
downloadrockbox-ddb96f1b6533748585591e362579bd4528febd23.tar.gz
rockbox-ddb96f1b6533748585591e362579bd4528febd23.zip
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
-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)
9#define PLUGINSIZE PLUGIN_BUFFER_SIZE 9#define PLUGINSIZE PLUGIN_BUFFER_SIZE
10#define CODECSIZE CODEC_SIZE 10#define CODECSIZE CODEC_SIZE
11 11
12#define DRAMORIG DRAM_ORIG
13#define IRAMORIG IRAM_ORIG
14
15#define IRAMSIZE IRAM_SIZE 12#define IRAMSIZE IRAM_SIZE
16 13
17#define DRAMSIZE (DRAM_SIZE - PLUGINSIZE - CODECSIZE - FRAME_SIZE - TTB_SIZE) 14#define DRAMSIZE (DRAM_SIZE - PLUGINSIZE - CODECSIZE - FRAME_SIZE - TTB_SIZE)
@@ -28,26 +25,24 @@ STARTUP(target/arm/imx233/crt0.o)
28 25
29MEMORY 26MEMORY
30{ 27{
31 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE 28 IRAM : ORIGIN = IRAM_ORIG, LENGTH = IRAMSIZE
32 DRAM : ORIGIN = CACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE 29 DRAM : ORIGIN = CACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE
33 UNCACHED_DRAM : ORIGIN = UNCACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE 30 UDRAM : ORIGIN = UNCACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE
34} 31}
35 32
36SECTIONS 33SECTIONS
37{ 34{
35 loadaddress = UNCACHED_DRAM_ADDR;
36 _loadaddress = UNCACHED_DRAM_ADDR;
37
38 .text : 38 .text :
39 { 39 {
40 *(.text*) 40 *(.text*)
41 } > DRAM
42
43 .data :
44 {
45 *(.data*) 41 *(.data*)
46 *(.rodata*) 42 *(.rodata*)
47 _dataend = . ;
48 } > DRAM 43 } > DRAM
49 44
50 .iram : 45 .itext :
51 { 46 {
52 _iramstart = .; // always 0 47 _iramstart = .; // always 0
53 *(.vectors) 48 *(.vectors)
@@ -59,7 +54,7 @@ SECTIONS
59 _iramend = .; 54 _iramend = .;
60 } > IRAM AT> DRAM 55 } > IRAM AT> DRAM
61 56
62 _iramcopy = LOADADDR(.iram); 57 _iramcopy = LOADADDR(.itext);
63 58
64 .ibss (NOLOAD) : 59 .ibss (NOLOAD) :
65 { 60 {
@@ -75,6 +70,7 @@ SECTIONS
75 . = ALIGN(4); 70 . = ALIGN(4);
76 _initstart = .; 71 _initstart = .;
77 *(.init) 72 *(.init)
73 . = ALIGN(0x4);
78 _initend = .; 74 _initend = .;
79 } AT> DRAM 75 } AT> DRAM
80 76
@@ -88,6 +84,9 @@ SECTIONS
88 stackend = .; 84 stackend = .;
89 } > DRAM 85 } > DRAM
90 86
87 /* physical address of the stack */
88 stackend_phys = stackend - CACHED_DRAM_ADDR + UNCACHED_DRAM_ADDR;
89
91 /* treat .bss and .ncbss as a single section */ 90 /* treat .bss and .ncbss as a single section */
92 .bss (NOLOAD) : 91 .bss (NOLOAD) :
93 { 92 {
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 @@
33 ldr pc, =irq_handler 33 ldr pc, =irq_handler
34 ldr pc, =fiq_handler 34 ldr pc, =fiq_handler
35 35
36/* When starting, we are running at 0x40000000 but the code 36/* When starting, we are running at 0x4xxxxxxx (uncached) but the code
37 * assumes DRAM is somewhere else (for caching) so we first need to 37 * assumes DRAM is somewhere else (cached) so we first need to
38 * setup the MMU and then jump to the right location */ 38 * setup the MMU and then jump to the right location. */
39.text 39.text
40.global start 40.global start
41start: 41start:
@@ -49,9 +49,12 @@ start:
49 bic r0, r1 49 bic r0, r1
50 mcr p15, 0, r0, c1, c0, 0 50 mcr p15, 0, r0, c1, c0, 0
51 51
52 /* To call the C code we need a stack, since the stack is in virtual memory
53 * use the stack's physical address */
54 ldr sp, =stackend_phys
55
52 /* Enable MMU */ 56 /* Enable MMU */
53 bl memory_init 57 bl memory_init
54
55 /* Jump to real location */ 58 /* Jump to real location */
56 ldr pc, =remap 59 ldr pc, =remap
57remap: 60remap: