• AVR Freaks

Helpful ReplyHot!PIC32MZ2048EFH144 compile/program issue

Author
KevinHuang
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/08/29 08:13:33
  • Location: 0
  • Status: offline
2019/10/22 15:40:04 (permalink)
0

PIC32MZ2048EFH144 compile/program issue

Hello Experts,
 
I am currently having an issue. I have a function in my code that is never called during run time, however adding or not adding the function breaks my output.
 
My project is SPI to UDP conversion -> works good.
 
I am trying to add a function (a few lines) in my project, the function breaks my code even if its never called.
 
From the Dashboard page of the project, 4% of the Data memory has been used(20,288 bytes of 524,288 bytes), and 10% of the Program memory has been used(199,256 bytes). (PIC32MZ2048EFH144 )
 
I feels that my SPI function is affected by the added uncalled function. But there is 90% of the program memory available, and the data memory is also not a problem. Maybe my SPI function need to be loaded at some special memory location for proper running?
 
I appreciate your helps.
 
--- Kevin
 
#1
Larry.Standage
Super Member
  • Total Posts : 926
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/22 15:48:43 (permalink) ☄ Helpfulby KevinHuang 2019/10/24 14:45:25
0
Do you have a special linker script?
 
Have you used the Elf viewer plugin to see where the function is located, to see if that is having an effect?
#2
NKurzman
A Guy on the Net
  • Total Posts : 17942
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/22 16:00:54 (permalink) ☄ Helpfulby KevinHuang 2019/10/24 14:45:28
0
"function breaks my output"  What does that mean?
The "output" is garbled? missing? The program crashes?
And you "Output" is to what?
 
Is your SPI using DMA?  if so is the buffer coherent?
Are you using Harmony?  What Version?  Are you using the recommended Compiler Version?
 
#3
KevinHuang
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/08/29 08:13:33
  • Location: 0
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/23 06:48:58 (permalink)
0
Hi Larry, I don't have special linker script. I will try to use the Elf viewer plugin to check the function location.
 
Hi NKurzman, "function breaks my output" means my program is still running, but more than 1/10 of my data frames are not correct (Frame size 38448 bytes. Not all wrong). I'm using polling to read the SPI(myself's program, not harmony SPI), buffer should be untouched. Harmony v2.06, MPLAB v5.05. Not sure about the compiler, maybe you mean the XC32 v2.10.
My project is modified from the hamony v2.06/apps/tcpip/berkely_udp_server(only C code modifications, and using ICD3. all default setting.).
#4
KevinHuang
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/08/29 08:13:33
  • Location: 0
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/23 08:57:44 (permalink)
0
.png files are the screen captures of the good output vs bad output.
In ideal case, all the <FrameNo.> should be contiguous without jumping. A jumping means a wrong data read in.
 
I checked the .map files, the SPI related functions are at the right places since I used "__longramfunc__" property for the SPI functions(My most simple project can work without this property; when I tried to add some un-called functions to the projects for future usage , the project became bad; then I add this property to the SPI functions, it works awhile. Looks now it reaches the bottleneck). All SPI related buffers are at the same addresses too.

Attached Image(s)

#5
GARETH_71
Senior Member
  • Total Posts : 166
  • Reward points : 0
  • Joined: 2006/11/18 13:46:50
  • Location: UK
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/23 11:19:10 (permalink) ☄ Helpfulby KevinHuang 2019/10/24 14:45:37
0
Can you post your "never called" function code?
#6
KevinHuang
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/08/29 08:13:33
  • Location: 0
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/23 11:35:22 (permalink)
0
#define NOP() {__asm__ volatile ("nop");}
void UART_COMMAND(void)
{
   NOP();
}
 
case APP_STATE_CMD_CHECK:     // This case never run in. For future usage.
{
//                UART_COMMAND();   // with or without this function will be different.
    appData.state = APP_STATE_SPI_HANDSHAKE;  // The state 
    break;
}
#7
Larry.Standage
Super Member
  • Total Posts : 926
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/23 12:08:52 (permalink) ☄ Helpfulby KevinHuang 2019/10/24 14:45:42
0
Double-check the case prior to APP_STATE_CMD_CHECK, that you have a break in it. It seems to me that the function is actually being called, even if you think it isn't.
 
Have you tried setting a breakpoint in the UART_COMMAND function to see how it is being called?
#8
KevinHuang
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/08/29 08:13:33
  • Location: 0
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/23 12:30:22 (permalink)
0
Previous case has the break. Even I tried a while(1); trap in this case, and it shows that this case hasn't been run.
#9
KevinHuang
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/08/29 08:13:33
  • Location: 0
  • Status: offline
Re: PIC32MZ2048EFH144 compile/program issue 2019/10/24 14:44:34 (permalink)
0
Thanks all experts, my project is going to use another way to avoid the code length issue (put the functions on the PC side, not on the microchip side).
Thanks again for your reading and responses.
 
Best regards,
Kevin
#10
Jump to:
© 2019 APG vNext Commercial Version 4.5