sscanf bug


kk_omnisys

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

Link to comment
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

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.