[U-Boot-Users] [patch] add gd initialization

Yasushi SHOJI yashi at atmark-techno.com
Mon Jun 28 19:51:29 CEST 2004


Hi,

this is a patch to initialize global data pointer/register to kill
MAKEALL warnings.

regards,
--
             yashi

* Patch by Yasushi SHOJI, 29 Jun 2004:
  - add gd initialization


Index: u-boot/lib_microblaze/board.c
===================================================================
--- u-boot.orig/lib_microblaze/board.c
+++ u-boot/lib_microblaze/board.c
@@ -72,8 +72,21 @@ init_fnc_t *init_sequence[] = {
 
 void board_init(void)
 {
+        DECLARE_GLOBAL_DATA_PTR;
+
+        bd_t *bd;
 	init_fnc_t **init_fnc_ptr;
 
+        /* Pointer is writable since we allocated a register for it. */
+        gd = (gd_t *)CFG_GBL_DATA_OFFSET;
+        memset((void *)gd, 0, CFG_GBL_DATA_SIZE);
+
+        gd->bd = (bd_t *)(gd+1);	/* At end of global data */
+        gd->baudrate = CONFIG_BAUDRATE;
+
+        bd = gd->bd;
+        bd->bi_baudrate = CONFIG_BAUDRATE;
+
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 		WATCHDOG_RESET ();
 		if ((*init_fnc_ptr) () != 0) {
Index: u-boot/include/configs/suzaku.h
===================================================================
--- u-boot.orig/include/configs/suzaku.h
+++ u-boot/include/configs/suzaku.h
@@ -87,4 +87,14 @@
 #define	CFG_ENV_SIZE		0x10000	/* Total Size of Environment Sector	*/
 #define CFG_ENV_SECT_SIZE	0x10000	/* see README - env sector total size	*/
 
+/*-----------------------------------------------------------------------
+ * Definitions for initial stack pointer and data area (in DPRAM)
+ */
+
+#define CFG_INIT_RAM_ADDR	0x80000000	/* inside of SDRAM */
+#define CFG_INIT_RAM_END	0x2000		/* End of used area in RAM */
+#define CFG_GBL_DATA_SIZE	128		/* size in bytes reserved for initial data */
+#define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_INIT_SP_OFFSET	CFG_GBL_DATA_OFFSET
+
 #endif	/* __CONFIG_H */
Index: u-boot/microblaze_config.mk
===================================================================
--- u-boot.orig/microblaze_config.mk
+++ u-boot/microblaze_config.mk
@@ -22,6 +22,8 @@
 # MA 02111-1307 USA
 #
 
+PLATFORM_CPPFLAGS += -ffixed-r31
+
 ifdef CONFIG_MICROBLAZE_HARD_MULT
 PLATFORM_CPPFLAGS += -mno-xl-soft-mul
 endif




More information about the U-Boot mailing list