Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
{ kernel_entry = (void*) loadbuffer; printf("Executing"); + invalidate_icache(); kernel_entry(); printf("ERR: Failed to boot"); } #include "config.h" +#include "cpu.h" /* These output formats should be in the config-files */ /* Reserve 1mb for LCD buffer/TTB as in app.lds */ #define DRAMSIZE (MEMORYSIZE * 0x100000 - 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE #elif CONFIG_CPU==AS3525 && MEMORYSIZE <= 2 -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - TTB_SIZE #else -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE - TTB_SIZE #endif #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300) #define IRAM DRAM #define IRAMSIZE 0 #elif CONFIG_CPU==AS3525 +#define DRAMORIG 0x30000000 #if MEMORYSIZE <= 2 #define IRAMSIZE 0 /* simulates no IRAM since codec is already entirely in IRAM */ #define CODEC_ORIGIN (0x50000 - CODEC_SIZE) #define IRAMORIG 0x0 #define IRAMSIZE 0x50000 #endif -#define DRAMORIG 0x30000000 #else #define DRAMORIG 0x09000000 + STUBOFFSET /* plugins common to all models */ +test_boost.c battery_bench.c chessclock.c credits.c #define ECCSIZE 512 #define ECCBYTES 3 +#define IRAM_SIZE (0x50000) +#define TTB_SIZE (0x4000) +/* must be 16Kb (0x4000) aligned */ +#define TTB_BASE ((unsigned long *)(0x30000000 + (MEM*1024*1024) - TTB_SIZE)) /* End of memory */ + /* AS352X device base addresses */ #endif #if CONFIG_CPU == AS3525 +target/arm/mmu-arm.c target/arm/as3525/system-as3525.c target/arm/as3525/kernel-as3525.c target/arm/as3525/ata_sd_as3525.c ldrhi r5, [r2], #4 strhi r5, [r3], #4 bhi 1b +#if 0 + /* Setup the MMU, start by disabling */ + mcr p15, 0, r0, c7, c7, 0 /* invalidate i and dcache */ + nop + mrc p15, 0, r0, c1, c0, 0 + bic r0, r0, #0x1 /* disable mmu */ + bic r0, r0, #0x1<<2 /* disable dcache */ + bic r0, r0, #0x1<<12 /* disable icache */ + mcr p15, 0, r0, c1, c0, 0 + bl ttb_init + + ldr r0, =0x0 + ldr r1, =0x0 + ldr r2, =0x1000 + mov r3, #0 + bl map_section + + ldr r0, =0x30000000 + ldr r1, =0x30000000 + mov r2, #8 + mov r3, #12 + bl map_section + + bl enable_mmu #endif +#endif /* CONFIG_CPU == AS3525 */ /* Initialise bss section to zero */ ldr r2, =_edata ldr r3, =_end mov r4, #0 -1: +bsszero: cmp r3, r2 strhi r4, [r2], #4 - bhi 1b + bhi bsszero /* Set up some stack and munge it with 0xdeadbeef */ ldr sp, =stackend + mov r3, sp ldr r2, =stackbegin - ldr r3, =0xdeadbeef -1: - cmp sp, r2 - strhi r3, [r2], #4 - bhi 1b + ldr r4, =0xdeadbeef +stackmunge: + cmp r3, r2 + strhi r4, [r2], #4 + bhi stackmunge /* Set up stack for IRQ mode */ msr cpsr_c, #0xd2 msr cpsr_c, #0xdb ldr sp, =irq_stack - /* Switch back to supervisor mode */ + /* Switch to supervisor mode */ msr cpsr_c, #0xd3 +#if CONFIG_CPU == AS3525 + ldr sp, =stackend +#endif bl main - /* All illegal exceptions call into UIE with exception address as first * parameter. This is calculated differently depending on which exception * we're in. Second parameter is exception number, used for a string lookup MPMC_DYNAMIC_CONFIG_0 |= (1<<19); /* buffer enable */ } +#else +static void set_page_tables(void) +{ + map_section(0, 0, 0x1000, CACHE_NONE); /* map every memory region to itself */ + map_section(0x30000000, 0x30000000, MEM, CACHE_ALL); /* map RAM to 0 and enable caching for it */ +} + +void memory_init(void) +{ + ttb_init(); + set_page_tables(); + enable_mmu(); +} #endif void system_init(void) dma_init(); #ifndef BOOTLOADER + invalidate_icache(); + memory_init(); /* Disable fast hardware power-off, to use power button normally * We don't need the power button in the bootloader. */ ascodec_init(); #define SYSTEM_TARGET_H #include "system-arm.h" +#include "mmu-arm.h" #include "clock-target.h" /* CPUFREQ_* are defined here */ + +#define HAVE_INVALIDATE_ICACHE +static inline void invalidate_icache(void) +{ + clean_dcache(); + asm volatile( + "mov r0, #0 \n" + "mcr p15, 0, r0, c7, c7, 0 \n" /* invalidate i and dcache */ + : : : "r0" + ); +} + #endif /* SYSTEM_TARGET_H */ #define IRAMSIZE 0x50000 #ifdef LOWMEM -#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE +#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - TTB_SIZE #define CODECORIG (IRAMORIG + IRAMSIZE - CODEC_SIZE) #else -#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - CODECSIZE +#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - CODECSIZE - TTB_SIZE #define CODECORIG (ENDAUDIOADDR) #endif |