• AVR Freaks

AnsweredHot!Compilation error when accessing DMA data space with pointer

Page: 12 > Showing page 1 of 2
Author
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
2020/05/09 10:11:43 (permalink)
0

Compilation error when accessing DMA data space with pointer

maplab x IDE , XC16,v1.50,dsPIC33EP512MU814.
Hope high-goers point to the mystery,Where the mistake is, how to solve?

1.Variable declaration:
extern __eds__ unsigned char  Send_Buffer[256] __attribute__((eds, space(dma)));
2.function:
void send_data(void)
{
        unsigned char m[5] = { 1, 2, 3, 4, 5 };
        unsigned char *pm = (uchar *)&m;
        unsigned char *p = (unsigned char *)&Send_Buffer;
        memcpy(p,pm,5);
}
3.compile result:
error: Unable to convert from__eds__ __eds__ unsigned char (*)[256]
4.function modify:
void send_data(void)
{
       unsigned char m[5] = { 1, 2, 3, 4, 5 };
       unsigned char *pm = (unsigned char *)&m;
      __eds__ unsigned char *p = (unsigned char *)&Send_Buffer;
      memcpy(p,pm,5);
}
5.compile result:
error: passing argument 1 of 'memcpy' from pointer to non-enclosed address space
post edited by dspic - 2020/05/09 19:31:19

Attached Image(s)

#1
JPortici
Super Member
  • Total Posts : 1105
  • Reward points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: Grappaland
  • Status: offline
Re: about DMA data access 2020/05/09 10:16:04 (permalink) ☼ Best Answerby dspic 2020/05/09 10:22:07
0
?
#2
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 10:26:29 (permalink)
0
please look the image,tks
#3
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 10:33:57 (permalink)
0
JPortici
?


Hello, is a DMA data pointer access problem, trouble to help see how to solve, thank you very much!
post edited by dspic - 2020/05/09 10:37:25
#4
RISC
Super Member
  • Total Posts : 5771
  • Reward points : 0
  • Status: offline
Re: about DMA data access 2020/05/09 14:01:11 (permalink)
4 (1)
Hi,
 
I have a similar issue (see screenshot).
Using XC15 v1.50 & dsPIC33EP512MU810.
I am porting an IIR code example (CE400) to dsPIC33EP512MU810 and I want to use DMA in EDS.
error message :
==================================================
"C:\Program Files\Microchip\xc16\v1.50\bin\xc16-gcc.exe" adcDrv1.c -o build/default/production/adcDrv1.o -c -mcpu=33EP512MU810 -MMD -MF "build/default/production/adcDrv1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off -mdfp="C:/Program Files (x86)/Microchip/MPLABX/v5.35/packs/Microchip/dsPIC33E-GM-GP-MC-GU-MU_DFP/1.2.58"/xc16
adcDrv1.c: In function '_DMA0Interrupt':
adcDrv1.c:182:3: error: passing argument 3 of 'IIRTransposed' from pointer to non-enclosed address space
adcDrv1.c:186:3: error: passing argument 3 of 'IIRTransposed' from pointer to non-enclosed address space
==================================================
Header file for the DSP library Functions :
==================================================
extern IIRTransposedStruct ExampleHPFFilter;
extern void IIRTransposedInit ( IIRTransposedStruct* filter );
extern fractional* IIRTransposed ( int numSamps,fractional* dstSamps,fractional* srcSamps,IIRTransposedStruct*filter);

==================================================
The declaration of buffers is the one which create the isuse with compilation :
==================================================

#ifdef _HAS_DMA //ASO macro must be fixed...
           __eds__ fractional BufferA[NUMSAMP] __attribute__((eds,space(dma)));
           __eds__ fractional BufferB[NUMSAMP] __attribute__((eds,space(dma)));
#else
          fractional BufferA[NUMSAMP] __attribute__((space(xmemory)));
          fractional BufferB[NUMSAMP] __attribute__((space(xmemory)));
#endif

fractional outputSignal[NUMSAMP];

 
===================================================
I attach the project.
Any idea ?
 

Attached Image(s)

#5
ric
Super Member
  • Total Posts : 27934
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: about DMA data access 2020/05/09 15:35:22 (permalink)
1 (1)
dspic
please look the image,tks


Why on earth hide your question at the bottom of an image that has to be opened?
The idea is to make it EASIER for people to help you.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#6
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 17:17:45 (permalink)
0
ric
dspic
please look the image,tks


Why on earth hide your question at the bottom of an image that has to be opened?
The idea is to make it EASIER for people to help you.


Hi,ric,Excuse me, yesterday when posting encountered a problem, the expression is not very clear.
#7
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 17:20:13 (permalink)
0
ric
dspic
please look the image,tks


Why on earth hide your question at the bottom of an image that has to be opened?
The idea is to make it EASIER for people to help you.


the MCU is:dsPIC33EP512MU814
#8
ric
Super Member
  • Total Posts : 27934
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: about DMA data access 2020/05/09 17:22:35 (permalink)
0
You didn't mention that.
You have struck the infamous "webserver firewall" that plagues this forum.
It is this line that is triggering it
 
__eds__ __eds__ uchar (*)[256]
 
It happens any time the firewall sees the characters "char" followed by "(". I used the bolding above to get around it.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#9
ric
Super Member
  • Total Posts : 27934
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: about DMA data access 2020/05/09 17:22:35 (permalink)
0
You didn't mention that.
You have struck the infamous "webserver firewall" that plagues this forum.
It is this line that is triggering it
 
__eds__ __eds__ uchar (*)[256]
 
It happens any time the firewall sees the characters "char" followed by "(". I used the bolding above to get around it.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#10
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 17:55:46 (permalink)
0
ric
You didn't mention that.
You have struck the infamous "webserver firewall" that plagues this forum.
It is this line that is triggering it
 
__eds__ __eds__ uchar (*)[256]
 
It happens any time the firewall sees the characters "char" followed by "(". I used the bolding above to get around it.
 


Hi,ric!
Your direction is very correct, now it's all right. Thank you
#11
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11928
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: about DMA data access 2020/05/09 18:04:58 (permalink)
5 (2)
uchar *p = (uchar *)&Send_Buffer;

 
Don't use your own made-up types; no one knows what they are.  #include <stdint.h> and use those.
 
Casting is never the solution to a warning you don't understand.  You have an array with __eds__ type, so the pointer also needs it.
 
uint8_t __eds__ *ptr = Send_Buffer;

#12
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 19:26:01 (permalink)
5 (1)
jtemples
uchar *p = (uchar *)&Send_Buffer;

 
Don't use your own made-up types; no one knows what they are.  #include <stdint.h> and use those.
 
Casting is never the solution to a warning you don't understand.  You have an array with __eds__ type, so the pointer also needs it.
 
uint8_t __eds__ *ptr = Send_Buffer;



Thank you for your right and reply.Look closely at my post,in step 4.function modify:
I have add __eds__ attribute,But the compilation results are still incorrect.
#13
ric
Super Member
  • Total Posts : 27934
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: about DMA data access 2020/05/09 19:30:14 (permalink)
5 (1)
Shouldn't
__eds__ uchar *p = (uchar *)&Send_Buffer;
just be
__eds__ uchar *p = Send_Buffer;
Otherwise you are throwing away the attributes with that extra cast.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#14
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 19:38:33 (permalink)
0
ric
Shouldn't
__eds__ uchar *p = (uchar *)&Send_Buffer;
just be
__eds__ uchar *p = Send_Buffer;
Otherwise you are throwing away the attributes with that extra cast.
 


ric, thank your reply:
modify as below:
__eds__ uchar *p = Send_Buffer;
the error is still:
error: passing argument 1 of 'memcpy' from pointer to non-enclosed address space
#15
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 19:41:30 (permalink)
5 (1)
The same code, using C30 is no problem, XC16 does not pass
#16
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11928
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: about DMA data access 2020/05/09 19:59:20 (permalink)
5 (2)
memcpy() does not support __eds__ pointers.  Use _memcpy_eds().
#17
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 20:43:10 (permalink)
0
jtemples
memcpy() does not support __eds__ pointers.  Use _memcpy_eds().


Thank you for replying, according to your operation, the problem solved, where is this function:_memcpy_eds()?
#18
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11928
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: about DMA data access 2020/05/09 20:47:53 (permalink)
5 (2)
It's documented in the XC16 libraries references guide.
#19
dspic
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2008/09/08 18:10:10
  • Location: 0
  • Status: offline
Re: about DMA data access 2020/05/09 21:01:39 (permalink)
3 (2)
jtemples
It's documented in the XC16 libraries references guide.


I understand, thank you very much for your professional advice, your noble sentiment is worth my study.
 
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2020 APG vNext Commercial Version 4.5