kk_omnisys

sscanf bug

Recommended Posts

Hello All

 

I'm developing some code for the Papilio Pro using ZAP but I've run into some trouble when I try to use the C-function 'sscanf'.

 

Here's my code:

int serialPoll(SerialMessage* msg){	static byte ethByteCntr = 0;	static char ethBuffer[256];		int client = Serial.available();	if (client == true){		char newEthByte = Serial.read();		if(newEthByte == '\n'){			ethBuffer[ethByteCntr] = '\0';			ethByteCntr = 0;			parseCmd(ethBuffer);			return 1;		}		else			ethBuffer[ethByteCntr++] = newEthByte;	}	return 0;}void parseCmd(char buffer[]){	char cmd[256];	char arg1[256];	long value;	//sscanf(buffer, "%s", cmd);	sscanf(buffer, "%ld", &value);	}

And the ZAP GUI gives me the following output:

C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.write+0x2c): In function `isatty':../../../../../gcc/libgloss/zpu/syscalls.c:243: undefined reference to `outbyte'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.write+0x43):../../../../../gcc/libgloss/zpu/syscalls.c:182: undefined reference to `outbyte'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.write+0x51): In function `stat':../../../../../gcc/libgloss/zpu/syscalls.c:42: undefined reference to `outbyte'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.write+0x69):../../../../../gcc/libgloss/zpu/syscalls.c:135: undefined reference to `_syscall'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.read+0x17): In function `isatty':../../../../../gcc/libgloss/zpu/syscalls.c:116: undefined reference to `inbyte'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.read+0x42):../../../../../gcc/libgloss/zpu/syscalls.c:177: undefined reference to `outbyte'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.read+0x66): In function `stat':../../../../../gcc/libgloss/zpu/syscalls.c:158: undefined reference to `_syscall'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.read+0x88): In function `convert':../../../../../gcc/libgloss/zpu/syscalls.c:332: undefined reference to `outbyte'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.read+0x90):../../../../../gcc/libgloss/zpu/syscalls.c:78: undefined reference to `outbyte'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.close+0x1d): In function `isatty':../../../../../gcc/libgloss/zpu/syscalls.c:40: undefined reference to `_syscall'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.lseek+0x18):../../../../../gcc/libgloss/zpu/syscalls.c:116: undefined reference to `_syscall'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.fstat+0x2e):../../../../../gcc/libgloss/zpu/syscalls.c:243: undefined reference to `_syscall'C:/zap-2.0.5/hardware/tools/zpu/bin/../lib/gcc/zpu-elf/3.4.2/../../../../zpu-elf/lib/fast\libbcc.a(syscalls.o)(.text.isatty+0x1c):../../../../../gcc/libgloss/zpu/syscalls.c:344: undefined reference to `_syscall'collect2: ld returned 1 exit status

Anyone got any ideas?

 

Regards

Kalle

Share this post


Link to post
Share on other sites

sorry, on cellphone so short answers

i would check the syscalls.c file and make sure inbyte and outbyte are defined.

i havent used that lib so not sure.

also, instead of

int client = ......

if (client.... )

you can probably do

if (Serial.available())

{

// code-fu

}

or (i probably would try)

if (!(Serial.available()))

{

return 0;

} else {

// code-fu

}

Share this post


Link to post
Share on other sites

"sscanf" is not supported, because the implementation (gcc) relies on a operating system to be present (hence the syscalls you are seeing). None of those calls is implemented (and its not simple to do it).

 

Let me see if I can get you an alternative.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now