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.

c6run compile issues

Other Parts Discussed in Thread: OMAP3530

I'm trying to compile some code using C6Run which is meant to run on the Beagleboard and accesses the Video DACs on board the OMAP3530 ... when I compile using:  "c6runapp-cc -O3 -o dss_testmode_dsp dss_testmode.c"  I get the following errors:

$ c6runapp-cc -O3 -o dss_testmode dss_testmode.c

 undefined first referenced
  symbol       in file    
 --------- ----------------
 _mmap     dss_testmode.o 
 _munmap   dss_testmode.o 

error: unresolved symbols remain
error: errors encountered during linking; "dss_testmode.dsp_image.out" not
   built
mv: cannot stat `dss_testmode.dsp_image.out': No such file or directory
>>   error: errors occurred while reading dss_testmode.dsp

 

the area of source code where mmap and mummap are used is here:

unsigned long ReadPhysical(unsigned long Address)
{
  int fd;
  unsigned long *map_base, *virt_addr;
  unsigned long read_result;

  if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1);
  map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, Address & ~MAP_MASK);
  if(map_base == (void *) -1);// FATAL;
  virt_addr = map_base + (Address & MAP_MASK);
  read_result = *((unsigned long *) virt_addr);
  if(munmap(map_base, MAP_SIZE) == -1);
  close(fd);
  return read_result;
}

 void WritePhysical(unsigned long Address, unsigned long Data)
 {
  int fd;
  unsigned long *map_base, *virt_addr;
  if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1);
  map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, Address & ~MAP_MASK);
  if(map_base == (void *) -1);// FATAL;
  virt_addr = map_base + (Address & MAP_MASK);
  *((unsigned long *) virt_addr) = Data;
  if(munmap(map_base, MAP_SIZE) == -1);
  close(fd);
 }

 

I have included <sys/mman.h> which defines mmap and munmap, so I'm confused as to why they are "undefined" when trying to compile.  Can c6runapp-cc handel this library/header file?

 

  • First off, no mmap is not currently supported from the DSP.  Right now you are using the open function to open a file descriptor on the ARM, and then you want to have an mmap call to use that file descriptor on the ARM.  We don't have an mmap funciton to act as a proxy for calling mmap on the ARM core in this way.  One could be added I guess, but for your immediate use case that would make little sense anyways. 

    You are trying to write a (presumably) 32-bit value to a specific 32-bit address location. The DSP is not using a true MMU, so there is no address translation you need to work around by using mmap. You can just write to the address you want.  Except there is one problem, and that is that the DSP does have an MMU for memory protection purposes. This external blog post gives some details of how to deal with this issue. If you look in the C6Run framework code we use the PROC APIs (on the ARM side) to configure the DSP MMU to give it access to the CMEM region we have specified for our system.  We don't currently account for adding a new memory region for the DSP to have access to (like the DSS region). One option may be to simply disable the MMU as the link above describes.  Alternatively, you could add an additional MMU setup call to the DSP init code and recompile the C6Run framework libraries.

    Another issue above is the use the long type.  On the C64x+ DSP, a long type is 40 bits. On the ARM, it would have been 32-bits. At the end of the day, you would want the APIs to look something like the following:

    uint32_t ReadPhysical(uint32_t Address)
    {
      return *((uint32_t *)Address);
    }
    
    void WritePhysical(uint32_t Address, uint32_t Data)
    {
      *((unsigned long *) Address) = Data;
    }

    With the above, you avoid any calls the ARM side and you access the memory directly (assuming the MMU is setup to allow this).

    I hope the above helps.

    Regards, Daniel

  • Hi Dan,

    Yes, writing 32-bit values to specific 32-bit address locations is main function call I need in order to get at the DSS DACs...

    Since mmap is not currently supported from the DSP, I disabled the MMU and tried compiling with gcc instead since none of the calls actually have to run on the DSP, but rather just read/write to/from the dsp, which I can do with the capability of DSPLink.  That being said, I've compiled and executed my dss_testmode source code from the ARM... at this point I'm still skeptical as to whether or not the DSS DACs have actually been placed into test mode and am writing further test code for this.

    Hopefully I can eventually leverage C6Run after I have access to the DACs and can route processing through them.