]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
h8300: Port the newest bloader to h8eurobot board
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 16 Mar 2011 15:48:07 +0000 (16:48 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 16 Mar 2011 15:48:07 +0000 (16:48 +0100)
board/h8300/h8eurobot/libs/bspbase/bsp0hwinit.c
board/h8300/h8eurobot/libs/h8canusb.ld-bload
board/h8300/h8eurobot/libs/h8canusb.ld-boot
board/h8300/h8eurobot/libs/h8canusb.ld-flash

index 3fb011e866476a1960ba5fda66dcc297cad7dd29..5e91e12f482b23150f8cafb3b7d645136f30aa1f 100644 (file)
@@ -31,6 +31,20 @@ static void deb_led_out(char val)
     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
@@ -56,6 +70,8 @@ void _setup_board()
 
   DEB_LED_INIT();
 
+  relocate_boot_fn();
+
   /* show something on debug leds */
   deb_led_out(0);
   FlWait(1*100000);
index 95a6a50e222a0e64b72931a92f94c06609e97530..07a495f5f510b0371fd7777582ab1feba2c7fcec 100644 (file)
@@ -17,6 +17,7 @@ SECTIONS
          *(.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 ) ;
index d3d2bfa739a50f938b236142f223ef29653e38ca..b50ec7da2b0d422a5a2db7b2cbbf785ca7508201 100644 (file)
@@ -24,29 +24,30 @@ SECTIONS
          . = ALIGN( 0x4 ) ;
        } > iram0
 
-        .text :
+       .text.boot_fn ALIGN(4) :
        {
-         text_start = . ;
-         KEEP (crt0.o(.text))
-          *(EXCLUDE_FILE(*boot_fn.o) .text)
-         *(EXCLUDE_FILE(*boot_fn.o) .rodata)                           
-         *(EXCLUDE_FILE(*boot_fn.o) .text .stub .text.* .gnu.linkonce.t.*)
-         *(EXCLUDE_FILE(*boot_fn.o) .rodata .rodata.* .gnu.linkonce.r.*)
-         *(EXCLUDE_FILE(*boot_fn.o) .strings)
          . = ALIGN( 0x4 ) ;
-         _etext = ALIGN( 0x4 ) ;
-        } > flashbb
-       .text.boot_fn :
-       {
-         . = ALIGN( 4 ) ;
-         ___boot_fn_start = ALIGN( 0x4 ) ;
           KEEP (boot_fn.o(.text))
          KEEP (boot_fn.o(.rodata))
          KEEP (boot_fn.o(.strings))
          . = ALIGN( 4 ) ;
-         ___boot_fn_end = ALIGN( 0x4 ) ;
        } > 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))
+          *(.text)
+         *(.rodata)                            
+         *(.text .stub .text.* .gnu.linkonce.t.*)
+         *(.rodata .rodata.* .gnu.linkonce.r.*)
+         *(.strings)
+         . = ALIGN( 0x4 ) ;
+         _etext = ALIGN( 0x4 ) ;
+        } > flashbb
        .tors : 
        {
          ___ctors = . ;
index 414077fa8f319fcd9406922dc7f9023af7f51395..5882d68b844aa364bf601b89aa1f461b4c8ef222 100644 (file)
@@ -20,6 +20,7 @@ SECTIONS
          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))