summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bootloader/imx233.c10
-rw-r--r--firmware/target/arm/imx233/boot.lds30
2 files changed, 26 insertions, 14 deletions
diff --git a/bootloader/imx233.c b/bootloader/imx233.c
index 548bb3686f..86edc24cc2 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 @@ void main(uint32_t arg)
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 @@ void main(uint32_t arg)
}
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 fb6ffdcf23..206e0bb99f 100644
--- a/firmware/target/arm/imx233/boot.lds
+++ b/firmware/target/arm/imx233/boot.lds
@@ -6,28 +6,35 @@ OUTPUT_FORMAT(elf32-littlearm)
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 @@ SECTIONS
_iramend = .;
} > IRAM AT> DRAM
- _iramcopy = LOADADDR(.iram);
+ _iramcopy = LOADADDR(.itext);
.ibss (NOLOAD) :
{
@@ -58,6 +65,9 @@ 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) :
{
@@ -73,7 +83,7 @@ SECTIONS
. = ALIGN(CACHEALIGN_SIZE);
} AT> DRAM
- .bssendadr . - UNCACHED_DRAM_ADDR + CACHED_DRAM_ADDR (NOLOAD) :
+ .bssendadr (NOLOAD) :
{
_end = .;
} > DRAM