PIC32 – pustekuchens Blog https://blog.bur-k.de In der Welt der Bits und Bytes Fri, 06 Jun 2014 16:23:21 +0000 de-DE hourly 1 https://wordpress.org/?v=6.4.2 XC32 persistent Variable https://blog.bur-k.de/?p=61 https://blog.bur-k.de/?p=61#respond Fri, 06 Jun 2014 16:23:21 +0000 http://pustekuchen.xn--burkfrulein-q8a.de/?p=61 Weiterlesen →]]> Hello,

today i was trying to create a persistent variable (A variable wich get not initialized on startup). I tried many ways like:

BOOL __attribute__((persistent)) my_pers_var;
BOOL __attribute__((__persistent)) my_pers_var;
BOOL __attribute__ ((noload)) my_pers_var; /* Like in www.microchip.com/support/KBArticle.aspx?KBID=KB100239 */
BOOL __attribute__((persistent), address(0xA0001000) my_pers_var; /* This worked either, but is not very dynamic */

So the solution is the following declaration:

BOOL __attribute__((persistent, section(".persist"))) my_pers_var;

Explaination: The Attribute ‚persistent‘ marks the variable as persistant.
The section „.persist“ let the memory be saved in the persists section.

Should the section attribute not be enought?No, because its a special marked memory range which only stores persistent variables.
Now the map file looks how i want it to be 🙂

.persist        0xa0000000        0x4
0xa0000000                _persist_begin = .
*(.persist .persist.*)
.persist.my_pers_var
0xa0000000        0x4 build/XC32_PIC32MX460F512L/production/_ext/906281160/main.o
0xa0000000                my_pers_var
*(.pbss .pbss.*)
0xa0000004                . = ALIGN (0x4)
0xa0000004                _persist_end = .

I’am using
XC32 v1.31
PIC32MX450F256L
MPLAB X IDE v2.10

I hope i could help someone with this 🙂

]]>
https://blog.bur-k.de/?feed=rss2&p=61 0
MPLAB X „No source code lines were found at current PC 0x0“ https://blog.bur-k.de/?p=26 https://blog.bur-k.de/?p=26#comments Fri, 06 Sep 2013 08:21:40 +0000 http://pustekuchen91.wordpress.com/?p=26 Weiterlesen →]]> Hello,

today i got a really annoying failure in my PIC Project. I just want to debug the project as every time, but something is went wrong!

In the Debugger Console the error „No source code lines were found at current PC 0x0“ was shown. The Problem was that the programm stopped immediately after starting the debugger. It stops much faster as normally and the target device was not programmed.

I’ve restored an old version of the project from the SVN but nothing helped. But after some hairs less on my head i’ve found the problem. It was the PIC Memory View (SFRs). After closing the SFR View i could debug as before 🙂

If you use the SFR View then you have to close it every time before starting the debugger again.

tl;dr
Try to close the view of the SFR before debugging the project again.

If this helps you it would be nice if you leave a comment below 🙂

]]>
https://blog.bur-k.de/?feed=rss2&p=26 5