This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

memcpy_ff() and memcpy()

Other Parts Discussed in Thread: TMS320F28335, CCSTUDIO

Hi,

I am using ccstudio, TMS320F28335 DSP microcontroller and to explore I generated new library with memcpy_ff.c file and string.h file. I did not include memcpy.c file as part of my library. But I am using memcpy() in my code.

I have few quereis.

1.  I did not include sting.h in .c file. But i am using memcpy() in my code. Compiler did not give implicit function usage warning or error saying no memcpy() function.

2. If i debug controll is going to memcpy_ff(). How come if i call memcpy() control is going to memcpy_ff() function. Even there is not prototype of memcpy() in string.h. only prototype of memcpy_ff() is present in string.h

3. Which prototype should i follow. far void* or just void*. Below are the examples i tried.

// memcpy_ff example (No error and calls memcpy_ff() function
 {
  far void *destination_string  = "Vishnu";
  const far void *source_string = "Vardhan";
  far void *return_string;
  unsigned int no_of_char = 5;

  return_string = far_memcpy(destination_string, source_string,  no_of_char);

  if(destination_string == return_string)
  {
   testArray[3] = TEST_PASS;
  }
  else
  {
   testArray[3] = TEST_FAIL;
   }
 }
 
 // memcpy_ff prototype with memcpy function example (ERROR saying "main.c", line 105: error #169: argument of type "void far *" is incompatible with parameter of type "void *"
 {
  far void *destination_string  = "Vishnu";
  const far void *source_string = "Vardhan";
  far void *return_string;
  unsigned int no_of_char = 5;

  return_string = memcpy(destination_string, source_string,  no_of_char);

  if(destination_string == return_string)
  {
   testArray[3] = TEST_PASS;
  }
  else
  {
   testArray[3] = TEST_FAIL;
   asm(" ESTOP0");
  }
 }

 // memcpy prototype with memcpy_ff function example (No error, calls memcpy_ff() function but not memcpy().
 {
  int buff1[10];
  int buff2[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  int* retVal;

  retVal = (int*) far_memcpy(buff1, buff2,  sizeof(buff1));
 }

 // memcpy example (No error but CALLS memcpy_ff() function
 {
  int buff1[10];
  int buff2[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

  memcpy(buff1, buff2,  sizeof(buff1));
 }

Thanks & Regards

Vishnu