Friday, April 20th 2018, 5:06am UTC+2

You are not logged in.

  • Login
  • Register

fffromeo

Beginner

Date of registration: Dec 19th 2007

Posts: 4

1

Wednesday, December 19th 2007, 11:12am

OS_memset and OS_memcpy

Hallo
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
OS_Priv
*/



#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

fffromeo

Date of registration: Dec 20th 2007

Posts: 26

2

Thursday, December 20th 2007, 12:12pm

Hello,

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.