Commit e945f6dc2814f5f0d30b5b7e23821b3fd4faff5b

Authored by Michal Simek
1 parent 4dd097427a

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Showing 12 changed files with 195 additions and 272 deletions Side-by-side Diff

arch/microblaze/config.mk
... ... @@ -15,4 +15,9 @@
15 15 CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000
16 16  
17 17 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
  18 +
  19 +ifeq ($(CONFIG_SPL_BUILD),)
  20 +PLATFORM_CPPFLAGS += -fPIC
  21 +endif
  22 +__HAVE_ARCH_GENERIC_BOARD := y
arch/microblaze/cpu/start.S
... ... @@ -150,6 +150,7 @@
150 150 bnei r6, 2b
151 151 3: /* jumping to board_init */
152 152 #ifndef CONFIG_SPL_BUILD
  153 + or r5, r0, r0 /* flags - empty */
153 154 brai board_init_f
154 155 #else
155 156 addi r31, r0, CONFIG_SYS_SPL_MALLOC_END
... ... @@ -190,5 +191,107 @@
190 191 rtsd r15, 8
191 192 or r0, r0, r0
192 193 .end out16
  194 +
  195 +/*
  196 + * Relocate u-boot
  197 + */
  198 + .text
  199 + .global relocate_code
  200 + .ent relocate_code
  201 + .align 2
  202 +relocate_code:
  203 + /*
  204 + * r5 - start_addr_sp
  205 + * r6 - new_gd
  206 + * r7 - reloc_addr
  207 + */
  208 + addi r1, r5, 0 /* Start to use new SP */
  209 + addi r31, r6, 0 /* Start to use new GD */
  210 +
  211 + add r23, r0, r7 /* Move reloc addr to r23 */
  212 + /* Relocate text and data - r12 temp value */
  213 + addi r21, r0, _start
  214 + addi r22, r0, __end - 4 /* Include BSS too */
  215 +1: lwi r12, r21, 0 /* Load u-boot data */
  216 + swi r12, r23, 0 /* Write zero to loc */
  217 + addi r21, r21, 4 /* Increment to next loc - origin code */
  218 + cmp r12, r21, r22 /* Check if we have reach the end */
  219 + bneid r12, 1b
  220 + addi r23, r23, 4 /* Increment to next loc - relocate code */
  221 +
  222 + /* R23 points to the base address. */
  223 + add r23, r0, r7 /* Move reloc addr to r23 */
  224 + addi r24, r0, CONFIG_SYS_TEXT_BASE /* Get reloc offset */
  225 + rsub r23, r24, r23 /* keep - this is already here gd->reloc_off */
  226 +
  227 + addik r6, r0, 0x2 /* BIG/LITTLE endian offset */
  228 + lwi r7, r0, 0x28
  229 + swi r6, r0, 0x28 /* used first unused MB vector */
  230 + lbui r10, r0, 0x28 /* used first unused MB vector */
  231 + swi r7, r0, 0x28
  232 +
  233 +#ifdef CONFIG_SYS_USR_EXCEP
  234 + addik r6, r0, _exception_handler
  235 + addk r6, r6, r23 /* add offset */
  236 + sw r6, r1, r0
  237 + lhu r7, r1, r10
  238 + rsubi r8, r10, 0xa
  239 + sh r7, r0, r8
  240 + rsubi r8, r10, 0xe
  241 + sh r6, r0, r8
  242 +#endif
  243 + addik r6, r0, _hw_exception_handler
  244 + addk r6, r6, r23 /* add offset */
  245 + sw r6, r1, r0
  246 + lhu r7, r1, r10
  247 + rsubi r8, r10, 0x22
  248 + sh r7, r0, r8
  249 + rsubi r8, r10, 0x26
  250 + sh r6, r0, r8
  251 +
  252 + addik r6, r0, _interrupt_handler
  253 + addk r6, r6, r23 /* add offset */
  254 + sw r6, r1, r0
  255 + lhu r7, r1, r10
  256 + rsubi r8, r10, 0x12
  257 + sh r7, r0, r8
  258 + rsubi r8, r10, 0x16
  259 + sh r6, r0, r8
  260 +
  261 + /* Check if GOT exist */
  262 + addik r21, r23, _got_start
  263 + addik r22, r23, _got_end
  264 + cmpu r12, r21, r22
  265 + beqi r12, 2f /* No GOT table - jump over */
  266 +
  267 + /* Skip last 3 entries plus 1 because of loop boundary below */
  268 + addik r22, r22, -0x10
  269 +
  270 + /* Relocate the GOT. */
  271 +3: lw r12, r21, r0 /* Load entry */
  272 + addk r12, r12, r23 /* Add reloc offset */
  273 + sw r12, r21, r0 /* Save entry back */
  274 +
  275 + cmpu r12, r21, r22 /* Check if this cross boundary */
  276 + bneid r12, 3b
  277 + addik r21. r21, 4
  278 +
  279 + /* Update pointer to GOT */
  280 + mfs r20, rpc
  281 + addik r20, r20, _GLOBAL_OFFSET_TABLE_ + 8
  282 + addk r20, r20, r23
  283 +
  284 + /* Flush caches to ensure consistency */
  285 + addik r5, r0, 0
  286 + addik r6, r0, XILINX_DCACHE_BYTE_SIZE
  287 + bralid r15, flush_cache
  288 + nop
  289 +
  290 +2: addi r5, r31, 0 /* gd is initialized in board_r.c */
  291 + addi r6, r0, CONFIG_SYS_TEXT_BASE
  292 + addi r12, r23, board_init_r
  293 + bra r12 /* Jump to relocated code */
  294 +
  295 + .end relocate_code
193 296 #endif
arch/microblaze/cpu/u-boot.lds
... ... @@ -33,10 +33,19 @@
33 33 __data_end = .;
34 34 }
35 35  
  36 + .got ALIGN(4):
  37 + {
  38 + _got_start = .;
  39 + *(.got*)
  40 + . = ALIGN(4);
  41 + _got_end = .;
  42 + }
  43 +
36 44 . = ALIGN(4);
37 45 .u_boot_list : {
38 46 KEEP(*(SORT(.u_boot_list*)));
39 47 }
  48 + __init_end = . ;
40 49  
41 50 .bss ALIGN(0x4):
42 51 {
arch/microblaze/include/asm/config.h
... ... @@ -7,5 +7,13 @@
7 7 #ifndef _ASM_CONFIG_H_
8 8 #define _ASM_CONFIG_H_
9 9  
  10 +#ifndef CONFIG_SPL_BUILD
  11 +#define CONFIG_NEEDS_MANUAL_RELOC
  12 +#endif
  13 +
  14 +#define CONFIG_NR_DRAM_BANKS 1
  15 +#define CONFIG_SYS_GENERIC_BOARD
  16 +#define CONFIG_SYS_GENERIC_GLOBAL_DATA
  17 +
10 18 #endif
arch/microblaze/include/asm/u-boot.h
... ... @@ -16,16 +16,7 @@
16 16 #ifndef _U_BOOT_H_
17 17 #define _U_BOOT_H_
18 18  
19   -typedef struct bd_info {
20   - unsigned long bi_memstart; /* start of DRAM memory */
21   - phys_size_t bi_memsize; /* size of DRAM memory in bytes */
22   - unsigned long bi_flashstart; /* start of FLASH memory */
23   - unsigned long bi_flashsize; /* size of FLASH memory */
24   - unsigned long bi_flashoffset; /* reserved area for startup monitor */
25   - unsigned long bi_sramstart; /* start of SRAM memory */
26   - unsigned long bi_sramsize; /* size of SRAM memory */
27   - ulong bi_boot_params; /* where this board expects params */
28   -} bd_t;
  19 +#include <asm-generic/u-boot.h>
29 20  
30 21 /* For image.h:image_check_target_arch() */
31 22 #define IH_ARCH_DEFAULT IH_ARCH_MICROBLAZE
arch/microblaze/lib/Makefile
... ... @@ -5,7 +5,6 @@
5 5 # SPDX-License-Identifier: GPL-2.0+
6 6 #
7 7  
8   -obj-y += board.o
9 8 obj-$(CONFIG_CMD_BOOTM) += bootm.o
10 9 obj-y += muldi3.o
arch/microblaze/lib/board.c
1   -/*
2   - * (C) Copyright 2007 Michal Simek
3   - * (C) Copyright 2004 Atmark Techno, Inc.
4   - *
5   - * Michal SIMEK <monstr@monstr.eu>
6   - * Yasushi SHOJI <yashi@atmark-techno.com>
7   - *
8   - * SPDX-License-Identifier: GPL-2.0+
9   - */
10   -
11   -#include <common.h>
12   -#include <command.h>
13   -#include <malloc.h>
14   -#include <version.h>
15   -#include <watchdog.h>
16   -#include <stdio_dev.h>
17   -#include <serial.h>
18   -#include <net.h>
19   -#include <spi.h>
20   -#include <linux/compiler.h>
21   -#include <asm/processor.h>
22   -#include <asm/microblaze_intc.h>
23   -#include <fdtdec.h>
24   -
25   -DECLARE_GLOBAL_DATA_PTR;
26   -
27   -static int display_banner(void)
28   -{
29   - printf("\n\n%s\n\n", version_string);
30   - return 0;
31   -}
32   -
33   -/*
34   - * All attempts to come up with a "common" initialization sequence
35   - * that works for all boards and architectures failed: some of the
36   - * requirements are just _too_ different. To get rid of the resulting
37   - * mess of board dependend #ifdef'ed code we now make the whole
38   - * initialization sequence configurable to the user.
39   - *
40   - * The requirements for any new initalization function is simple: it
41   - * receives a pointer to the "global data" structure as it's only
42   - * argument, and returns an integer return code, where 0 means
43   - * "continue" and != 0 means "fatal error, hang the system".
44   - */
45   -typedef int (init_fnc_t) (void);
46   -
47   -init_fnc_t *init_sequence[] = {
48   - env_init,
49   -#ifdef CONFIG_OF_CONTROL
50   - fdtdec_check_fdt,
51   -#endif
52   - serial_init,
53   -#ifndef CONFIG_SPL_BUILD
54   - console_init_f,
55   -#endif
56   - display_banner,
57   -#ifndef CONFIG_SPL_BUILD
58   - interrupt_init,
59   - timer_init,
60   -#endif
61   - NULL,
62   -};
63   -
64   -unsigned long monitor_flash_len;
65   -
66   -void board_init_f(ulong not_used)
67   -{
68   - bd_t *bd;
69   - init_fnc_t **init_fnc_ptr;
70   - gd = (gd_t *)(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET);
71   - bd = (bd_t *)(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET
72   - - GENERATED_BD_INFO_SIZE);
73   -#if defined(CONFIG_CMD_FLASH) && !defined(CONFIG_SPL_BUILD)
74   - ulong flash_size = 0;
75   -#endif
76   - asm ("nop"); /* FIXME gd is not initialize - wait */
77   - memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
78   - memset((void *)bd, 0, GENERATED_BD_INFO_SIZE);
79   - gd->bd = bd;
80   - gd->baudrate = CONFIG_BAUDRATE;
81   - bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
82   - bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
83   - gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
84   -
85   - monitor_flash_len = __end - __text_start;
86   -
87   -#ifdef CONFIG_OF_EMBED
88   - /* Get a pointer to the FDT */
89   - gd->fdt_blob = __dtb_dt_begin;
90   -#elif defined CONFIG_OF_SEPARATE
91   - /* FDT is at end of image */
92   - gd->fdt_blob = (void *)__end;
93   -#endif
94   -
95   -#ifndef CONFIG_SPL_BUILD
96   - /* Allow the early environment to override the fdt address */
97   - gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
98   - (uintptr_t)gd->fdt_blob);
99   -#endif
100   -
101   - /*
102   - * The Malloc area is immediately below the monitor copy in DRAM
103   - * aka CONFIG_SYS_MONITOR_BASE - Note there is no need for reloc_off
104   - * as our monitory code is run from SDRAM
105   - */
106   - mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
107   -
108   - serial_initialize();
109   -
110   -#ifdef CONFIG_XILINX_TB_WATCHDOG
111   - hw_watchdog_init();
112   -#endif
113   - for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
114   - WATCHDOG_RESET();
115   - if ((*init_fnc_ptr) () != 0)
116   - hang();
117   - }
118   -
119   -#ifndef CONFIG_SPL_BUILD
120   -#ifdef CONFIG_OF_CONTROL
121   - /* For now, put this check after the console is ready */
122   - if (fdtdec_prepare_fdt())
123   - panic("** No FDT - please see doc/README.fdt-control");
124   - else
125   - printf("DTB: 0x%x\n", (u32)gd->fdt_blob);
126   -#endif
127   -
128   - puts("SDRAM :\n");
129   - printf("\t\tIcache:%s\n", icache_status() ? "ON" : "OFF");
130   - printf("\t\tDcache:%s\n", dcache_status() ? "ON" : "OFF");
131   - printf("\tU-Boot Start:0x%08x\n", CONFIG_SYS_TEXT_BASE);
132   -
133   -#if defined(CONFIG_CMD_FLASH)
134   - puts("Flash: ");
135   - bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
136   - flash_size = flash_init();
137   - if (bd->bi_flashstart && flash_size > 0) {
138   -# ifdef CONFIG_SYS_FLASH_CHECKSUM
139   - print_size(flash_size, "");
140   - /*
141   - * Compute and print flash CRC if flashchecksum is set to 'y'
142   - *
143   - * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
144   - */
145   - if (getenv_yesno("flashchecksum") == 1) {
146   - printf(" CRC: %08X",
147   - crc32(0, (const u8 *)bd->bi_flashstart,
148   - flash_size)
149   - );
150   - }
151   - putc('\n');
152   -# else /* !CONFIG_SYS_FLASH_CHECKSUM */
153   - print_size(flash_size, "\n");
154   -# endif /* CONFIG_SYS_FLASH_CHECKSUM */
155   - bd->bi_flashsize = flash_size;
156   - bd->bi_flashoffset = bd->bi_flashstart + flash_size;
157   - } else {
158   - puts("Flash init FAILED");
159   - bd->bi_flashstart = 0;
160   - bd->bi_flashsize = 0;
161   - bd->bi_flashoffset = 0;
162   - }
163   -#endif
164   -
165   -#ifdef CONFIG_SPI
166   - spi_init();
167   -#endif
168   -
169   - /* relocate environment function pointers etc. */
170   - env_relocate();
171   -
172   - /* Initialize stdio devices */
173   - stdio_init();
174   -
175   - /* Initialize the jump table for applications */
176   - jumptable_init();
177   -
178   - /* Initialize the console (after the relocation and devices init) */
179   - console_init_r();
180   -
181   - board_init();
182   -
183   - /* Initialize from environment */
184   - load_addr = getenv_ulong("loadaddr", 16, load_addr);
185   -
186   -#if defined(CONFIG_CMD_NET)
187   - printf("Net: ");
188   - eth_initialize(gd->bd);
189   -
190   - uchar enetaddr[6];
191   - eth_getenv_enetaddr("ethaddr", enetaddr);
192   - printf("MAC: %pM\n", enetaddr);
193   -#endif
194   -
195   - /* main_loop */
196   - for (;;) {
197   - WATCHDOG_RESET();
198   - main_loop();
199   - }
200   -#endif /* CONFIG_SPL_BUILD */
201   -}
board/xilinx/microblaze-generic/microblaze-generic.c
... ... @@ -11,14 +11,60 @@
11 11  
12 12 #include <common.h>
13 13 #include <config.h>
  14 +#include <fdtdec.h>
14 15 #include <netdev.h>
15 16 #include <asm/processor.h>
16 17 #include <asm/microblaze_intc.h>
17 18 #include <asm/asm.h>
18 19 #include <asm/gpio.h>
19 20  
  21 +DECLARE_GLOBAL_DATA_PTR;
  22 +
20 23 #ifdef CONFIG_XILINX_GPIO
21 24 static int reset_pin = -1;
  25 +#endif
  26 +
  27 +#ifdef CONFIG_OF_CONTROL
  28 +ulong ram_base;
  29 +
  30 +void dram_init_banksize(void)
  31 +{
  32 + gd->bd->bi_dram[0].start = ram_base;
  33 + gd->bd->bi_dram[0].size = get_effective_memsize();
  34 +}
  35 +
  36 +int dram_init(void)
  37 +{
  38 + int node;
  39 + fdt_addr_t addr;
  40 + fdt_size_t size;
  41 + const void *blob = gd->fdt_blob;
  42 +
  43 + node = fdt_node_offset_by_prop_value(blob, -1, "device_type",
  44 + "memory", 7);
  45 + if (node == -FDT_ERR_NOTFOUND) {
  46 + debug("DRAM: Can't get memory node\n");
  47 + return 1;
  48 + }
  49 + addr = fdtdec_get_addr_size(blob, node, "reg", &size);
  50 + if (addr == FDT_ADDR_T_NONE || size == 0) {
  51 + debug("DRAM: Can't get base address or size\n");
  52 + return 1;
  53 + }
  54 + ram_base = addr;
  55 +
  56 + gd->ram_top = addr; /* In setup_dest_addr() is done +ram_size */
  57 + gd->ram_size = size;
  58 +
  59 + return 0;
  60 +};
  61 +#else
  62 +int dram_init(void)
  63 +{
  64 + gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
  65 +
  66 + return 0;
  67 +}
22 68 #endif
23 69  
24 70 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
... ... @@ -262,7 +262,7 @@
262 262  
263 263 static int setup_mon_len(void)
264 264 {
265   -#ifdef __ARM__
  265 +#if defined(__ARM__) || defined(__MICROBLAZE__)
266 266 gd->mon_len = (ulong)&__bss_end - (ulong)_start;
267 267 #elif defined(CONFIG_SANDBOX)
268 268 gd->mon_len = (ulong)&_end - (ulong)_init;
... ... @@ -909,7 +909,7 @@
909 909 #endif
910 910 announce_dram_init,
911 911 /* TODO: unify all these dram functions? */
912   -#if defined(CONFIG_ARM) || defined(CONFIG_X86)
  912 +#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
913 913 dram_init, /* configure available RAM banks */
914 914 #endif
915 915 #if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
... ... @@ -813,7 +813,7 @@
813 813 #if defined(CONFIG_ARM)
814 814 initr_enable_interrupts,
815 815 #endif
816   -#ifdef CONFIG_X86
  816 +#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
817 817 timer_init, /* initialize timer */
818 818 #endif
819 819 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
... ... @@ -183,8 +183,14 @@
183 183 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
184 184 {
185 185 bd_t *bd = gd->bd;
186   - print_num("mem start ", (ulong)bd->bi_memstart);
187   - print_lnum("mem size ", (u64)bd->bi_memsize);
  186 + int i;
  187 +
  188 + for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
  189 + print_num("DRAM bank", i);
  190 + print_num("-> start", bd->bi_dram[i].start);
  191 + print_num("-> size", bd->bi_dram[i].size);
  192 + }
  193 +
188 194 print_num("flash start ", (ulong)bd->bi_flashstart);
189 195 print_num("flash size ", (ulong)bd->bi_flashsize);
190 196 print_num("flash offset ", (ulong)bd->bi_flashoffset);
... ... @@ -196,6 +202,9 @@
196 202 print_eths();
197 203 #endif
198 204 printf("baudrate = %u bps\n", gd->baudrate);
  205 + print_num("relocaddr", gd->relocaddr);
  206 + print_num("reloc off", gd->reloc_off);
  207 +
199 208 return 0;
200 209 }
201 210  
include/configs/microblaze-generic.h
... ... @@ -106,62 +106,16 @@
106 106 # define CONFIG_XILINX_TB_WATCHDOG
107 107 #endif
108 108  
109   -/*
110   - * memory layout - Example
111   - * CONFIG_SYS_TEXT_BASE = 0x1200_0000; defined in config.mk
112   - * CONFIG_SYS_SRAM_BASE = 0x1000_0000;
113   - * CONFIG_SYS_SRAM_SIZE = 0x0400_0000; 64MB
114   - *
115   - * CONFIG_SYS_MONITOR_LEN = 0x40000
116   - * CONFIG_SYS_MALLOC_LEN = 3 * CONFIG_SYS_MONITOR_LEN = 0xC0000
117   - *
118   - * CONFIG_SYS_GBL_DATA_OFFSET = 0x1000_0000 + 0x0400_0000 - 0x1000 = 0x13FF_F000
119   - * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - CONFIG_SYS_MONITOR_LEN = 0x13FB_F000
120   - * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - CONFIG_SYS_MALLOC_LEN = 0x13EF_F000
121   - *
122   - * 0x1000_0000 CONFIG_SYS_SDRAM_BASE
123   - * MEMTEST_AREA 64kB
124   - * FREE
125   - * 0x1200_0000 CONFIG_SYS_TEXT_BASE
126   - * U-BOOT code
127   - * 0x1202_0000
128   - * FREE
129   - *
130   - * STACK
131   - * 0x13EF_F000 CONFIG_SYS_MALLOC_BASE
132   - * MALLOC_AREA 768kB Alloc
133   - * 0x13FB_F000 CONFIG_SYS_MONITOR_BASE
134   - * MONITOR_CODE 256kB Env
135   - * 0x13FF_F000 CONFIG_SYS_GBL_DATA_OFFSET
136   - * GLOBAL_DATA 4kB bd, gd
137   - * 0x1400_0000 CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_SDRAM_SIZE
138   - */
139   -
  109 +#ifndef CONFIG_OF_CONTROL
140 110 /* ddr sdram - main memory */
141   -#define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
142   -#define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
143   -#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
144   -#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x1000)
  111 +# define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
  112 +# define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
  113 +#endif
145 114  
146   -/* global pointer */
147   -/* start of global data */
148   -#define CONFIG_SYS_GBL_DATA_OFFSET \
149   - (CONFIG_SYS_SDRAM_SIZE - GENERATED_GBL_DATA_SIZE)
  115 +#define CONFIG_SYS_MALLOC_LEN 0xC0000
150 116  
151   -/* monitor code */
152   -#define SIZE 0x40000
153   -#define CONFIG_SYS_MONITOR_LEN SIZE
154   -#define CONFIG_SYS_MONITOR_BASE \
155   - (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \
156   - - CONFIG_SYS_MONITOR_LEN - GENERATED_BD_INFO_SIZE)
157   -#define CONFIG_SYS_MONITOR_END \
158   - (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
159   -#define CONFIG_SYS_MALLOC_LEN (SIZE * 3)
160   -#define CONFIG_SYS_MALLOC_BASE \
161   - (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
162   -
163   -/* stack */
164   -#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_MALLOC_BASE
  117 +/* Stack location before relocation */
  118 +#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_TEXT_BASE
165 119  
166 120 /*
167 121 * CFI flash memory layout - Example