[U-Boot] u-boot compiler optimization barrier, board_init_f

Suresh Bhaskaran Suresh.Bhaskaran at magnumsemi.com
Tue Jan 20 05:01:06 CET 2009


Does anyone know what I have to do "differently" for the "compiler
optimization barrier" for GCC >= 3.4 in board_init_f?

 

I am suspecting some difference here in why my compilation with
ELDK4.1.1 of uboot v 1.3.4 is failing.

 

I have it working with ELDK 3.1, but it is failing ELDK 4.1.1.

 

It works a little better if I turn compiler optimization flags off. (but
still fails)

 

Thanks in advance.

 

The relevant code snippet follows:

 

Suresh Bhaskaran

 

 

void board_init_f(ulong bootflag)

{

            DECLARE_GLOBAL_DATA_PTR;

            int count =0;

            gd_t gd_data, *id;

            bd_t *bd;

            init_fnc_t **init_fnc_ptr;

            ulong addr, addr_sp, len = (ulong)&uboot_end -
CFG_MONITOR_BASE;

 

            /* Pointer is writable since we allocated a register for it.

             */

            gd = &gd_data;

            /* compiler optimization barrier needed for GCC >= 3.4 */

            __asm__ __volatile__("": : :"memory");

 

            memset ((void *)gd, 0, sizeof (gd_t));

 

            for (init_fnc_ptr = init_sequence; *init_fnc_ptr;
++init_fnc_ptr) {

                        if ((*init_fnc_ptr)() != 0) {

                        puts(" error at ");            putc(count+'0');
printf("fnc at %p\n", *init_fnc_ptr);

                        hang ();

                        }

            count++;

            }

 

 



More information about the U-Boot mailing list