summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/app.lds
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-17 19:02:21 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-17 19:02:21 +0100
commit8927df42054d1b3aae505f917281a20fe2536ec6 (patch)
treefac684651cf84c3069705f94c94399474ad92169 /firmware/target/arm/imx233/app.lds
parentdd6f5cfb1e324fa38f1f05b7dc83e0cd1d694a81 (diff)
downloadrockbox-8927df42054d1b3aae505f917281a20fe2536ec6.tar.gz
rockbox-8927df42054d1b3aae505f917281a20fe2536ec6.tar.bz2
rockbox-8927df42054d1b3aae505f917281a20fe2536ec6.zip
imx233: fix app.lds to properly support INIT_ATTR
Original fix by Marcin: it had a problem because crt0 on imx233 is more complicated than many targets: since we use virtual memory, we first disable the MMU, then move the entire image (including init and itext stuff), then setup a temporary stack to setup the MMU. Only when the MMU is enabled, can we move the init and itext stuff to its right location and finally boot. This requires some trickery because: - the initial move copies everything, including init and itext - the stack overlaps with init and itext to reclaim space - the temporary stack cannot be the same as the main stack to avoid trashing the init and itext code, also it needs to be a physical address Change-Id: Ibaf331c7d90b61f99225d93c9e621eb0f3f8f2dc
Diffstat (limited to 'firmware/target/arm/imx233/app.lds')
-rw-r--r--firmware/target/arm/imx233/app.lds14
1 files changed, 9 insertions, 5 deletions
diff --git a/firmware/target/arm/imx233/app.lds b/firmware/target/arm/imx233/app.lds
index b378f9ea16..335aa4fcc3 100644
--- a/firmware/target/arm/imx233/app.lds
+++ b/firmware/target/arm/imx233/app.lds
@@ -39,7 +39,7 @@ SECTIONS
{
_dramcopystart = .;
} > DRAM
-
+
.text :
{
*(.text*)
@@ -47,6 +47,8 @@ SECTIONS
*(.rodata*)
} > DRAM
+ _dramtextend = .;
+
.itext :
{
_iramstart = .; // always 0
@@ -77,12 +79,17 @@ SECTIONS
_initcopy = LOADADDR(.init);
+ /* crt0 needs a temporary stack which does not overlap with init and itext
+ * and is in physical memory: put it *after* init and itext. A small one suffices */
+ crt0_tmpstack_phys = _dramcopyend + 0x200 - CACHED_DRAM_ADDR + UNCACHED_DRAM_ADDR;
+
.dramcopyend (NOLOAD) :
{
_dramcopyend = .;
} > DRAM
- .stack (NOLOAD) :
+ /* the stack overlaps the init and itext region, to reclaim space */
+ .stack _dramtextend (NOLOAD) :
{
*(.stack)
stackbegin = .;
@@ -90,9 +97,6 @@ SECTIONS
stackend = .;
} > DRAM
- /* physical address of the stack */
- stackend_phys = stackend - CACHED_DRAM_ADDR + UNCACHED_DRAM_ADDR;
-
/* treat .bss and .ncbss as a single section */
.bss (NOLOAD) :
{