contiki-os / contiki

The official git repository for Contiki, the open source OS for the Internet of Things
http://www.contiki-os.org/
Other
3.71k stars 2.58k forks source link

"too many parameters" on certain functions when compiling with cc2530 #829

Closed xcompass closed 9 years ago

xcompass commented 9 years ago

When I try to compile certain examples, I got the following message(e.g. examples/wget):

wget.c:167: warning 112: function 'fputs' implicit declaration
wget.c:174: warning 112: function 'fputs' implicit declaration
wget.c:167: error 101: too many parameters
wget.c:174: error 101: too many parameters

I also get the similar message on example/example-shell.

./../apps/shell/shell-power.c:149: warning 112: function 'snprintf' implicit declaration
../../apps/shell/shell-power.c:149: error 101: too many parameters

The command I used was

make TARGET=cc2530dk

Any advise?

cmorty commented 9 years ago

I'd say you're missing some header file. Please provide more info - see also http://www.catb.org/esr/faqs/smart-questions.html

xcompass commented 9 years ago

Thanks @cmorty. I just downloaded the instant-contiki 2.7 and span it up. Compile the example/wget with command above. Also tried the latest master branch. No luck. Any other information you need?

xcompass commented 9 years ago

Also found similar error from here: http://stackoverflow.com/a/23989956/805131. Is it true that cc2530 doesn't support scanf or snprintf?

cmorty commented 9 years ago

It's a library functions that should come with your compiler. If not, you can "steal" from some other library, eg. https://sourceware.org/newlib/

xcompass commented 9 years ago

I'm using sdcc. Do they come with those libraries? How do it check it?

Sorry for the newbie question. I'm pretty new to this.

cmorty commented 9 years ago

Find the header files that come with sdcc and check whether any of them reference snprintf. Also the regression test seem to work. Looking at the build log might help you finding a working version - e.g. see https://travis-ci.org/contiki-os/contiki/jobs/38790115#L188

cmorty commented 9 years ago

...also a bit of searching brought me here https://github.com/contiki-os/contiki/wiki/8051-Requirements -> It's all there!

cmorty commented 9 years ago

Ps.: I that fixes you problem it might be a good idea to add some kind of check and give a good warning.

xcompass commented 9 years ago

It seems the regression tests for 8051 (https://travis-ci.org/contiki-os/contiki/jobs/38790126) only build the examples in examples/cc2530dk directory. I have no problem to build/run them. However, I got that error with the examples in examples/ directory. They are not tested under BUILD_ARCH=8051.

As for the 8051 requirement doc, I assume you are referring to the "Build your toolchain" section. I'm using homebrew on mac. The formula to build sdcc already includes the patch for adding huge to the build. (https://github.com/Homebrew/homebrew/blob/master/Library/Formula/sdcc.rb). So I assume my sdcc is build correctly.