#PREFIX_DIR=$(ARCH)
-CROSS_COMPILE = h8300-coff-
+CROSS_COMPILE = h8300-elf-
TARGET_ARCH = -ms
# Set default C flags. If theese are set elsewhere (e.g. on a command
DEB_LED_OFF(3);
}
+/* Provided by linker script */
+extern char __boot_fn_load;
+extern char __boot_fn_start;
+extern char __boot_fn_end;
+
+static void relocate_boot_fn()
+{
+ size_t reloc_size=&__boot_fn_end-&__boot_fn_start;
+
+ if(&__boot_fn_load != &__boot_fn_start) {
+ memcpy(&__boot_fn_start,&__boot_fn_load,reloc_size);
+ }
+}
+
void _setup_board()
{
//int i, j;// POE-100
DEB_LED_INIT();
+ relocate_boot_fn();
+
/* show something on debug leds */
deb_led_out(0);
FlWait(1*100000);
*(.strings)
. = ALIGN( 4 ) ;
___boot_fn_start = ALIGN( 0x4 ) ;
+ ___boot_fn_load = ALIGN( 0x4 ) ;
KEEP (*boot_fn.o(.text))
KEEP (*boot_fn.o(.rodata))
. = ALIGN( 4 ) ;
. = ALIGN( 0x4 ) ;
} > iram0
+ .text.boot_fn ALIGN(4) :
+ {
+ . = ALIGN( 0x4 ) ;
+ KEEP (boot_fn.o(.text))
+ KEEP (boot_fn.o(.rodata))
+ KEEP (boot_fn.o(.strings))
+ . = ALIGN( 4 ) ;
+ } > iram0 AT>flashbb
+ ___boot_fn_start = ADDR(.text.boot_fn);
+ ___boot_fn_end = ADDR(.text.boot_fn) + SIZEOF(.text.boot_fn);
+ ___boot_fn_load = LOADADDR(.text.boot_fn);
+
.text :
{
text_start = . ;
KEEP (crt0.o(.text))
- . = ALIGN( 4 ) ;
- ___boot_fn_start = ALIGN( 0x4 ) ;
- KEEP (*boot_fn.o(.text))
- KEEP (*boot_fn.o(.rodata))
- . = ALIGN( 4 ) ;
- ___boot_fn_end = ALIGN( 0x4 ) ;
- *(.text .stub .text.* .gnu.linkonce.t.*)
+ *(.text)
+ *(.rodata)
+ *(.text .stub .text.* .gnu.linkonce.t.*)
*(.rodata .rodata.* .gnu.linkonce.r.*)
+ *(.strings)
+ . = ALIGN( 0x4 ) ;
_etext = ALIGN( 0x4 ) ;
} > flashbb
- .tors :
+ .tors :
{
___ctors = . ;
*(.ctors)
LONG( ABSOLUTE( _start ) + 0x5a000000 ) /* JMP _start */
/* KEEP (crt0.o(.text)) */
. = ALIGN( 4 ) ;
+ ___boot_fn_load = ALIGN( 0x4 ) ;
___boot_fn_start = ALIGN( 0x4 ) ;
KEEP (*boot_fn.o(.text))
KEEP (*boot_fn.o(.rodata))
LONG( ABSOLUTE( _start ) + 0x5a000000 ) /* JMP _start */
/* KEEP (crt0.o(.text)) */
. = ALIGN( 4 ) ;
+ ___boot_fn_load = ALIGN( 0x4 ) ;
___boot_fn_start = ALIGN( 0x4 ) ;
KEEP (*boot_fn.o(.text))
KEEP (*boot_fn.o(.rodata))