summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-05-20 21:09:53 +0000
committerThomas Martitz <kugel@rockbox.org>2009-05-20 21:09:53 +0000
commit4633446517c002ed81cdbbc6acb9b8ffd9becc85 (patch)
treeaa2e1dc82908bd4568e885a37545f94f07579a2a
parentfba4be213f399f19933aadcce25498ea1fb0c176 (diff)
downloadrockbox-4633446517c002ed81cdbbc6acb9b8ffd9becc85.tar.gz
rockbox-4633446517c002ed81cdbbc6acb9b8ffd9becc85.zip
Sansa AMS: Centralise mapping of RAM and IRAM in as3525.h via #defines. This will hopefully make ongoing mmu work easier as less places need to be changed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21000 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/plugin.lds19
-rw-r--r--bootloader/sansa_as3525.c4
-rw-r--r--firmware/export/as3525.h18
-rw-r--r--firmware/target/arm/as3525/app.lds40
-rw-r--r--firmware/target/arm/as3525/boot.lds10
5 files changed, 54 insertions, 37 deletions
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index 9a65fd5e4a..456e6b4e01 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -1,4 +1,5 @@
1#include "config.h" 1#include "config.h"
2#include "cpu.h"
2 3
3/* These output formats should be in the config-files */ 4/* These output formats should be in the config-files */
4 5
@@ -47,10 +48,11 @@ OUTPUT_FORMAT(elf32-littlemips)
47#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE 48#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE
48 49
49#elif CONFIG_CPU==AS3525 50#elif CONFIG_CPU==AS3525
50#if MEMORYSIZE <= 2 51#define DRAMORIG DRAM_ORIG
51#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET 52#ifdef AMS_LOWMEM
53#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - STUBOFFSET - TTB_SIZE)
52#else 54#else
53#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE 55#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE - TTB_SIZE)
54#endif 56#endif
55#endif 57#endif
56 58
@@ -110,15 +112,14 @@ OUTPUT_FORMAT(elf32-littlemips)
110#define IRAMSIZE 0 112#define IRAMSIZE 0
111 113
112#elif CONFIG_CPU==AS3525 114#elif CONFIG_CPU==AS3525
113#if MEMORYSIZE <= 2 115#ifdef AMS_LOWMEM
114#define IRAMSIZE 0 /* simulates no IRAM since codec is already entirely in IRAM */ 116#define IRAMSIZE 0 /* simulates no IRAM since codec is already entirely in IRAM */
115#define CODEC_ORIGIN (0x50000 - CODEC_SIZE) 117#define CODEC_ORIGIN (IRAM_ORIG + IRAM_SIZE - CODEC_SIZE)
116#define PLUGIN_ORIGIN (DRAMORIG + DRAMSIZE) 118#define PLUGIN_ORIGIN (DRAM_ORIG + DRAMSIZE)
117#else 119#else
118#define IRAMORIG 0x20000 120#define IRAMORIG (IRAM_ORIG + 0x20000)
119#define IRAMSIZE 0x30000 121#define IRAMSIZE (IRAM_ORIG + IRAM_SIZE - IRAMORIG)
120#endif 122#endif
121#define DRAMORIG 0x30000000
122 123
123#elif CONFIG_CPU == JZ4732 124#elif CONFIG_CPU == JZ4732
124#define DRAMORIG 0x80004000 + STUBOFFSET 125#define DRAMORIG 0x80004000 + STUBOFFSET
diff --git a/bootloader/sansa_as3525.c b/bootloader/sansa_as3525.c
index 4705e2b915..dbe6218d48 100644
--- a/bootloader/sansa_as3525.c
+++ b/bootloader/sansa_as3525.c
@@ -93,8 +93,8 @@ void main(void)
93 93
94 printf("Loading firmware"); 94 printf("Loading firmware");
95 95
96 loadbuffer = (unsigned char*)0x30000000; /* DRAM */ 96 loadbuffer = (unsigned char*)DRAM_ORIG; /* DRAM */
97 buffer_size = (int)(loadbuffer + (MEM * 0x100000)); 97 buffer_size = (int)(loadbuffer + (DRAM_SIZE) - TTB_SIZE);
98 98
99 ret = load_firmware(loadbuffer, BOOTFILE, buffer_size); 99 ret = load_firmware(loadbuffer, BOOTFILE, buffer_size);
100 if(ret < 0) 100 if(ret < 0)
diff --git a/firmware/export/as3525.h b/firmware/export/as3525.h
index 388df2a925..326a7610bb 100644
--- a/firmware/export/as3525.h
+++ b/firmware/export/as3525.h
@@ -22,10 +22,28 @@
22 22
23#define UART_CHANNELS 1 23#define UART_CHANNELS 1
24 24
25
26#if MEMORYSIZE <= 2
27/* we put the codec buffer in IRAM */
28#define AMS_LOWMEM
29#endif
30/* these addresses are valid after mapping through the MMU */
31#define DRAM_ORIG 0x30000000
32#define IRAM_ORIG 0x0
33
34#define DRAM_SIZE (MEMORYSIZE * 0x100000)
35#define IRAM_SIZE 0x50000
36
37
25/* AS352X only supports 512 Byte HW ECC */ 38/* AS352X only supports 512 Byte HW ECC */
26#define ECCSIZE 512 39#define ECCSIZE 512
27#define ECCBYTES 3 40#define ECCBYTES 3
28 41
42/* AS352X MMU Page Table Entries */
43/* to be implemented */
44#define TTB_SIZE 0x0 /* Mimics OF */
45#define TTB_BASE_ADDR (DRAM_ORIG + DRAM_SIZE - TTB_SIZE)
46
29 47
30/* AS352X device base addresses */ 48/* AS352X device base addresses */
31 49
diff --git a/firmware/target/arm/as3525/app.lds b/firmware/target/arm/as3525/app.lds
index 7f37cc5d7c..45ae30f9f3 100644
--- a/firmware/target/arm/as3525/app.lds
+++ b/firmware/target/arm/as3525/app.lds
@@ -1,4 +1,5 @@
1#include "config.h" 1#include "config.h"
2#include "cpu.h"
2 3
3ENTRY(start) 4ENTRY(start)
4 5
@@ -6,11 +7,6 @@ OUTPUT_FORMAT(elf32-littlearm)
6OUTPUT_ARCH(arm) 7OUTPUT_ARCH(arm)
7STARTUP(target/arm/crt0.o) 8STARTUP(target/arm/crt0.o)
8 9
9#if MEMORYSIZE <= 2
10/* we put the codec buffer in IRAM */
11#define LOWMEM
12#endif
13
14#define PLUGINSIZE PLUGIN_BUFFER_SIZE 10#define PLUGINSIZE PLUGIN_BUFFER_SIZE
15#define CODECSIZE CODEC_SIZE 11#define CODECSIZE CODEC_SIZE
16 12
@@ -20,26 +16,27 @@ STARTUP(target/arm/crt0.o)
20#define STUBOFFSET 0 16#define STUBOFFSET 0
21#endif 17#endif
22 18
23#include "cpu.h"
24 19
25#ifdef LOWMEM 20#define IRAMORIG IRAM_ORIG
26#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE 21#define DRAMORIG (DRAM_ORIG + STUBOFFSET)
27#define CODECORIG (IRAMORIG + 0x50000 - CODEC_SIZE) 22
28#define IRAMSIZE (0x50000 - CODEC_SIZE) 23/* End of the audio buffer, where the codec buffer starts */
24#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
25
26
27#ifdef AMS_LOWMEM
28#define DRAMSIZE (DRAM_SIZE - STUBOFFSET - PLUGINSIZE - TTB_SIZE)
29#define CODECORIG (IRAMORIG + (IRAM_SIZE - CODEC_SIZE))
30#define IRAMSIZE (IRAM_SIZE - CODEC_SIZE)
29#else 31#else
30#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - CODECSIZE 32#define DRAMSIZE (DRAM_SIZE - STUBOFFSET - PLUGINSIZE - CODECSIZE - TTB_SIZE)
31#define CODECORIG (ENDAUDIOADDR) 33#define CODECORIG (ENDAUDIOADDR)
32#define IRAMSIZE (0x20000) 34#define IRAMSIZE (0x20000)
33#endif 35#endif
34 36
35#define IRAMORIG 0x0
36#define DRAMORIG 0x30000000 + STUBOFFSET
37
38/* End of the audio buffer, where the codec buffer starts */
39#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
40 37
41/* Where the codec buffer ends, and the plugin buffer starts */ 38/* Where the codec buffer ends, and the plugin buffer starts */
42#ifdef LOWMEM 39#ifdef AMS_LOWMEM
43#define ENDADDR (ENDAUDIOADDR) 40#define ENDADDR (ENDAUDIOADDR)
44#else 41#else
45#define ENDADDR (ENDAUDIOADDR + CODECSIZE) 42#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
@@ -47,7 +44,7 @@ STARTUP(target/arm/crt0.o)
47 44
48MEMORY 45MEMORY
49{ 46{
50#ifdef LOWMEM 47#ifdef AMS_LOWMEM
51 CODEC_IRAM : ORIGIN = CODECORIG, LENGTH = CODEC_SIZE 48 CODEC_IRAM : ORIGIN = CODECORIG, LENGTH = CODEC_SIZE
52#endif 49#endif
53 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE 50 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
@@ -56,7 +53,7 @@ MEMORY
56 53
57SECTIONS 54SECTIONS
58{ 55{
59 loadaddress = 0x30000000; 56 loadaddress = DRAM_ORIG;
60 57
61 .text : 58 .text :
62 { 59 {
@@ -71,10 +68,7 @@ SECTIONS
71 68
72 .rodata : 69 .rodata :
73 { 70 {
74 *(.rodata) /* problems without this, dunno why */
75 *(.rodata*) 71 *(.rodata*)
76 *(.rodata.str1.1)
77 *(.rodata.str1.4)
78 . = ALIGN(0x4); 72 . = ALIGN(0x4);
79 } > DRAM 73 } > DRAM
80 74
@@ -152,7 +146,7 @@ SECTIONS
152 { 146 {
153 codecbuf = .; 147 codecbuf = .;
154 _codecbuf = .; 148 _codecbuf = .;
155#ifdef LOWMEM 149#ifdef AMS_LOWMEM
156 } > CODEC_IRAM 150 } > CODEC_IRAM
157#else 151#else
158 } > DRAM 152 } > DRAM
diff --git a/firmware/target/arm/as3525/boot.lds b/firmware/target/arm/as3525/boot.lds
index 7a13d67a43..a98763e8f6 100644
--- a/firmware/target/arm/as3525/boot.lds
+++ b/firmware/target/arm/as3525/boot.lds
@@ -1,18 +1,22 @@
1#include "config.h" 1#include "config.h"
2#include "cpu.h"
2 3
3ENTRY(start) 4ENTRY(start)
4OUTPUT_FORMAT(elf32-littlearm) 5OUTPUT_FORMAT(elf32-littlearm)
5OUTPUT_ARCH(arm) 6OUTPUT_ARCH(arm)
6STARTUP(target/arm/crt0.o) 7STARTUP(target/arm/crt0.o)
7 8
8#define DRAMSIZE (MEMORYSIZE * 0x100000) 9/*
10No need for DRAM in our bootloader
11#define DRAMSIZE (MEMORYSIZE * 0x100000) - TTB_SIZE
9#define DRAMORIG 0x30000000 12#define DRAMORIG 0x30000000
10#define IRAMORIG 0 13*/
14#define IRAMORIG 0x81000000
11#define IRAMSIZE 0x50000 15#define IRAMSIZE 0x50000
12 16
13MEMORY 17MEMORY
14{ 18{
15 DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE 19 /*DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE*/
16 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE 20 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
17} 21}
18 22