nios2: move gd and bd into BSS
As suggested by Graeme Russ, move gd and bd data structrures to BSS instead of calculating the locations around the stack and heap. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
0b15d51ed0
commit
7dfb060291
@ -87,17 +87,15 @@ void board_init (void)
|
|||||||
{
|
{
|
||||||
bd_t *bd;
|
bd_t *bd;
|
||||||
init_fnc_t **init_fnc_ptr;
|
init_fnc_t **init_fnc_ptr;
|
||||||
|
static gd_t gd_data;
|
||||||
|
static bd_t bd_data;
|
||||||
|
|
||||||
/* Pointer is writable since we allocated a register for it.
|
/* Pointer is writable since we allocated a register for it. */
|
||||||
* Nios treats CONFIG_SYS_GBL_DATA_OFFSET as an address.
|
gd = &gd_data;
|
||||||
*/
|
|
||||||
gd = (gd_t *)CONFIG_SYS_GBL_DATA_OFFSET;
|
|
||||||
/* compiler optimization barrier needed for GCC >= 3.4 */
|
/* compiler optimization barrier needed for GCC >= 3.4 */
|
||||||
__asm__ __volatile__("": : :"memory");
|
__asm__ __volatile__("": : :"memory");
|
||||||
|
|
||||||
memset( gd, 0, GENERATED_GBL_DATA_SIZE );
|
gd->bd = &bd_data;
|
||||||
|
|
||||||
gd->bd = (bd_t *)(gd+1); /* At end of global data */
|
|
||||||
gd->baudrate = CONFIG_BAUDRATE;
|
gd->baudrate = CONFIG_BAUDRATE;
|
||||||
gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
|
gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
|
||||||
|
|
||||||
|
@ -117,10 +117,9 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* MEMORY ORGANIZATION
|
* MEMORY ORGANIZATION
|
||||||
* -Monitor at top of sdram.
|
* -Monitor at top of sdram.
|
||||||
* -The heap is placed below the monitor
|
* -The heap is placed below the monitor
|
||||||
* -Global data is placed below the heap.
|
* -The stack is placed below the heap (&grows down).
|
||||||
* -The stack is placed below global data (&grows down).
|
|
||||||
*/
|
*/
|
||||||
#define CONFIG_MONITOR_IS_IN_RAM
|
#define CONFIG_MONITOR_IS_IN_RAM
|
||||||
#define CONFIG_SYS_MONITOR_LEN 0x40000 /* Reserve 256k */
|
#define CONFIG_SYS_MONITOR_LEN 0x40000 /* Reserve 256k */
|
||||||
@ -130,10 +129,7 @@
|
|||||||
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x20000)
|
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x20000)
|
||||||
#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - \
|
#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - \
|
||||||
CONFIG_SYS_MALLOC_LEN)
|
CONFIG_SYS_MALLOC_LEN)
|
||||||
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_MALLOC_BASE - \
|
#define CONFIG_SYS_INIT_SP CONFIG_SYS_MALLOC_BASE
|
||||||
GENERATED_GBL_DATA_SIZE - \
|
|
||||||
GENERATED_BD_INFO_SIZE)
|
|
||||||
#define CONFIG_SYS_INIT_SP CONFIG_SYS_GBL_DATA_OFFSET
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MISC
|
* MISC
|
||||||
|
Loading…
Reference in New Issue
Block a user