[U-Boot] a couple questions about CONFIG_SYS_LONGHELP

Robert P. J. Day rpjday at crashcourse.ca
Sat Jan 26 13:11:18 CET 2013


On Sat, 26 Jan 2013, Albert ARIBAUD wrote:

> Hi Robert,
>
> On Sat, 26 Jan 2013 06:38:51 -0500 (EST), "Robert P. J. Day"
> <rpjday at crashcourse.ca> wrote:

... snip ...

> >   and second, i'm not sure how to read this out of cmd_pci.c:
> >
> > ===== start
> >
> > #ifdef CONFIG_SYS_LONGHELP
> > static char pci_help_text[] =
> >         "[bus] [long]\n"
> >         "    - short or long list of PCI devices on bus 'bus'\n"
> > #ifdef CONFIG_CMD_PCI_ENUM
> >         "pci enum\n"
> >         "    - re-enumerate PCI buses\n"
> > #endif
> >         "pci header b.d.f\n"
> >         "    - show header of PCI device 'bus.device.function'\n"
> >         "pci display[.b, .w, .l] b.d.f [address] [# of objects]\n"
> >         "    - display PCI configuration space (CFG)\n"
> >         "pci next[.b, .w, .l] b.d.f address\n"
> >         "    - modify, read and keep CFG address\n"
> >         "pci modify[.b, .w, .l] b.d.f address\n"
> >         "    -  modify, auto increment CFG address\n"
> >         "pci write[.b, .w, .l] b.d.f address value\n"
> >         "    - write to CFG address";
> > #endif
> >
> > U_BOOT_CMD(
> >         pci,    5,      1,      do_pci,
> >         "list and access PCI Configuration Space", pci_help_text
> > );
> >
> > ===== end
> >
> >   note how, if CONFIG_SYS_LONGHELP is defined, the symbol
> > "pci_help_text" is created as the text, but its *usage* just below in
> > the U_BOOT_CMD macro is *outside* of that preprocessor check.  how
> > would that work if CONFIG_SYS_LONGHELP is undefined?  not at my dev
> > host right this minute so i can't test, but it just looks ... weird.
>
> Probably would not work. Submit a fix. :)

  there appears to be a number of common/cmd_*.c files that have that
structure:

$ grep "ifdef.*CONFIG_SYS_LONGHELP" cmd*.c
cmd_bootm.c:#ifdef CONFIG_SYS_LONGHELP
cmd_bootm.c:#ifdef CONFIG_SYS_LONGHELP
cmd_fdt.c:#ifdef CONFIG_SYS_LONGHELP
cmd_help.c:#ifdef  CONFIG_SYS_LONGHELP
cmd_i2c.c:#ifdef CONFIG_SYS_LONGHELP
cmd_mp.c:#ifdef CONFIG_SYS_LONGHELP
cmd_mtdparts.c:#ifdef CONFIG_SYS_LONGHELP
cmd_nand.c:#ifdef CONFIG_SYS_LONGHELP
cmd_nvedit.c:#ifdef CONFIG_SYS_LONGHELP
cmd_pci.c:#ifdef CONFIG_SYS_LONGHELP
cmd_source.c:#ifdef CONFIG_SYS_LONGHELP
cmd_ximg.c:#ifdef CONFIG_SYS_LONGHELP
$

  so it's not just one file.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


More information about the U-Boot mailing list