Jump to content


undefined reference to `alloc_shared'


  • You cannot reply to this topic
2 replies to this topic

#1 haghdoost

    Member

  • Members
  • PipPip
  • 3 posts

Posted 05 March 2010 - 09:33 AM

Hello

I am going to implement ImageFilterDMA tutorial on Xilinx ML403 board (Virtex 4 FPGA) using Xilinx ISE 10.1. In the co_init.c line 56 and 57 there are these function calls :

CODE
  image=co_memory_create("image","plbmem",524288,alloc_shared);
  image2=co_memory_create("image2","plbmem",524288,alloc_shared);


when I try to build software for PowerPC in Xilinx XPS, it report undefined reference to `alloc_shared' error because void * alloc_shared() function does not implement any where. its definition only come on the line 27 of co_init.c file like this:

CODE
extern void *alloc_shared(size_t);


but I can't find it's implementation any where in Impulse or Xilinx libraries. I will appreciate if any one help me to run Tutorial.

Note that in img_sw.c there are similar implementation for void * ext0_alloc() but I don't think it would be useful:

CODE
#ifdef __PPC__
void *ext0_alloc(size_t size)
{
    static unsigned int address=XPAR_SDRAM_8MX32_BASEADDR;
    void *ret;

    if ((address+size) > XPAR_SDRAM_8MX32_HIGHADDR)
        return(NULL);
    ret=(void *) address;
    address+=size;
    return(ret);
}  
#endif



#2 haghdoost

    Member

  • Members
  • PipPip
  • 3 posts

Posted 05 March 2010 - 10:45 AM

Note if I use void * ext0_alloc() intead of void *alloc_shared() function , the ImageFilterDMA application will build successfully but running executable.elf on PPC result the following error in RS_232 terminal output :

co_memory alloc failed!

this error raise from co_memory_cread() function in co_memory.c file :

CODE
co_memory co_memory_create(char *name, char *loc, unsigned int size, void *(*alloc)(size_t))
{
  co_memory m;

    m = (co_memory) malloc(sizeof(co_memory_t));
    if (m != NULL) {
      m->name = (name != NULL) ? strdup(name) : NULL;
      m->data = (*alloc)(size);
      if (m->data == NULL)
        print("co_memory alloc failed!");
      m->size = size;
    } else print("malloc failed!");
    return(m);
}


I will appreciate if any one can help me to find correct implementation of void* alloc_shared() function ?



#3 haghdoost

    Member

  • Members
  • PipPip
  • 3 posts

Posted 07 March 2010 - 10:40 AM

Thanks for Good support smile.gif I managed the problem by replacing shared_alloc with malloc, ImageFilterDMA tutorial has many bug and I think it would not very good for Impulse to share official toturials that will not work in a read design.
I appreciate Impulse for their product and well documentations, In this special topic, I can handle to correct all issues in the ImageFilterDMA tutorial.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users