X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib_nios2%2Fboard.c;h=c6b36f4a2ef1e35903c535abfab261d743627d1c;hb=67c3d9fb36bd0e66bd5cbf2719564e01f6459433;hp=d759f0fd8042362dc43117ee2e00aa9f0750397d;hpb=156feb90d200f186cdfd856d7f6f1878bb1bec1e;p=u-boot diff --git a/lib_nios2/board.c b/lib_nios2/board.c index d759f0fd80..c6b36f4a2e 100644 --- a/lib_nios2/board.c +++ b/lib_nios2/board.c @@ -25,8 +25,9 @@ */ #include -#include +#include #include +#include #include #ifdef CONFIG_STATUS_LED #include @@ -54,38 +55,6 @@ DECLARE_GLOBAL_DATA_PTR; extern void malloc_bin_reloc (void); typedef int (init_fnc_t) (void); -/* - * Begin and End of memory area for malloc(), and current "brk" - */ -static ulong mem_malloc_start = 0; -static ulong mem_malloc_end = 0; -static ulong mem_malloc_brk = 0; - -/* - * The Malloc area is immediately below the monitor copy in RAM - */ -static void mem_malloc_init (void) -{ - mem_malloc_start = CONFIG_SYS_MALLOC_BASE; - mem_malloc_end = mem_malloc_start + CONFIG_SYS_MALLOC_LEN; - mem_malloc_brk = mem_malloc_start; - memset ((void *) mem_malloc_start, - 0, - mem_malloc_end - mem_malloc_start); -} - -void *sbrk (ptrdiff_t increment) -{ - ulong old = mem_malloc_brk; - ulong new = old + increment; - - if ((new < mem_malloc_start) || (new > mem_malloc_end)) { - return (NULL); - } - mem_malloc_brk = new; - return ((void *) old); -} - /************************************************************************ * Initialization sequence * @@ -148,23 +117,22 @@ void board_init (void) } } + WATCHDOG_RESET (); + + /* The Malloc area is immediately below the monitor copy in RAM */ + mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN); + malloc_bin_reloc(); + WATCHDOG_RESET (); bd->bi_flashsize = flash_init(); WATCHDOG_RESET (); - mem_malloc_init(); - malloc_bin_reloc(); env_relocate(); bd->bi_ip_addr = getenv_IPaddr ("ipaddr"); - s = getenv ("ethaddr"); - for (i = 0; i < 6; ++i) { - bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0; - if (s) s = (*e) ? e + 1 : e; - } WATCHDOG_RESET (); - devices_init(); + stdio_init(); jumptable_init(); console_init_r();