[U-Boot] Turning optimizations off

Jerry Van Baren gerald.vanbaren at ge.com
Fri May 29 17:12:48 CEST 2009


Fahd Abidi wrote:
> Hello,
>  
> I am debugging u-boot with a BDI and am running into a case where a
> variable gets optimized out. For the sake of debugging I am trying to
> turn off optimizations.
> I have the following in u-boot-2009.01/config.mk, but GDB still reports
> optimizations:
> 
> OPTFLAGS= -Os -fno-schedule-insns -fno-schedule-insns2
> #-fomit-frame-pointer
> 
> (gdb) stepi
> 
> 0x0ff78750 in get_table_entry_name (table=<value optimized out>,

If you (temporarily) put "volatile" on the variable, the compiler should 
not optimize it out.  Obviously, this is a limited solution, but may get 
your past your problem.

[snip]

> Does anyone know how to completely turn optimization off? Using no -O
> flag results in u-boot not compiling.

Theoretically, you could compile individual files w/o optimization (e.g. 
if you compile it by hand, make shouldn't re-compile it).  I doubt that 
you want to go there, though...

> Fahd Abidi

Good luck,
gvb


More information about the U-Boot mailing list