]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
x86: Parametize values used in linker script
authorGraeme Russ <graeme.russ@gmail.com>
Sat, 12 Feb 2011 04:11:24 +0000 (15:11 +1100)
committerGraeme Russ <graeme.russ@gmail.com>
Sat, 12 Feb 2011 04:11:24 +0000 (15:11 +1100)
arch/i386/config.mk
arch/i386/cpu/config.mk
arch/i386/cpu/u-boot.lds
arch/i386/lib/realmode.c
board/eNET/config.mk

index fc6a313f7616495dd780b320ffcc4eb525dfa543..a84af632106edb84f65e39468cd2c0915dcb8881 100644 (file)
@@ -32,6 +32,7 @@ PLATFORM_CPPFLAGS += $(call cc-option, -fno-toplevel-reorder,  $(call cc-option,
 PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector)
 PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2)
 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
+PLATFORM_CPPFLAGS += -DREALMODE_BASE=0x7c0
 
 PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
 
index ec1d102762b291127ca584416f50b046a2fe691c..9b2e2c9fe1191153045208b5dcb3ce7b024a1e60 100644 (file)
@@ -24,3 +24,9 @@
 CROSS_COMPILE ?= i386-linux-
 
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__ -march=i386 -Werror
+
+# DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!
+LDPPFLAGS += -DRESET_SEG_START=0xffff0000
+LDPPFLAGS += -DRESET_SEG_SIZE=0x10000
+LDPPFLAGS += -DRESET_VEC_LOC=0xfff0
+LDPPFLAGS += -DSTART_16=0xf800
index 3eeb2a201b4475614e247cd92a6198d8ef8f9fe7..98a548d62eb630e179e9598fee1cbf0f0ce2201a 100644 (file)
@@ -73,7 +73,7 @@ SECTIONS
        /DISCARD/ : { *(.gnu*) }
 
        /* 16bit realmode trampoline code */
-       .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }
+       .realmode REALMODE_BASE : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }
 
        __realmode_start = LOADADDR(.realmode);
        __realmode_size = SIZEOF(.realmode);
@@ -84,21 +84,13 @@ SECTIONS
        __bios_start = LOADADDR(.bios);
        __bios_size = SIZEOF(.bios);
 
-       /* The load addresses below assumes that the flash
-        * will be mapped so that 0x387f0000 == 0xffff0000
-        * at reset time
-        *
-        * The fe00 and ff00 offsets of the start32 and start16
-        * segments are arbitrary, the just have to be mapped
-        * at reset and the code have to fit.
-        * The fff0 offset of resetvec is important, however.
+       /*
+        * The following expressions place the 16-bit Real-Mode code and
+        * Reset Vector at the end of the Flash ROM
         */
-       . = 0xfffffe00;
-       .start32 : AT (CONFIG_SYS_TEXT_BASE + 0x3fe00) { KEEP(*(.start32)); }
+       . = START_16;
+       .start16 : AT (CONFIG_SYS_TEXT_BASE + (FLASH_SIZE - RESET_SEG_SIZE + START_16)) { KEEP(*(.start16)); }
 
-       . = 0xf800;
-       .start16 : AT (CONFIG_SYS_TEXT_BASE + 0x3f800) { KEEP(*(.start16)); }
-
-       . = 0xfff0;
-       .resetvec : AT (CONFIG_SYS_TEXT_BASE + 0x3fff0) { KEEP(*(.resetvec)); }
+       . = RESET_VEC_LOC;
+       .resetvec : AT (CONFIG_SYS_TEXT_BASE + (FLASH_SIZE - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); }
 }
index 60fe1816a175fcd3af3e722d9312d1f907d2bd6b..2dda95b064d38d693fd6233f684bd7b4e2805784 100644 (file)
@@ -27,7 +27,6 @@
 #include <asm/realmode.h>
 
 
-#define REALMODE_BASE    ((char*)0x7c0)
 #define REALMODE_MAILBOX ((char*)0xe00)
 
 
@@ -41,13 +40,14 @@ int realmode_setup(void)
        ulong realmode_size = (ulong)&__realmode_size;
 
        /* copy the realmode switch code */
-       if (realmode_size > (REALMODE_MAILBOX-REALMODE_BASE)) {
+       if (realmode_size > (REALMODE_MAILBOX - (char *)REALMODE_BASE)) {
                printf("realmode switch too large (%ld bytes, max is %d)\n",
-                      realmode_size, (REALMODE_MAILBOX-REALMODE_BASE));
+                      realmode_size,
+                      (REALMODE_MAILBOX - (char *)REALMODE_BASE));
                return -1;
        }
 
-       memcpy(REALMODE_BASE, (void*)realmode_start, realmode_size);
+       memcpy((char *)REALMODE_BASE, (void *)realmode_start, realmode_size);
        asm("wbinvd\n");
 
        return 0;
index 425714193b13d7e35a68918b288e6e67bf0141d9..9d2dfa535b2ecedd9b9ce8e11ecff4c73daabead 100644 (file)
@@ -21,3 +21,4 @@
 # MA 02111-1307 USA
 #
 
+LDPPFLAGS += -DFLASH_SIZE=0x40000