Commit ca7d22662e1ca1b05fd4cd3d1f80efec93c499ef
1 parent
405e651d70
Exists in
v2017.01-smarct4x
and in
37 other branches
microblaze: spl: Do not call mem_malloc_init and use early alloc
This patch has some parts connected together: - Use _gd in bss section which is automatically cleared Location at SPL_MALLOC_END wasn't cleared at all - Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC (mem_malloc_init is not called at all) - Simplify malloc and stack init. At the end of SPL addr is malloc area and below is stack Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Showing 2 changed files with 16 additions and 22 deletions Side-by-side Diff
arch/microblaze/cpu/start.S
... | ... | @@ -162,7 +162,11 @@ |
162 | 162 | #endif |
163 | 163 | brai board_init_f |
164 | 164 | #else |
165 | - addi r31, r0, CONFIG_SYS_SPL_MALLOC_END | |
165 | + addi r31, r0, _gd | |
166 | +#if defined(CONFIG_SYS_MALLOC_F_LEN) | |
167 | + addi r6, r0, CONFIG_SPL_STACK_ADDR | |
168 | + swi r6, r31, GD_MALLOC_BASE | |
169 | +#endif | |
166 | 170 | brai board_init_r |
167 | 171 | #endif |
168 | 172 | 1: bri 1b |
include/configs/microblaze-generic.h
... | ... | @@ -113,7 +113,12 @@ |
113 | 113 | #endif |
114 | 114 | |
115 | 115 | #define CONFIG_SYS_MALLOC_LEN 0xC0000 |
116 | -#define CONFIG_SYS_MALLOC_F_LEN 1024 | |
116 | +#ifndef CONFIG_SPL_BUILD | |
117 | +# define CONFIG_SYS_MALLOC_F_LEN 1024 | |
118 | +#else | |
119 | +# define CONFIG_SYS_MALLOC_SIMPLE | |
120 | +# define CONFIG_SYS_MALLOC_F_LEN 0x150 | |
121 | +#endif | |
117 | 122 | |
118 | 123 | /* Stack location before relocation */ |
119 | 124 | #define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_TEXT_BASE |
120 | 125 | |
121 | 126 | |
... | ... | @@ -426,26 +431,12 @@ |
426 | 431 | /* BRAM start */ |
427 | 432 | #define CONFIG_SYS_INIT_RAM_ADDR 0x0 |
428 | 433 | /* BRAM size - will be generated */ |
429 | -#define CONFIG_SYS_INIT_RAM_SIZE 0x10000 | |
430 | -/* Stack pointer prior relocation, must situated at on-chip RAM */ | |
431 | -#define CONFIG_SYS_SPL_MALLOC_END (CONFIG_SYS_INIT_RAM_ADDR + \ | |
434 | +#define CONFIG_SYS_INIT_RAM_SIZE 0x100000 | |
435 | + | |
436 | +# define CONFIG_SPL_STACK_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ | |
432 | 437 | CONFIG_SYS_INIT_RAM_SIZE - \ |
433 | - GENERATED_GBL_DATA_SIZE) | |
438 | + CONFIG_SYS_MALLOC_F_LEN) | |
434 | 439 | |
435 | -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100 | |
436 | - | |
437 | -/* | |
438 | - * The main reason to do it in this way is that MALLOC_START | |
439 | - * can't be defined - common/spl/spl.c | |
440 | - */ | |
441 | -#if (CONFIG_SYS_SPL_MALLOC_SIZE != 0) | |
442 | -# define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_SPL_MALLOC_END - \ | |
443 | - CONFIG_SYS_SPL_MALLOC_SIZE) | |
444 | -# define CONFIG_SPL_STACK_ADDR CONFIG_SYS_SPL_MALLOC_START | |
445 | -#else | |
446 | -# define CONFIG_SPL_STACK_ADDR CONFIG_SYS_SPL_MALLOC_END | |
447 | -#endif | |
448 | - | |
449 | 440 | /* Just for sure that there is a space for stack */ |
450 | 441 | #define CONFIG_SPL_STACK_SIZE 0x100 |
451 | 442 | |
... | ... | @@ -453,8 +444,7 @@ |
453 | 444 | |
454 | 445 | #define CONFIG_SPL_MAX_FOOTPRINT (CONFIG_SYS_INIT_RAM_SIZE - \ |
455 | 446 | CONFIG_SYS_INIT_RAM_ADDR - \ |
456 | - GENERATED_GBL_DATA_SIZE - \ | |
457 | - CONFIG_SYS_SPL_MALLOC_SIZE - \ | |
447 | + CONFIG_SYS_MALLOC_F_LEN - \ | |
458 | 448 | CONFIG_SPL_STACK_SIZE) |
459 | 449 | |
460 | 450 | #endif /* __CONFIG_H */ |