imx233/fuze+: rework linker script to load the bootloader at ram start + 1Mb to leave a load for the firmware
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30521 a1c6a512-1295-4272-9138-f99709370657
diff --git a/bootloader/imx233.c b/bootloader/imx233.c
index 548bb36..86edc24 100644
--- a/bootloader/imx233.c
+++ b/bootloader/imx233.c
@@ -41,7 +41,8 @@
#include "usb.h"
#include "usb-target.h"
-#include "clkctrl-imx233.h"
+extern char loadaddress[];
+extern char loadaddressend[];
#ifdef HAVE_BOOTLOADER_USB_MODE
static void usb_mode(int connect_timeout)
@@ -151,8 +152,8 @@
printf("Loading firmware");
- loadbuffer = (unsigned char*)DRAM_ORIG; /* DRAM */
- buffer_size = (int)(loadbuffer + DRAM_SIZE - TTB_SIZE);
+ loadbuffer = (unsigned char*)loadaddress;
+ buffer_size = (int)(loadaddressend - loadaddress);
while((ret = load_firmware(loadbuffer, BOOTFILE, buffer_size)) < 0)
{
@@ -160,8 +161,9 @@
}
kernel_entry = (void*) loadbuffer;
- cpucache_invalidate();
printf("Executing");
+ disable_interrupt(IRQ_FIQ_STATUS);
+ commit_discard_idcache();
kernel_entry();
printf("ERR: Failed to boot");
diff --git a/firmware/target/arm/imx233/boot.lds b/firmware/target/arm/imx233/boot.lds
index fb6ffdc..206e0bb 100644
--- a/firmware/target/arm/imx233/boot.lds
+++ b/firmware/target/arm/imx233/boot.lds
@@ -6,28 +6,35 @@
OUTPUT_ARCH(arm)
STARTUP(target/arm/imx233/crt0.o)
+/* Leave a hole at the beginning of the RAM to load the firmware */
+#define RAM_HOLE 1024 * 1024
+
+/* Make a difference between virtual and physical address so that we can use
+ * the resulting elf file with the elftosb tools which loads at the *physical*
+ * address */
+
MEMORY
{
IRAM : ORIGIN = IRAM_ORIG, LENGTH = IRAM_SIZE
- DRAM : ORIGIN = CACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE
- UNCACHED_DRAM : ORIGIN = UNCACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE
+ DRAM : ORIGIN = CACHED_DRAM_ADDR + RAM_HOLE, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE - RAM_HOLE
+ UDRAM : ORIGIN = UNCACHED_DRAM_ADDR + RAM_HOLE, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE - RAM_HOLE
}
SECTIONS
{
+ loadaddress = UNCACHED_DRAM_ADDR;
+ _loadaddress = UNCACHED_DRAM_ADDR;
+ loadaddressend = UNCACHED_DRAM_ADDR + RAM_HOLE;
+ _loadaddressend = UNCACHED_DRAM_ADDR + RAM_HOLE;
+
.text :
{
*(.text*)
- } > DRAM
-
- .data :
- {
*(.data*)
*(.rodata*)
- _dataend = . ;
} > DRAM
- .iram :
+ .itext :
{
_iramstart = .; // always 0
*(.vectors)
@@ -39,7 +46,7 @@
_iramend = .;
} > IRAM AT> DRAM
- _iramcopy = LOADADDR(.iram);
+ _iramcopy = LOADADDR(.itext);
.ibss (NOLOAD) :
{
@@ -58,6 +65,9 @@
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) :
{
@@ -73,7 +83,7 @@
. = ALIGN(CACHEALIGN_SIZE);
} AT> DRAM
- .bssendadr . - UNCACHED_DRAM_ADDR + CACHED_DRAM_ADDR (NOLOAD) :
+ .bssendadr (NOLOAD) :
{
_end = .;
} > DRAM