]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Fix build of h8300 hi_cpu2 board support - not tested.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Mon, 21 Mar 2011 00:49:55 +0000 (01:49 +0100)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Mon, 21 Mar 2011 00:49:55 +0000 (01:49 +0100)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
board/h8300/hi_cpu2/config.hi_cpu2
board/h8300/hi_cpu2/libs/bspbase/bsp0hwinit.c
board/h8300/hi_cpu2/libs/hi_cpu2.ld-bload
board/h8300/hi_cpu2/libs/hi_cpu2.ld-boot
board/h8300/hi_cpu2/libs/hi_cpu2.ld-flash
board/h8300/hi_cpu2/libs/hi_cpu2.ld-flashnoram

index 8eaf6c451136b3af800394c048a5b50c4f1dabf4..dd89fd3778ac604059002fb738330c94830a7a45 100644 (file)
@@ -6,7 +6,7 @@ BOARD=hi_cpu2
 
 #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
index ec59e50ffbac04238261356105e50bc3833e7732..5c13cede5a1e09170a38af3abd59721162aef025 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
@@ -54,6 +68,8 @@ void _setup_board()
 
   DEB_LED_INIT();
 
+  relocate_boot_fn();
+
   /* show something on debug leds */
   deb_led_out(0);
   FlWait(1*100000);
index 970be309b0f0b03eaf164c17c72ab3e57a698695..7ed90d27100f257b9cc1fd03acffc15f7acb1ce3 100644 (file)
@@ -20,6 +20,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 28fe36e1269efd8334ea8ba4d0cb6e08007e8f21..c3f5246d45c8f90b4e227cf50a99a5c0473c8fde 100644 (file)
@@ -24,22 +24,32 @@ SECTIONS
          . = 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)
index 9e60f2af3664e036db92693c4c556355281d396b..c11c531d9ea94249dc434f35078988694433c6d1 100644 (file)
@@ -19,6 +19,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))
index eaa905dc0834299f676601afacf97fdff3708ffe..a8449e1ef87023cb818cd0b2302a74baed819b4d 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))