Wednesday, April 25th 2018, 12:36am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.



Date of registration: Dec 19th 2007

Posts: 4


Wednesday, December 19th 2007, 11:12am

OS_memset and OS_memcpy

functions I am using embos "evaluation version" (near memory model) for
M32C and IAR compiler. I have implemented a TCP-IP stack to run an SNMP
application. I am able to get almost any MIB with no problem. The
trouble I see is that the OS hangs on an apparently normal get
involving a pointer. I am already using the thread-safe versions of the
malloc() and free(). Now I discovered that there are thread-safe versions of memset() and memcpy() functions, too.

I hope using those I'll solve my problems, but I am not able to do
that, cause there is no prototype declared, and I was not able to
create a prototype fitting the real one.
I RTOS.H I see:

/* memset and
memcpy need to be replaced for near memory
model */

/* this is
done in

#define OS_MEMSET(Adr, Value,
Size) OS_memset(Adr, Value, Size)

#define OS_MEMCPY(Dest, Src, Size)
OS_memcpy(Dest, Src, Size)

As you can see there is only a macro. redirecting OS_MEMSET to the thread safe version.

Someone can help me ?

Remember we are going to Christmas day.... ;)

Thanks in advance


Date of registration: Dec 20th 2007

Posts: 26


Thursday, December 20th 2007, 12:12pm


The embOS internal OS_memcpy() and OS_memset() functions are private and can not be called.
embOS uses these functions to initialize internal data structures.
As we found out, that some compilers do not deliver these functions for all memory models, we added our own functions.
This was the only reason to implement the internal function OS_memset() and OS_memcpy().
They are NOT thread-safe, because there is nor reason for having thread-safe functions for that purpose.

If you have problems with the memset() and memcpy() functions from your system library,
you have to write your own functions.