AnsweredAssumed Answered

String manipulation problems

Question asked by Marco Fratini on Oct 17, 2010
Latest reply on Jan 17, 2011 by David E Seymour

Hi everyone. I'm working on M52259demokit, CW 7.2.1 and MQX 3.6.1.

 

I have to manipulate some strings: I have a main string, called "buffer", which contains several numbers (double and integers) separated by "S". I need to split the above string into these numbers and save them to variables.

 

First trial was:

 

 

result = sscanf (buffer, "%fS%fS%fS%fS%dS%dS%dS%dS%dS%dS%dSC%d", &LONG, &LAT, &AZ_b, &H_b, &dd, &mm, &yy, &hr, &min, &sec, &TZ, &chksum);

 

 

where I tried all the format for double, %.10f, %lf etc.. this sscanf returns always 0. I'm also using the directive

 

 

#define MQX_INCLUDE_FLOATING_POINT_IO  1

 in user_config.h. Are there any limitation in sscanf? Maybe too many arguments?

 

The second trial was:

 

 

strcpy (LONG_string, strtok (buffer, "SC"));

 

 

that should be repeated for every substring I want to save. But I get the following link errors:

 

Link Error   : Illegal 16-bit small data area relative reference to symbol '_@LOCAL@strtok__FPcPCc@strtok_n'            
from address 0x00036B40 in section '.text' of file 'libc.a string.o       '.         
This type of reference has a range from 4294934528 to 32767 bytes.
Project: MQX_ARCH.mcp, Target: Int Flash Debug

Link Error   : Illegal 16-bit small data area relative reference to symbol '_@LOCAL@strtok__FPcPCc@strtok_n'            
from address 0x00036B2E in section '.text' of file 'libc.a string.o       '.         
This type of reference has a range from 4294934528 to 32767 bytes.
Project: MQX_ARCH.mcp, Target: Int Flash Debug

Link Error   : Illegal 16-bit small data area relative reference to symbol '_@LOCAL@strtok__FPcPCc@strtok_s@0'            
from address 0x00036B42 in section '.text' of file 'libc.a string.o       '.         
This type of reference has a range from 4294934528 to 32767 bytes.
Project: MQX_ARCH.mcp, Target: Int Flash Debug

Link Error   : Illegal 16-bit small data area relative reference to symbol '_@LOCAL@strtok__FPcPCc@strtok_s@0'            
from address 0x00036B36 in section '.text' of file 'libc.a string.o       '.         
This type of reference has a range from 4294934528 to 32767 bytes.
Project: MQX_ARCH.mcp, Target: Int Flash Debug

Link Error   : Illegal 16-bit small data area relative reference to symbol '_@LOCAL@strtok__FPcPCc@strtok_s@0'            
from address 0x00036B30 in section '.text' of file 'libc.a string.o       '.         
This type of reference has a range from 4294934528 to 32767 bytes.
Project: MQX_ARCH.mcp, Target: Int Flash Debug

Link Error   : Illegal 16-bit small data area relative reference to symbol '_@LOCAL@strtok__FPcPCc@strtok_s@0'            
from address 0x00036AC8 in section '.text' of file 'libc.a string.o       '.         
This type of reference has a range from 4294934528 to 32767 bytes.
Project: MQX_ARCH.mcp, Target: Int Flash Debug

Link Error   : Illegal 16-bit small data area relative reference to symbol '_@LOCAL@strtok__FPcPCc@strtok_s@0'            
from address 0x00036A9E in section '.text' of file 'libc.a string.o       '.         
This type of reference has a range from 4294934528 to 32767 bytes.
Project: MQX_ARCH.mcp, Target: Int Flash Debug

Link failed.

 

 

Any suggestions?

 

Thank you,
Marco

 

 

Outcomes