ARM: fix address setup in start.S
[oweals/u-boot.git] / arch / arm / cpu / armv7 / start.S
index d5c053dc58576fd37bb55236e521c72e6246675d..bdf2fad3802f83659eaf11e3da955f2bab303333 100644 (file)
@@ -29,6 +29,7 @@
  * MA 02111-1307 USA
  */
 
+#include <asm-offsets.h>
 #include <config.h>
 #include <version.h>
 
@@ -67,7 +68,7 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
-       .word   TEXT_BASE
+       .word   CONFIG_SYS_TEXT_BASE
 
 #if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
 .globl _armboot_start
@@ -224,13 +225,13 @@ copy_loop:
        ldr     r3, _rel_dyn_end_ofs    /* r3 <- rel dyn end ofs */
        add     r3, r3, r0              /* r3 <- rel dyn end in FLASH */
 fixloop:
-       ldr     r0, [r2]        /* r0 <- location to fix up, IN FLASH! */
-       add     r0, r9          /* r0 <- location to fix up in RAM */
+       ldr     r0, [r2]                /* r0 <- location to fix up, IN FLASH! */
+       add     r0, r0, r9              /* r0 <- location to fix up in RAM */
        ldr     r1, [r2, #4]
        and     r8, r1, #0xff
-       cmp     r8, #23         /* relative fixup? */
+       cmp     r8, #23                 /* relative fixup? */
        beq     fixrel
-       cmp     r8, #2          /* absolute fixup? */
+       cmp     r8, #2                  /* absolute fixup? */
        beq     fixabs
        /* ignore unknown type of fixup */
        b       fixnext
@@ -247,7 +248,7 @@ fixrel:
        add     r1, r1, r9
 fixnext:
        str     r1, [r0]
-       add     r2, r2, #8      /* each rel.dyn entry is 8 bytes */
+       add     r2, r2, #8              /* each rel.dyn entry is 8 bytes */
        cmp     r2, r3
        blo     fixloop
 
@@ -274,8 +275,10 @@ clbss_l:str        r2, [r0]                /* clear loop...                    */
 jump_2_ram:
        ldr     r0, _board_init_r_ofs
        adr     r1, _start
-       add     r0, r0, r1
-       add     lr, r0, r9
+       add     lr, r0, r1
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+       add     lr, lr, r9
+#endif
        /* setup parameters for board_init_r */
        mov     r0, r5          /* gd_t */
        mov     r1, r7          /* dest_addr */
@@ -357,7 +360,7 @@ copy_loop:                          @ copy 32 bytes at a time
 stack_setup:
        ldr     r0, _TEXT_BASE          @ upper 128 KiB: relocated uboot
        sub     r0, r0, #CONFIG_SYS_MALLOC_LEN @ malloc area
-       sub     r0, r0, #CONFIG_SYS_GBL_DATA_SIZE @ bdinfo
+       sub     r0, r0, #GENERATED_GBL_DATA_SIZE @ bdinfo
 #ifdef CONFIG_USE_IRQ
        sub     r0, r0, #(CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ)
 #endif
@@ -464,7 +467,7 @@ cpu_init_crit:
 #if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
        ldr     r2, _armboot_start
        sub     r2, r2, #(CONFIG_SYS_MALLOC_LEN)
-       sub     r2, r2, #(CONFIG_SYS_GBL_DATA_SIZE + 8) @ set base 2 words into abort
+       sub     r2, r2, #(GENERATED_GBL_DATA_SIZE + 8)  @ set base 2 words into abort
 #else
        ldr     r2, IRQ_STACK_START_IN          @ set base 2 words into abort
                                                @ stack
@@ -507,7 +510,7 @@ cpu_init_crit:
 #if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
        ldr     r13, _armboot_start             @ setup our mode stack (enter
        sub     r13, r13, #(CONFIG_SYS_MALLOC_LEN)      @ move past malloc pool
-       sub     r13, r13, #(CONFIG_SYS_GBL_DATA_SIZE + 8) @ move to reserved a couple
+       sub     r13, r13, #(GENERATED_GBL_DATA_SIZE + 8) @ move to reserved a couple
 #else
        ldr     r13, IRQ_STACK_START_IN         @ setup our mode stack (enter
                                                @ in banked mode)
@@ -535,7 +538,7 @@ cpu_init_crit:
 #if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
        ldr     r0, _armboot_start              @ get data regions start
        sub     r0, r0, #(CONFIG_SYS_MALLOC_LEN)        @ move past malloc pool
-       sub     r0, r0, #(CONFIG_SYS_GBL_DATA_SIZE + 8) @ move past gbl and a couple
+       sub     r0, r0, #(GENERATED_GBL_DATA_SIZE + 8)  @ move past gbl and a couple
 #else
        ldr     r0, IRQ_STACK_START_IN          @ get data regions start
                                                @ spots for abort stack