1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Amaury Pouly 2011-09-13 23:38:08 +00:00
parent dad541a391
commit d945c36677
2 changed files with 26 additions and 14 deletions

View file

@ -41,7 +41,8 @@
#include "usb.h" #include "usb.h"
#include "usb-target.h" #include "usb-target.h"
#include "clkctrl-imx233.h" extern char loadaddress[];
extern char loadaddressend[];
#ifdef HAVE_BOOTLOADER_USB_MODE #ifdef HAVE_BOOTLOADER_USB_MODE
static void usb_mode(int connect_timeout) static void usb_mode(int connect_timeout)
@ -151,8 +152,8 @@ void main(uint32_t arg)
printf("Loading firmware"); printf("Loading firmware");
loadbuffer = (unsigned char*)DRAM_ORIG; /* DRAM */ loadbuffer = (unsigned char*)loadaddress;
buffer_size = (int)(loadbuffer + DRAM_SIZE - TTB_SIZE); buffer_size = (int)(loadaddressend - loadaddress);
while((ret = load_firmware(loadbuffer, BOOTFILE, buffer_size)) < 0) while((ret = load_firmware(loadbuffer, BOOTFILE, buffer_size)) < 0)
{ {
@ -160,8 +161,9 @@ void main(uint32_t arg)
} }
kernel_entry = (void*) loadbuffer; kernel_entry = (void*) loadbuffer;
cpucache_invalidate();
printf("Executing"); printf("Executing");
disable_interrupt(IRQ_FIQ_STATUS);
commit_discard_idcache();
kernel_entry(); kernel_entry();
printf("ERR: Failed to boot"); printf("ERR: Failed to boot");

View file

@ -6,28 +6,35 @@ OUTPUT_FORMAT(elf32-littlearm)
OUTPUT_ARCH(arm) OUTPUT_ARCH(arm)
STARTUP(target/arm/imx233/crt0.o) 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 MEMORY
{ {
IRAM : ORIGIN = IRAM_ORIG, LENGTH = IRAM_SIZE IRAM : ORIGIN = IRAM_ORIG, LENGTH = IRAM_SIZE
DRAM : ORIGIN = CACHED_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
UNCACHED_DRAM : ORIGIN = UNCACHED_DRAM_ADDR, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE UDRAM : ORIGIN = UNCACHED_DRAM_ADDR + RAM_HOLE, LENGTH = DRAM_SIZE - TTB_SIZE - FRAME_SIZE - RAM_HOLE
} }
SECTIONS SECTIONS
{ {
loadaddress = UNCACHED_DRAM_ADDR;
_loadaddress = UNCACHED_DRAM_ADDR;
loadaddressend = UNCACHED_DRAM_ADDR + RAM_HOLE;
_loadaddressend = UNCACHED_DRAM_ADDR + RAM_HOLE;
.text : .text :
{ {
*(.text*) *(.text*)
} > DRAM
.data :
{
*(.data*) *(.data*)
*(.rodata*) *(.rodata*)
_dataend = . ;
} > DRAM } > DRAM
.iram : .itext :
{ {
_iramstart = .; // always 0 _iramstart = .; // always 0
*(.vectors) *(.vectors)
@ -39,7 +46,7 @@ SECTIONS
_iramend = .; _iramend = .;
} > IRAM AT> DRAM } > IRAM AT> DRAM
_iramcopy = LOADADDR(.iram); _iramcopy = LOADADDR(.itext);
.ibss (NOLOAD) : .ibss (NOLOAD) :
{ {
@ -58,6 +65,9 @@ SECTIONS
stackend = .; stackend = .;
} > DRAM } > DRAM
/* physical address of the stack */
stackend_phys = stackend - CACHED_DRAM_ADDR + UNCACHED_DRAM_ADDR;
/* treat .bss and .ncbss as a single section */ /* treat .bss and .ncbss as a single section */
.bss (NOLOAD) : .bss (NOLOAD) :
{ {
@ -73,7 +83,7 @@ SECTIONS
. = ALIGN(CACHEALIGN_SIZE); . = ALIGN(CACHEALIGN_SIZE);
} AT> DRAM } AT> DRAM
.bssendadr . - UNCACHED_DRAM_ADDR + CACHED_DRAM_ADDR (NOLOAD) : .bssendadr (NOLOAD) :
{ {
_end = .; _end = .;
} > DRAM } > DRAM