FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [July 2016 Threads] strlenPosted by jordiblasi on July 28, 2016 I am using Freertos on a Intel Galileo Gen 2 board and I am trying to copy and compare some strings but i am having some trouble. As I see I have available on the libraries distribbuted the strlen, strcpy, memcpy and memcmp. What I am seeing is that both strlen and strcpy don't work. They are even commented as "Extremely crude implementations" in the code. In fact, strlen seems not be be even implemented. memcpy and memcmp seem to do the job, but they ask for the memory string size to work with. As I am not able to use strlen, I have been defining a maximun string size to perform this operations. I understand that this is not optimal, but at least it works for copying. My problem is that if I compare two strings, one static value and the other as an entry to a function I get values that don't fit what I was expecting.
~~~
define VARSIZE 50
static char reference[VARSIZE];
int locate(char id[] )
{
...
r = memcmp(conTab[a].reference,id,VARSIZE);
...
}
~~~
When I set both values to "refe03" (so comparison result should be 0) I get as a result value 43. If I set other values (f.e. "refe04" for id) I get 45 as a result. Am I doing something wrong? How can I solve this?
Thanks,
strlenPosted by rtel on July 28, 2016 It might be that GCC is using a builtin version of the function. Try
adding -fno-builtin-strlen to the command line to see if that fixes the
strlen() problem. Also, the source code for the function is there and
is very short, so you can step through it easily enough to see what it
is doing to check it is correct.
The crude implementations of the functions are only provided because the
demo as downloaded makes no assumptions as to the C libraries that are
available with the compiler. Ideally link to a suitable GCC unhosted C
library, then use the functions provided by the C library.
strlenPosted by jordiblasi on July 28, 2016 Running the gcc command with -fno-builtin-strlen changes nothing in the response. I get this error:
undefined reference to 'strlen'
I have tried to remove the string.h and freestanding_functions.c files to force it to use the standard libraries but it looks like it is not able to find them. I have included the cygwin libraries I have in my computer (by adding C:cygwin64usrinclude to the eclipse include folders) but it does not use them.
Where can I get a valid library set to use?
Thanks,
Jordi
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|