'PIC32M flash read issue
I've been having trouble in implementation of a read from flash (PFM) in an application using a pic32mz controller, written in C.
I'm using the code below within a function to declare a variable with a specific address, and then assign this address to a pointer (a method recommended in the xc32 compiler guide)- which I then try to use to read the value in flash into a global variable:
int *pointer;
static int __attribute__((address(0xBD008000))) userData[4]; /* Assign the virtual address value */
pointer = &userData[0]; /* Pointer to same location as userData[0]; */
pps.pulse_width = *(int*)(pointer); /* Value of flash memory */
When I call this routine, the program locks up - I know it's happening at the static declaration, as I've tried running with the subsequent code commented out as well, with similar results.
I've also tried simply assigning the address value to the pointer as pointer = 0x1D008000 (physical address value), but with similar results.
Could someone help me understand why this isn't working, or point me to a better implementation for reading flash?
Appreciated, Paul
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
