[U-Boot] DEBUG macro granularity

Simon Glass sjg at chromium.org
Fri Jan 28 02:16:23 CET 2011


Hi,

There is a great big DEBUG define which determines whether debug() is a
printf() or a nop. This is used by various modules to make them more verbose
which is helpful sometimes.

Some modules have their own finer control over this, for example USB_DEBUG
in common/usb.c. Also:

$ grep -rsl _PRINTF\( .
./board/mpl/pati/pati.c
./board/mpl/common/usb_uhci.c
./board/esd/common/xilinx_jtag/micro.c
./common/usb_kbd.c
./common/usb_ether.c
./common/usb_storage.c
./common/usb.c
./arch/sparc/cpu/leon3/usb_uhci.c
./issue5563011_1.diff
./drivers/bios_emulator/x86emu/decode.c
./drivers/bios_emulator/x86emu/ops.c
./drivers/bios_emulator/x86emu/ops2.c
./drivers/bios_emulator/include/x86emu/debug.h

Recently I enabled DEBUG and got rather a lot of output, enough that it took
hours to boot a kernel (every MMC block printed a nice message from the GPIO
driver). I understand that creating these local DEBUG macros is frowned
upon, but without this it tends to make the U-Boot-wide DEBUG setting so
verbose as to be useless. It also means that every potentially verbose
module needs an '#undef DEBUG' at the top, which means the global flag is
overridden.

Can I suggest perhaps a way of allowing some sort of granularity in the
design, rather than just relying on hacking in DEBUG in each file? What is
the recommended approach, please?

Regards,
Simon


More information about the U-Boot mailing list