[En-Nut-Discussion] GCC 4.8, -Og and -g3

bon at elektron.ikp.physik.tu-darmstadt.de bon at elektron.ikp.physik.tu-darmstadt.de
Fri Jan 17 15:06:52 CET 2014


Hello,

why do we use -gdwarf-2 in Makedefs.xxxdbg? With -g3 instead of dwarf, gdb
knows about all defined structures an so even in main "p *USART1" prints the
content of the defined USART1 registers. With -gdwarf-2 or even -gdwarf-4,
these definitions are not known to gdb and I had to look up the address of
USART1 in the manual and use "p *(USART_TypeDef*)<address>.

Otherwise gcc-4.8 knows about a -Og option. To quote:
-Og
    Optimize debugging experience. -Og enables optimizations that do 
    not interfere with debugging. It should be the optimization level
    of choice for the standard edit-compile-debug cycle, offering a
    reasonable level of optimization while maintaining fast compilation
    and a good debugging experience.

So I think it is the optimize level of choice for debugging. However gcc
before gcc-4.8 chokes on that option. On Linux I can define a GCC_VERSION
variable with a shell call like
arm-none-eabi-gcc -dumpversion | cut -b 1,3,5
and use -O0 if GCC_VERSION < 480 or -Og else. But I doubt this solution is
portable. Any ideas for a portable solution.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list