diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-03-17 05:02:42 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-03-17 05:02:42 +0000 |
commit | ab7365610b2a1b2b866a4b6bf5aaaec703678b83 (patch) | |
tree | 888cfa83a65e50589b7dc25b5b7470ce8c4ca4be | |
parent | bda2e6d6755847738bc14b47a942751aff0a19d8 (diff) | |
download | rockbox-ab7365610b2a1b2b866a4b6bf5aaaec703678b83.tar.gz rockbox-ab7365610b2a1b2b866a4b6bf5aaaec703678b83.zip |
as3525*: revert r25198 and inline memory_init in crt0.S
We do not need a stack pointer at this step, and we are sure to not use
memory not initialized yet (like bss)
Fixes FS#11114 (tested on Fuze)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25229 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 20 | ||||
-rw-r--r-- | firmware/target/arm/crt0.S | 49 |
2 files changed, 47 insertions, 22 deletions
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 16c89b9a7a..4bf5cd39c3 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -233,26 +233,6 @@ static void sdram_init(void) | |||
233 | 233 | ||
234 | MPMC_DYNAMIC_CONFIG_0 |= (1<<19); /* buffer enable */ | 234 | MPMC_DYNAMIC_CONFIG_0 |= (1<<19); /* buffer enable */ |
235 | } | 235 | } |
236 | #else /* !BOOTLOADER */ | ||
237 | void memory_init(void) | ||
238 | { | ||
239 | ttb_init(); | ||
240 | /* map every region to itself, uncached */ | ||
241 | map_section(0, 0, 4096, CACHE_NONE); | ||
242 | |||
243 | /* IRAM */ | ||
244 | map_section(0, IRAM_ORIG, 1, CACHE_ALL); | ||
245 | map_section(0, UNCACHED_ADDR(IRAM_ORIG), 1, CACHE_NONE); | ||
246 | |||
247 | /* DRAM */ | ||
248 | map_section(0x30000000, DRAM_ORIG, MEMORYSIZE, CACHE_ALL); | ||
249 | map_section(0x30000000, UNCACHED_ADDR(DRAM_ORIG), MEMORYSIZE, CACHE_NONE); | ||
250 | |||
251 | /* map 1st mbyte of DRAM at 0x0 to have exception vectors available */ | ||
252 | map_section(0x30000000, 0, 1, CACHE_ALL); | ||
253 | |||
254 | enable_mmu(); | ||
255 | } | ||
256 | #endif /* BOOTLOADER */ | 236 | #endif /* BOOTLOADER */ |
257 | 237 | ||
258 | void system_init(void) | 238 | void system_init(void) |
diff --git a/firmware/target/arm/crt0.S b/firmware/target/arm/crt0.S index 5e65738d9c..5d07d34c59 100644 --- a/firmware/target/arm/crt0.S +++ b/firmware/target/arm/crt0.S | |||
@@ -58,9 +58,54 @@ newstart: | |||
58 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ | 58 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ |
59 | 59 | ||
60 | #if (CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2) && !defined(BOOTLOADER) | 60 | #if (CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2) && !defined(BOOTLOADER) |
61 | |||
62 | #define CACHE_NONE 0 | ||
63 | #define CACHE_ALL 0x0C | ||
64 | #define UNCACHED_ADDR(a) (a + 0x10000000) | ||
65 | |||
61 | /* Setup MMU : has to be done before accessing IRAM ! */ | 66 | /* Setup MMU : has to be done before accessing IRAM ! */ |
62 | ldr sp, =stackend | 67 | |
63 | bl memory_init | 68 | bl ttb_init |
69 | |||
70 | mov r0, #0 @ physical address | ||
71 | mov r1, #0 @ virtual address | ||
72 | mov r2, #0x1000 @ size (all memory) | ||
73 | mov r3, #CACHE_NONE | ||
74 | bl map_section | ||
75 | |||
76 | mov r0, #0 @ physical address | ||
77 | mov r1, #IRAM_ORIG @ virtual address | ||
78 | mov r2, #1 @ size : 1MB | ||
79 | mov r3, #CACHE_ALL | ||
80 | bl map_section | ||
81 | |||
82 | mov r0, #0 @ physical address | ||
83 | ldr r1, =UNCACHED_ADDR(IRAM_ORIG) @ virtual address | ||
84 | mov r2, #1 @ size : 1MB | ||
85 | mov r3, #CACHE_NONE | ||
86 | bl map_section | ||
87 | |||
88 | mov r0, #0x30000000 @ physical address | ||
89 | mov r1, #DRAM_ORIG @ virtual address | ||
90 | mov r2, #MEMORYSIZE @ size | ||
91 | mov r3, #CACHE_ALL | ||
92 | bl map_section | ||
93 | |||
94 | mov r0, #0x30000000 @ physical address | ||
95 | mov r1, #UNCACHED_ADDR(DRAM_ORIG) @ virtual address | ||
96 | mov r2, #MEMORYSIZE @ size | ||
97 | mov r3, #CACHE_NONE | ||
98 | bl map_section | ||
99 | |||
100 | /* map 1st mbyte of DRAM at 0x0 to have exception vectors available */ | ||
101 | |||
102 | mov r0, #0x30000000 @ physical address | ||
103 | mov r1, #0 @ virtual address | ||
104 | mov r2, #1 @ size | ||
105 | mov r3, #CACHE_ALL | ||
106 | bl map_section | ||
107 | |||
108 | bl enable_mmu | ||
64 | 109 | ||
65 | /* Zero out IBSS */ | 110 | /* Zero out IBSS */ |
66 | ldr r2, =_iedata | 111 | ldr r2, =_iedata |