Hot!PIC24F debugging fun

Page: < 123 Showing page 3 of 3
Author
friesen
Super Member
  • Total Posts : 1725
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 10:23:28 (permalink)
3 (1)
People write compilers.
 
Right click->Export hex = trash in exported hex file, 4th column. 

Erik Friesen
#41
Gort2015
Klaatu Barada Nikto
  • Total Posts : 1473
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 10:50:08 (permalink)
0
What code?

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#42
Gort2015
Klaatu Barada Nikto
  • Total Posts : 1473
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 13:33:34 (permalink)
0
Trash from what?

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#43
friesen
Super Member
  • Total Posts : 1725
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 13:33:51 (permalink)
0
I think maybe I am to the point of a different board rev, I think I'll go back to 32 bit land.
 
Its still the same issue, it won't do the same things with the debugger attached, which is flakey.  Its sort of like using an arduino.

Erik Friesen
#44
friesen
Super Member
  • Total Posts : 1725
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 15:30:27 (permalink)
0
Trying this again, I caught an double ecc trap on the debugger, so this may be the DEE emulation code causing the issues.  It happened on latch read.

Erik Friesen
#45
aschen0866
Super Member
  • Total Posts : 4161
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 15:45:38 (permalink)
3 (1)
friesen
 
unsigned char emulationPages[DATA_EE_BANKS * NUM_DATA_EE_PAGES][NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2] __attribute__((space(psv), address(0x800), aligned(NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2), noload));
 

Here you use space(psv) without __psv__ qualifier. Are you managing PSVPAG yourself?
#46
friesen
Super Member
  • Total Posts : 1725
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 16:01:29 (permalink)
0
I don't know.  If DEE emulation is the only part of the program using psv, what can happen?  
 
All my interrupts are auto_psv, but perhaps I am missing something else here?  The datasheet mentions everything getting 3072 aligned, so I am sort of suspecting that DEE emulation may not have been tailored for this flavor of pic24f yet.
 
I am still kicking myself over not using a real eeprom.

Erik Friesen
#47
Gort2015
Klaatu Barada Nikto
  • Total Posts : 1473
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 17:43:16 (permalink)
0
Yeah, use a real eeprom that has the write indurance.
The 3072 alignment is 2 pages of 1536, 512 instructions.
 
I don't know about the DEE emulator but it sounds like it is using flash memory.
I have some code somewhere for preserving memory like you are trying to do.
post edited by Gort2015 - 2017/09/20 05:22:59

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#48
Gort2015
Klaatu Barada Nikto
  • Total Posts : 1473
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: PIC24F debugging fun 2017/09/19 17:56:06 (permalink)
0
__prog__ char __attribute__((space(prog),section("WorldDestroyer"),fillupper(0xa5))) Gort[]="Klattu Barada Nikto";


So you set flash/program memory like that, using alignment if needed.
Downside is only 16bits are used out of 24bits.
 
That could have been the bug you were seeing.  Try adding fillupper(0xFF) to the attributes which is NOPR.
 
You can make use of the low byte, high word in asm easily.
You can also use table rd/wr but that is a different story for writing.
 
You are better off with external eeprom without hogging flash.

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#49
CinziaG
you know what happen
  • Total Posts : 3138
  • Reward points : 0
  • Joined: 2016/12/07 14:20:36
  • Location: Wien
  • Status: offline
Re: PIC24F debugging fun 2017/09/20 02:43:05 (permalink)
0
I've been using this DEE
* Priyabrata Sinha    2016/12/20 Version 3.0 - Used only word programming on dsPIC33E/PIC24E,
on a FJ GA702 and an EP GP202 PIC24 and it is okay: I mean, I had to change (raised a ticket too) the page size or so for the EP device, but all ok then.
 
And yes, the "psv" thing is like that:
    unsigned char emulationPages[DATA_EE_BANKS * NUM_DATA_EE_PAGES][NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2]
        __attribute__ ((space(psv), aligned(NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2), noload));



some idiot blocked my other account (confirming that signature)
Forget about me, microchip.
#50
friesen
Super Member
  • Total Posts : 1725
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: PIC24F debugging fun 2017/09/20 03:11:16 (permalink)
0
So you commented it to use the E code? I have been studying that part as I suspect that is the problem.

Erik Friesen
#51
CinziaG
you know what happen
  • Total Posts : 3138
  • Reward points : 0
  • Joined: 2016/12/07 14:20:36
  • Location: Wien
  • Status: offline
Re: PIC24F debugging fun 2017/09/20 06:40:55 (permalink)
0
No, I meant I left it all as it was provided:
All I had to do was changing the Values for PAGE and ROW write in the include files.
But, since you're using an FJ part... you should be ok...

some idiot blocked my other account (confirming that signature)
Forget about me, microchip.
#52
aschen0866
Super Member
  • Total Posts : 4161
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: PIC24F debugging fun 2017/09/20 08:08:29 (permalink)
3 (1)
CinziaG
And yes, the "psv" thing is like that:
    unsigned char emulationPages[DATA_EE_BANKS * NUM_DATA_EE_PAGES][NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2]
       __attribute__ ((space(psv), aligned(NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2), noload));

If you don't manage PSVPAG in your code, this would only work if linker happens to put it in the same page as space(auto_psv).
 
Unless things have changed over time, my understanding is that
1. By default these two lines are equivalent
const int foo;
and
int foo __attribute__((space(auto_psv)));

2. Both space(psv) and space(prog) require you to manage PSVPAG

int psvpag_read = PSVPAG; // Save current PSVPAG
PSVPAG = __builtin_psvpage(&foo); // New PSVPAG
...
PSVPAG = psvpag_read; // restore PSVPAG

3. Use __psv__ or __prog__ qualifier so that the compiler will do the above for you with some performance penalty.
4. Use space(prog) if the object may cross PSV page boundary.
5. Using auto_psv on an ISR attribute tells the compiler to restore the default PSV page in case the ISR comes in between lines (as shown in 2) where the PSVPAG has been changed.
#53
CinziaG
you know what happen
  • Total Posts : 3138
  • Reward points : 0
  • Joined: 2016/12/07 14:20:36
  • Location: Wien
  • Status: offline
Re: PIC24F debugging fun 2017/09/20 08:25:03 (permalink)
0
I know about that, more or less Smile
That above is the code from DEE, which possibly has some (other) bugs, but does woek on those 2 PICs I mentioned. Possibly because I'm not using other "far" objects... so am not sure about OP.

some idiot blocked my other account (confirming that signature)
Forget about me, microchip.
#54
Gort2015
Klaatu Barada Nikto
  • Total Posts : 1473
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: PIC24F debugging fun 2017/09/20 09:29:02 (permalink)
0
tblpage
tbloffset
 
Can be used but it is best to use an external eeprom if you plan to do a lot of writes.
If your chip can only rd/wr pages, dump it to external eeprom, I do that when modifying the interrupt vectors so that I can specify timers in a function.

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#55
friesen
Super Member
  • Total Posts : 1725
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
Re: PIC24F debugging fun 2017/09/20 15:14:33 (permalink)
0
Its starting to look like an issue with the Microchip DEE emulation library.  I don't have time presently to figure it out, but it does appear to work correctly after removing the code entirely.  Since it is battery powered I can get away with it, and the next rev will have an eeprom, and a chip that doesn't need paging.
 
Incidentally, the DEE code does manage the psvpag, but something is still amiss, as I shouldn't be getting double ecc errors.

Erik Friesen
#56
Page: < 123 Showing page 3 of 3
Jump to:
© 2017 APG vNext Commercial Version 4.5