summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/as3525/app.lds
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/app.lds')
-rw-r--r--firmware/target/arm/as3525/app.lds53
1 files changed, 38 insertions, 15 deletions
diff --git a/firmware/target/arm/as3525/app.lds b/firmware/target/arm/as3525/app.lds
index bf8e68f048..21cdac528b 100644
--- a/firmware/target/arm/as3525/app.lds
+++ b/firmware/target/arm/as3525/app.lds
@@ -6,6 +6,11 @@ OUTPUT_FORMAT(elf32-littlearm)
OUTPUT_ARCH(arm)
STARTUP(target/arm/crt0.o)
+#if MEMORYSIZE <= 2
+/* we put the codec buffer in IRAM */
+#define LOWMEM
+#endif
+
#define PLUGINSIZE PLUGIN_BUFFER_SIZE
#define CODECSIZE CODEC_SIZE
@@ -16,8 +21,15 @@ STARTUP(target/arm/crt0.o)
#endif
#include "cpu.h"
+
#define IRAMSIZE 0x50000
+
+#ifdef LOWMEM
+#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE
+#define CODECORIG (IRAMORIG + IRAMSIZE - CODEC_SIZE)
+#else
#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - CODECSIZE
+#endif
#define IRAMORIG 0x0
#define DRAMORIG 0x30000000 + STUBOFFSET
@@ -26,11 +38,20 @@ STARTUP(target/arm/crt0.o)
#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
/* Where the codec buffer ends, and the plugin buffer starts */
+#ifdef LOWMEM
+#define ENDADDR (ENDAUDIOADDR)
+#else
#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
+#endif
MEMORY
{
+#ifdef LOWMEM
+ IRAM : ORIGIN = IRAMORIG, LENGTH = (IRAMSIZE - CODEC_SIZE)
+ CODEC_IRAM : ORIGIN = CODECORIG, LENGTH = CODEC_SIZE
+#else
IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+#endif
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
}
@@ -69,8 +90,6 @@ SECTIONS
*(.eh_frame)
}
- _initdata_end =.;
-
.vectors IRAMORIG:
{
_vectors_start = .;
@@ -79,16 +98,7 @@ SECTIONS
_vectorscopy = LOADADDR(.vectors);
- .ibss (NOLOAD) :
- {
- _iedata = .;
- *(.qharray)
- *(.ibss)
- . = ALIGN(0x4);
- _iend = .;
- } > IRAM
-
- .iram _iend :
+ .iram :
{
_iramstart = .;
*(.icode)
@@ -98,6 +108,15 @@ SECTIONS
_iramend = .;
} > IRAM AT> DRAM
+ .ibss (NOLOAD) :
+ {
+ _iedata = .;
+ *(.qharray)
+ *(.ibss)
+ . = ALIGN(0x4);
+ _iend = .;
+ } > IRAM
+
_iramcopy = LOADADDR(.iram);
.stack (NOLOAD) :
@@ -130,15 +149,19 @@ SECTIONS
_audiobufend = .;
} > DRAM
- .codec ENDAUDIOADDR (NOLOAD) :
+ .codec CODECORIG (NOLOAD) :
{
codecbuf = .;
_codecbuf = .;
- }
+#ifdef LOWMEM
+ } > CODEC_IRAM
+#else
+ } > DRAM
+#endif
.plugin ENDADDR (NOLOAD) :
{
_pluginbuf = .;
pluginbuf = .;
- }
+ } > DRAM
}