[U-Boot-Users] simple_strtoul overwrites bd_info field

llandre r&d2 at dave-tech.it
Tue Aug 29 17:44:45 CEST 2006


I'm experiencing the following problem when building U-Boot with GCC 
4.0.0 provided by ELDK 4.0 ARM.
My struct bd_info looks like this:

typedef struct bd_info {
     int			bi_baudrate;	/* serial console baudrate */
     unsigned long	bi_ip_addr;	/* IP Address */
     unsigned char	bi_enetaddr[6]; /* Ethernet adress */
     struct environment_s	       *bi_env;
     ulong	        bi_arch_number;	/* unique id for this board */
     ulong	        bi_boot_params;	/* where this board expects params */
#if defined(CONFIG_ZEFEER_DZA) || defined(CONFIG_ZEFEER_DZB) || \
	defined(CONFIG_ZEFEER_DZG) || defined(CONFIG_ZEFEER_DZN) || 
defined(CONFIG_ZEFEER_DZQ)
     struct				/* RAM configuration */
     {
	ulong start;
	ulong size;
     } 			bi_dram[CONFIG_MAX_NR_DRAM_BANKS];
     unsigned char nr_dram_bank;
#else
     struct				/* RAM configuration */
     {
	ulong start;
	ulong size;
     } 			bi_dram[CONFIG_NR_DRAM_BANKS];
#endif
#ifdef CONFIG_HAS_ETH1
     /* second onboard ethernet port */
     unsigned char   bi_enet1addr[6];
#endif
} bd_t;


The SDRAM detection algorithm finds how many SDRAM blocks are and how 
big they are. It fills the following fields accordingly.

     struct				/* RAM configuration */
     {
	ulong start;
	ulong size;
     } 			bi_dram[CONFIG_MAX_NR_DRAM_BANKS];
     unsigned char nr_dram_bank;

When start_armboot invokes simple_strtoul to fill the bi_enetaddr field, 
the bi_dram[1].start field gets overwritten with a spurious value. Is it 
actually a GCC-related problem? Any suggestions?



TIA,
llandre

DAVE Electronics System House - R&D Department
web:   http://www.dave-tech.it
email: r&d2 at dave-tech.it




More information about the U-Boot mailing list