dspic
Starting Member
- Total Posts : 36
- Reward points : 0
- Joined: 2008/09/08 18:10:10
- Location: 0
- Status: offline
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)
|
JPortici
Super Member
- Total Posts : 1254
- 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
|
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)
please look the image,tks
|
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)
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
|
RISC
Super Member
- Total Posts : 5912
- Reward points : 0
- Status: offline
Re: about DMA data access
2020/05/09 14:01:11
(permalink)
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)
|
ric
Super Member
- Total Posts : 29542
- 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)
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.
To get a useful answer, always state which PIC you are using!
|
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)
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.
|
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)
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
|
ric
Super Member
- Total Posts : 29542
- 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)
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.
To get a useful answer, always state which PIC you are using!
|
ric
Super Member
- Total Posts : 29542
- 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)
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.
To get a useful answer, always state which PIC you are using!
|
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)
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
|
jtemples
عُضْوٌ جَدِيد
- Total Posts : 12032
- 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)
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;
|
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)
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.
|
ric
Super Member
- Total Posts : 29542
- 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)
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.
To get a useful answer, always state which PIC you are using!
|
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)
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
|
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)
The same code, using C30 is no problem, XC16 does not pass
|
jtemples
عُضْوٌ جَدِيد
- Total Posts : 12032
- 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)
memcpy() does not support __eds__ pointers. Use _memcpy_eds().
|
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)
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()?
|
jtemples
عُضْوٌ جَدِيد
- Total Posts : 12032
- 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)
It's documented in the XC16 libraries references guide.
|
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)
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.
|