public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Function prototype conflicts with standalone apps
@ 2013-01-16  4:23 Chris Packham
  2013-01-16  4:41 ` Chris Packham
  2013-01-16  7:25 ` Albert ARIBAUD
  0 siblings, 2 replies; 7+ messages in thread
From: Chris Packham @ 2013-01-16  4:23 UTC (permalink / raw)
  To: u-boot

Hi,

I've just run into something porting an existing out of tree board to
u-boot 2012.10 but I think it points to a generic issue for standalone
applications.

Consider the following change

diff --git a/examples/standalone/hello_world.c
b/examples/standalone/hello_world.c
index 067c390..d2e6a77 100644
--- a/examples/standalone/hello_world.c
+++ b/examples/standalone/hello_world.c
@@ -24,7 +24,7 @@
 #include <common.h>
 #include <exports.h>

-int hello_world (int argc, char * const argv[])
+int net_init (int argc, char * const argv[])
 {
        int i;

Because I'm not linking with the u-boot object file, I should be able to
use any function name I like in my application as long as it isn't one of
the functions in exports.h (at least in theory). Unfortunately I end up
with the following compiler error

  hello_world.c:27: error: conflicting types for ?net_init?
  uboot/include/net.h:489: error: previous declaration of ?net_init? was
here
  make[1]: *** [hello_world.o] Error 1

If I replace #include <common.h> in my app with the first hunk of includes
from the top of common.h  then I can compile just fine.

I was wondering if it made sense to people to have standalone applications
define something like __STANDALONE__ either via CPPFLAGS or in the source
itself and use the presence of that to exclude the majority of common.h
when used in standalone applications. Or alternatively move the required
bits to exports.h.

Thanks,
Chris

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-16 20:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16  4:23 [U-Boot] Function prototype conflicts with standalone apps Chris Packham
2013-01-16  4:41 ` Chris Packham
2013-01-16  7:25 ` Albert ARIBAUD
2013-01-16  7:28   ` Albert ARIBAUD
2013-01-16 10:16   ` Chris Packham
2013-01-16 12:57     ` Albert ARIBAUD
2013-01-16 20:01       ` Chris Packham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox