Locating things in Pogram memory
//----- CONSTANTS LOCATED IN PROGRAM MEMORY -----
#ifdef FLASH_FIRMWARE_VALUES_LOCATION
#ifndef __DEBUG //Don't do in devel mode to reduce the programming time if these are being located at the end of the memory space
const unsigned int __attribute__ ((space(psv), address (FLASH_FIRMWARE_VALUES_LOCATION)))
firmware_upload_markers [2] = {OUR_PRODUCT_ID, OUR_FIRMWARE_REVISION};
#endif
#endif
//A function
int __attribute__ ((address(0x8000))) PrintString (const char *s);
Reading Values From Program Memory
#include <libpic30.h>
char prog_mem_value[2];
_memcpy_p2d16(&prog_mem_value[0], 0x003fe, 2); //Dest, source, number of bytes to read
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.