Hi. Got a curly one … for @zachary, perhaps?
I have a project with a separate .cpp file (added in src/build.mk) which has a function that makes a call to Serial.read(), simply …
#include "application.h" ... char c = Serial.read();
This is causing a linker failure …
.../sparkcore/gcc-arm-none-eabi-4_8-2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-readr.o): In function `_read_r': readr.c:(.text._read_r+0x10): undefined reference to `_read'
… along with similar errors for _write, _lseek, etc, being typical of trying to use printf/scanf etc in an embedded environment, where the low level functions
_read etc have not been defined. These are in fact defined in
Serial.read() should not be going anywhere near those in the first place.
Serial.read() works fine if I have it in
Having spent over an hour trying to track this oddball down, I am finally stumped.
NOTE: I just wrote a bare bones test project, to try and reduce this fault in its most basic, repeatable form. But it works under those circumstances. So there must be something else in my rather large project that is somehow causing the problem.
Thanks for any help.
RESOLVED: Would you believe, there was a call to
fflush(stdout). Good grief. (Yes, I’m porting someone else’s code.) Amazing how one so often finds a solution, moments after posting on a forum for help!