[U-Boot] Function prototype conflicts with standalone apps
Chris Packham
judge.packham at gmail.com
Wed Jan 16 05:23:58 CET 2013
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
More information about the U-Boot
mailing list