I'm trying to edit the flash memory in a pic16F18854 - flash goes from zero to 0fff (4k). I've reserved the last 1k (0c00-0fff) by setting the memory model (in linker) to exclude the area,
I've also told pickit4 to preserve this area by doing,
I can change location 0c00 but there is no way to write it to the device.
I can read the device memory but if I then try to edit the flash it tells me,
I have done multiple "Debug Builds" to no avail.
Am I missing something? Does anyone know how to do this?
Or, use the MCUs write to flash instruction and have your program initialise the area if the correct data does not exist - eg. use "magic numbers" before and after to validate it, and/or add a CRC check.
How about making the data to be stored CONST so it's allocated to flash, then getting that address from the linker map to use for non-writing versions?
Or, as I said earlier, add a routine to initialise the flash data area if it does not exist?
Apparently XC8 does not have native routines to write program memory, but it's possible by adding assembler routines - some outline examples here:
I'm using the new PIC12F1572 device and need some non-volatile data storage. This device lacks EEPROM so I need to use flash instead. I can write my own flash access routines using the supplied documentation but thought I would first ask if there are any Microchip supplied routines avail...