-
Home
-
doc
-
support
-
driver
-
nvm
nvm_pic32.h
View on Github
/**
* @file nvm_pic32.h
* @author Sebastien CAUX (sebcaux)
* @copyright UniSwarm 2023
*
* @date January 11, 2023, 10:56 AM
*
* @brief NVM (Non Volatile Memory) support drivers for PIC32MK,
* PIC32MX, PIC32MZDA, PIC32MZEC and PIC32MZEF
*
* Implementation based on Microchip documents DS60001121G and DS60001193B:
* https://ww1.microchip.com/downloads/en/DeviceDoc/60001121g.pdf
* https://ww1.microchip.com/downloads/en/DeviceDoc/60001193B.pdf
*/
#ifndef NVM_PIC32_H
#define NVM_PIC32_H
#ifdef __cplusplus
extern "C" {
#endif
typedef uint32_t nvm_addr;
int nvm_writeWords(nvm_addr addr, const uint32_t *data);
int nvm_writeRow(nvm_addr addr, const uint32_t *data);
#if defined(ARCHI_pic32mx)
# if defined(DEVICE_32MX320F032H) || defined(DEVICE_32MX320F064H) || defined(DEVICE_32MX320F128H) || defined(DEVICE_32MX320F128L) \
|| defined(DEVICE_32MX330F064H) || defined(DEVICE_32MX330F064L) || defined(DEVICE_32MX340F128H) || defined(DEVICE_32MX340F128L) \
|| defined(DEVICE_32MX340F256H) || defined(DEVICE_32MX340F512H) || defined(DEVICE_32MX350F128H) || defined(DEVICE_32MX350F128L) \
|| defined(DEVICE_32MX350F256H) || defined(DEVICE_32MX350F256L) || defined(DEVICE_32MX360F256L) || defined(DEVICE_32MX360F512L) \
|| defined(DEVICE_32MX370F512H) || defined(DEVICE_32MX370F512L) || defined(DEVICE_32MX420F032H) || defined(DEVICE_32MX430F064H) \
|| defined(DEVICE_32MX430F064L) || defined(DEVICE_32MX440F128H) || defined(DEVICE_32MX440F128L) || defined(DEVICE_32MX440F256H) \
|| defined(DEVICE_32MX440F512H) || defined(DEVICE_32MX450F128H) || defined(DEVICE_32MX450F128L) || defined(DEVICE_32MX450F256H) \
|| defined(DEVICE_32MX450F256L) || defined(DEVICE_32MX460F256L) || defined(DEVICE_32MX460F512L) || defined(DEVICE_32MX470F512H) \
|| defined(DEVICE_32MX470F512L) || defined(DEVICE_32MX534F064H) || defined(DEVICE_32MX534F064L) || defined(DEVICE_32MX564F064H) \
|| defined(DEVICE_32MX564F064L) || defined(DEVICE_32MX564F128H) || defined(DEVICE_32MX564F128L) || defined(DEVICE_32MX575F256H) \
|| defined(DEVICE_32MX575F256L) || defined(DEVICE_32MX575F512H) || defined(DEVICE_32MX575F512L) || defined(DEVICE_32MX664F064H) \
|| defined(DEVICE_32MX664F064L) || defined(DEVICE_32MX664F128H) || defined(DEVICE_32MX664F128L) || defined(DEVICE_32MX675F256H) \
|| defined(DEVICE_32MX675F256L) || defined(DEVICE_32MX675F512H) || defined(DEVICE_32MX675F512L) || defined(DEVICE_32MX695F512H) \
|| defined(DEVICE_32MX695F512L) || defined(DEVICE_32MX764F128H) || defined(DEVICE_32MX764F128L) || defined(DEVICE_32MX795F512H) \
|| defined(DEVICE_32MX795F512L)
# define NVM_FLASH_PAGE_BYTE (1024 * 4)
# define NVM_FLASH_ROW_BYTE (128 * 4)
# else
# define NVM_FLASH_PAGE_BYTE (256 * 4)
# define NVM_FLASH_ROW_BYTE (32 * 4)
# endif
#elif defined(ARCHI_pic32mm)
# define NVM_FLASH_PAGE_BYTE (512 * 4)
# define NVM_FLASH_ROW_BYTE (64 * 4)
#elif defined(ARCHI_pic32mk)
# define NVM_FLASH_PAGE_BYTE (1024 * 4)
# define NVM_FLASH_ROW_BYTE (128 * 4)
#elif defined(ARCHI_pic32mzda) || defined(ARCHI_pic32mzec) || defined(ARCHI_pic32mzef)
# define NVM_FLASH_PAGE_BYTE (4096 * 4)
# define NVM_FLASH_ROW_BYTE (512 * 4)
#endif
#if defined(ARCHI_pic32mx)
# define NVM_WORD_COUNT 1
#elif defined(ARCHI_pic32mm)
# define NVM_WORD_COUNT 2
#elif defined(ARCHI_pic32mk) || defined(ARCHI_pic32mzec) || defined(ARCHI_pic32mzef) || defined(ARCHI_pic32mzda)
# define NVM_WORD_COUNT 4
#endif
// NVM_SECTOR_START
#define NVM_SECTOR_START 0x1D000000
// NVM_SECTOR_END
#if defined(DEVICE_32MM0016GPL020) || defined(DEVICE_32MM0016GPL028) || defined(DEVICE_32MM0016GPL036) || defined(DEVICE_32MX110F016B) \
|| defined(DEVICE_32MX110F016C) || defined(DEVICE_32MX110F016D) || defined(DEVICE_32MX210F016B) || defined(DEVICE_32MX210F016C) \
|| defined(DEVICE_32MX210F016D)
# define NVM_SECTOR_END 0x1D003FFF
#elif defined(DEVICE_32MM0032GPL020) || defined(DEVICE_32MM0032GPL028) || defined(DEVICE_32MM0032GPL036) || defined(DEVICE_32MX120F032B) \
|| defined(DEVICE_32MX120F032C) || defined(DEVICE_32MX120F032D) || defined(DEVICE_32MX220F032B) || defined(DEVICE_32MX220F032C) \
|| defined(DEVICE_32MX220F032D) || defined(DEVICE_32MX320F032H) || defined(DEVICE_32MX420F032H)
# define NVM_SECTOR_END 0x1D007FFF
#elif defined(DEVICE_32MM0064GPL020) || defined(DEVICE_32MM0064GPL028) || defined(DEVICE_32MM0064GPL036) || defined(DEVICE_32MM0064GPM028) \
|| defined(DEVICE_32MM0064GPM036) || defined(DEVICE_32MM0064GPM048) || defined(DEVICE_32MM0064GPM064) || defined(DEVICE_32MX120F064H) \
|| defined(DEVICE_32MX130F064B) || defined(DEVICE_32MX130F064C) || defined(DEVICE_32MX130F064D) || defined(DEVICE_32MX230F064B) \
|| defined(DEVICE_32MX230F064C) || defined(DEVICE_32MX230F064D) || defined(DEVICE_32MX320F064H) || defined(DEVICE_32MX330F064H) \
|| defined(DEVICE_32MX330F064L) || defined(DEVICE_32MX430F064H) || defined(DEVICE_32MX430F064L) || defined(DEVICE_32MX534F064H) \
|| defined(DEVICE_32MX534F064L) || defined(DEVICE_32MX564F064H) || defined(DEVICE_32MX564F064L) || defined(DEVICE_32MX664F064H) \
|| defined(DEVICE_32MX664F064L)
# define NVM_SECTOR_END 0x1D00FFFF
#elif defined(DEVICE_32MK0128MCA028) || defined(DEVICE_32MK0128MCA032) || defined(DEVICE_32MK0128MCA048) || defined(DEVICE_32MM0128GPM028) \
|| defined(DEVICE_32MM0128GPM036) || defined(DEVICE_32MM0128GPM048) || defined(DEVICE_32MM0128GPM064) || defined(DEVICE_32MX130F128H) \
|| defined(DEVICE_32MX130F128L) || defined(DEVICE_32MX150F128B) || defined(DEVICE_32MX150F128C) || defined(DEVICE_32MX150F128D) \
|| defined(DEVICE_32MX154F128B) || defined(DEVICE_32MX154F128D) || defined(DEVICE_32MX230F128H) || defined(DEVICE_32MX230F128L) \
|| defined(DEVICE_32MX250F128B) || defined(DEVICE_32MX250F128C) || defined(DEVICE_32MX250F128D) || defined(DEVICE_32MX254F128B) \
|| defined(DEVICE_32MX254F128D) || defined(DEVICE_32MX320F128H) || defined(DEVICE_32MX320F128L) || defined(DEVICE_32MX340F128H) \
|| defined(DEVICE_32MX340F128L) || defined(DEVICE_32MX350F128H) || defined(DEVICE_32MX350F128L) || defined(DEVICE_32MX440F128H) \
|| defined(DEVICE_32MX440F128L) || defined(DEVICE_32MX450F128H) || defined(DEVICE_32MX450F128L) || defined(DEVICE_32MX530F128H) \
|| defined(DEVICE_32MX530F128L) || defined(DEVICE_32MX564F128H) || defined(DEVICE_32MX564F128L) || defined(DEVICE_32MX664F128H) \
|| defined(DEVICE_32MX664F128L) || defined(DEVICE_32MX764F128H) || defined(DEVICE_32MX764F128L)
# define NVM_SECTOR_END 0x1D01FFFF
#elif defined(DEVICE_32MK0256GPG048) || defined(DEVICE_32MK0256GPG064) || defined(DEVICE_32MK0256MCJ048) || defined(DEVICE_32MK0256MCJ064) \
|| defined(DEVICE_32MM0256GPM028) || defined(DEVICE_32MM0256GPM036) || defined(DEVICE_32MM0256GPM048) || defined(DEVICE_32MM0256GPM064) \
|| defined(DEVICE_32MX130F256B) || defined(DEVICE_32MX130F256D) || defined(DEVICE_32MX150F256H) || defined(DEVICE_32MX150F256L) \
|| defined(DEVICE_32MX170F256B) || defined(DEVICE_32MX170F256D) || defined(DEVICE_32MX174F256B) || defined(DEVICE_32MX174F256D) \
|| defined(DEVICE_32MX230F256B) || defined(DEVICE_32MX230F256D) || defined(DEVICE_32MX250F256H) || defined(DEVICE_32MX250F256L) \
|| defined(DEVICE_32MX270F256B) || defined(DEVICE_32MX270F256D) || defined(DEVICE_32MX274F256B) || defined(DEVICE_32MX274F256D) \
|| defined(DEVICE_32MX340F256H) || defined(DEVICE_32MX350F256H) || defined(DEVICE_32MX350F256L) || defined(DEVICE_32MX360F256L) \
|| defined(DEVICE_32MX440F256H) || defined(DEVICE_32MX450F256H) || defined(DEVICE_32MX450F256L) || defined(DEVICE_32MX460F256L) \
|| defined(DEVICE_32MX550F256H) || defined(DEVICE_32MX550F256L) || defined(DEVICE_32MX575F256H) || defined(DEVICE_32MX575F256L) \
|| defined(DEVICE_32MX675F256H) || defined(DEVICE_32MX675F256L) || defined(DEVICE_32MX775F256H) || defined(DEVICE_32MX775F256L)
# define NVM_SECTOR_END 0x1D03FFFF
#elif defined(DEVICE_32MK0512GPD064) || defined(DEVICE_32MK0512GPD100) || defined(DEVICE_32MK0512GPE064) || defined(DEVICE_32MK0512GPE100) \
|| defined(DEVICE_32MK0512GPG048) || defined(DEVICE_32MK0512GPG064) || defined(DEVICE_32MK0512GPK064) || defined(DEVICE_32MK0512GPK100) \
|| defined(DEVICE_32MK0512MCF064) || defined(DEVICE_32MK0512MCF100) || defined(DEVICE_32MK0512MCJ048) || defined(DEVICE_32MK0512MCJ064) \
|| defined(DEVICE_32MK0512MCM064) || defined(DEVICE_32MK0512MCM100) || defined(DEVICE_32MX170F512H) || defined(DEVICE_32MX170F512L) \
|| defined(DEVICE_32MX270F512H) || defined(DEVICE_32MX270F512L) || defined(DEVICE_32MX340F512H) || defined(DEVICE_32MX360F512L) \
|| defined(DEVICE_32MX370F512H) || defined(DEVICE_32MX370F512L) || defined(DEVICE_32MX440F512H) || defined(DEVICE_32MX460F512L) \
|| defined(DEVICE_32MX470F512H) || defined(DEVICE_32MX470F512L) || defined(DEVICE_32MX570F512H) || defined(DEVICE_32MX570F512L) \
|| defined(DEVICE_32MX575F512H) || defined(DEVICE_32MX575F512L) || defined(DEVICE_32MX675F512H) || defined(DEVICE_32MX675F512L) \
|| defined(DEVICE_32MX695F512H) || defined(DEVICE_32MX695F512L) || defined(DEVICE_32MX775F512H) || defined(DEVICE_32MX775F512L) \
|| defined(DEVICE_32MX795F512H) || defined(DEVICE_32MX795F512L) || defined(DEVICE_32MZ0512EFE064) || defined(DEVICE_32MZ0512EFE100) \
|| defined(DEVICE_32MZ0512EFE124) || defined(DEVICE_32MZ0512EFE144) || defined(DEVICE_32MZ0512EFF064) || defined(DEVICE_32MZ0512EFF100) \
|| defined(DEVICE_32MZ0512EFF124) || defined(DEVICE_32MZ0512EFF144) || defined(DEVICE_32MZ0512EFK064) || defined(DEVICE_32MZ0512EFK100) \
|| defined(DEVICE_32MZ0512EFK124) || defined(DEVICE_32MZ0512EFK144)
# define NVM_SECTOR_END 0x1D07FFFF
#elif defined(DEVICE_32MK1024GPD064) || defined(DEVICE_32MK1024GPD100) || defined(DEVICE_32MK1024GPE064) || defined(DEVICE_32MK1024GPE100) \
|| defined(DEVICE_32MK1024GPK064) || defined(DEVICE_32MK1024GPK100) || defined(DEVICE_32MK1024MCF064) || defined(DEVICE_32MK1024MCF100) \
|| defined(DEVICE_32MK1024MCM064) || defined(DEVICE_32MK1024MCM100) || defined(DEVICE_32MZ1024ECG064) || defined(DEVICE_32MZ1024ECG100) \
|| defined(DEVICE_32MZ1024ECG124) || defined(DEVICE_32MZ1024ECG144) || defined(DEVICE_32MZ1024ECH064) || defined(DEVICE_32MZ1024ECH100) \
|| defined(DEVICE_32MZ1024ECH124) || defined(DEVICE_32MZ1024ECH144) || defined(DEVICE_32MZ1024ECM064) || defined(DEVICE_32MZ1024ECM100) \
|| defined(DEVICE_32MZ1024ECM124) || defined(DEVICE_32MZ1024ECM144) || defined(DEVICE_32MZ1024EFE064) || defined(DEVICE_32MZ1024EFE100) \
|| defined(DEVICE_32MZ1024EFE124) || defined(DEVICE_32MZ1024EFE144) || defined(DEVICE_32MZ1024EFF064) || defined(DEVICE_32MZ1024EFF100) \
|| defined(DEVICE_32MZ1024EFF124) || defined(DEVICE_32MZ1024EFF144) || defined(DEVICE_32MZ1024EFG064) || defined(DEVICE_32MZ1024EFG100) \
|| defined(DEVICE_32MZ1024EFG124) || defined(DEVICE_32MZ1024EFG144) || defined(DEVICE_32MZ1024EFH064) || defined(DEVICE_32MZ1024EFH100) \
|| defined(DEVICE_32MZ1024EFH124) || defined(DEVICE_32MZ1024EFH144) || defined(DEVICE_32MZ1024EFK064) || defined(DEVICE_32MZ1024EFK100) \
|| defined(DEVICE_32MZ1024EFK124) || defined(DEVICE_32MZ1024EFK144) || defined(DEVICE_32MZ1024EFM064) || defined(DEVICE_32MZ1024EFM100) \
|| defined(DEVICE_32MZ1024EFM124) || defined(DEVICE_32MZ1024EFM144) || defined(DEVICE_32MZ1025DAA169) || defined(DEVICE_32MZ1025DAA176) \
|| defined(DEVICE_32MZ1025DAA288) || defined(DEVICE_32MZ1025DAB169) || defined(DEVICE_32MZ1025DAB176) || defined(DEVICE_32MZ1025DAB288) \
|| defined(DEVICE_32MZ1025DAG169) || defined(DEVICE_32MZ1025DAG176) || defined(DEVICE_32MZ1025DAH169) || defined(DEVICE_32MZ1025DAH176) \
|| defined(DEVICE_32MZ1025DAK169) || defined(DEVICE_32MZ1025DAK176) || defined(DEVICE_32MZ1025DAL169) || defined(DEVICE_32MZ1025DAL176) \
|| defined(DEVICE_32MZ1025DAR169) || defined(DEVICE_32MZ1025DAR176) || defined(DEVICE_32MZ1025DAS169) || defined(DEVICE_32MZ1025DAS176) \
|| defined(DEVICE_32MZ1064DAA169) || defined(DEVICE_32MZ1064DAA176) || defined(DEVICE_32MZ1064DAA288) || defined(DEVICE_32MZ1064DAB169) \
|| defined(DEVICE_32MZ1064DAB176) || defined(DEVICE_32MZ1064DAB288) || defined(DEVICE_32MZ1064DAG169) || defined(DEVICE_32MZ1064DAG176) \
|| defined(DEVICE_32MZ1064DAH169) || defined(DEVICE_32MZ1064DAH176) || defined(DEVICE_32MZ1064DAK169) || defined(DEVICE_32MZ1064DAK176) \
|| defined(DEVICE_32MZ1064DAL169) || defined(DEVICE_32MZ1064DAL176) || defined(DEVICE_32MZ1064DAR169) || defined(DEVICE_32MZ1064DAR176) \
|| defined(DEVICE_32MZ1064DAS169) || defined(DEVICE_32MZ1064DAS176)
# define NVM_SECTOR_END 0x1D0FFFFF
#elif defined(DEVICE_32MZ2025DAA169) || defined(DEVICE_32MZ2025DAA176) || defined(DEVICE_32MZ2025DAA288) || defined(DEVICE_32MZ2025DAB169) \
|| defined(DEVICE_32MZ2025DAB176) || defined(DEVICE_32MZ2025DAB288) || defined(DEVICE_32MZ2025DAG169) || defined(DEVICE_32MZ2025DAG176) \
|| defined(DEVICE_32MZ2025DAH169) || defined(DEVICE_32MZ2025DAH176) || defined(DEVICE_32MZ2025DAK169) || defined(DEVICE_32MZ2025DAK176) \
|| defined(DEVICE_32MZ2025DAL169) || defined(DEVICE_32MZ2025DAL176) || defined(DEVICE_32MZ2025DAR169) || defined(DEVICE_32MZ2025DAR176) \
|| defined(DEVICE_32MZ2025DAS169) || defined(DEVICE_32MZ2025DAS176) || defined(DEVICE_32MZ2048ECG064) || defined(DEVICE_32MZ2048ECG100) \
|| defined(DEVICE_32MZ2048ECG124) || defined(DEVICE_32MZ2048ECG144) || defined(DEVICE_32MZ2048ECH064) || defined(DEVICE_32MZ2048ECH100) \
|| defined(DEVICE_32MZ2048ECH124) || defined(DEVICE_32MZ2048ECH144) || defined(DEVICE_32MZ2048ECM064) || defined(DEVICE_32MZ2048ECM100) \
|| defined(DEVICE_32MZ2048ECM124) || defined(DEVICE_32MZ2048ECM144) || defined(DEVICE_32MZ2048EFG064) || defined(DEVICE_32MZ2048EFG100) \
|| defined(DEVICE_32MZ2048EFG124) || defined(DEVICE_32MZ2048EFG144) || defined(DEVICE_32MZ2048EFH064) || defined(DEVICE_32MZ2048EFH100) \
|| defined(DEVICE_32MZ2048EFH124) || defined(DEVICE_32MZ2048EFH144) || defined(DEVICE_32MZ2048EFM064) || defined(DEVICE_32MZ2048EFM100) \
|| defined(DEVICE_32MZ2048EFM124) || defined(DEVICE_32MZ2048EFM144) || defined(DEVICE_32MZ2064DAA169) || defined(DEVICE_32MZ2064DAA176) \
|| defined(DEVICE_32MZ2064DAA288) || defined(DEVICE_32MZ2064DAB169) || defined(DEVICE_32MZ2064DAB176) || defined(DEVICE_32MZ2064DAB288) \
|| defined(DEVICE_32MZ2064DAG169) || defined(DEVICE_32MZ2064DAG176) || defined(DEVICE_32MZ2064DAH169) || defined(DEVICE_32MZ2064DAH176) \
|| defined(DEVICE_32MZ2064DAK169) || defined(DEVICE_32MZ2064DAK176) || defined(DEVICE_32MZ2064DAL169) || defined(DEVICE_32MZ2064DAL176) \
|| defined(DEVICE_32MZ2064DAR169) || defined(DEVICE_32MZ2064DAR176) || defined(DEVICE_32MZ2064DAS169) || defined(DEVICE_32MZ2064DAS176)
# define NVM_SECTOR_END 0x1D1FFFFF
#endif
// NVM_SIZE
#if defined(DEVICE_32MM0016GPL020) || defined(DEVICE_32MM0016GPL028) || defined(DEVICE_32MM0016GPL036) || defined(DEVICE_32MX110F016B) \
|| defined(DEVICE_32MX110F016C) || defined(DEVICE_32MX110F016D) || defined(DEVICE_32MX210F016B) || defined(DEVICE_32MX210F016C) \
|| defined(DEVICE_32MX210F016D)
# define NVM_SIZE 16384
#elif defined(DEVICE_32MM0032GPL020) || defined(DEVICE_32MM0032GPL028) || defined(DEVICE_32MM0032GPL036) || defined(DEVICE_32MX120F032B) \
|| defined(DEVICE_32MX120F032C) || defined(DEVICE_32MX120F032D) || defined(DEVICE_32MX220F032B) || defined(DEVICE_32MX220F032C) \
|| defined(DEVICE_32MX220F032D) || defined(DEVICE_32MX320F032H) || defined(DEVICE_32MX420F032H)
# define NVM_SIZE 32768
#elif defined(DEVICE_32MM0064GPL020) || defined(DEVICE_32MM0064GPL028) || defined(DEVICE_32MM0064GPL036) || defined(DEVICE_32MM0064GPM028) \
|| defined(DEVICE_32MM0064GPM036) || defined(DEVICE_32MM0064GPM048) || defined(DEVICE_32MM0064GPM064) || defined(DEVICE_32MX120F064H) \
|| defined(DEVICE_32MX130F064B) || defined(DEVICE_32MX130F064C) || defined(DEVICE_32MX130F064D) || defined(DEVICE_32MX230F064B) \
|| defined(DEVICE_32MX230F064C) || defined(DEVICE_32MX230F064D) || defined(DEVICE_32MX320F064H) || defined(DEVICE_32MX330F064H) \
|| defined(DEVICE_32MX330F064L) || defined(DEVICE_32MX430F064H) || defined(DEVICE_32MX430F064L) || defined(DEVICE_32MX534F064H) \
|| defined(DEVICE_32MX534F064L) || defined(DEVICE_32MX564F064H) || defined(DEVICE_32MX564F064L) || defined(DEVICE_32MX664F064H) \
|| defined(DEVICE_32MX664F064L)
# define NVM_SIZE 65536
#elif defined(DEVICE_32MK0128MCA028) || defined(DEVICE_32MK0128MCA032) || defined(DEVICE_32MK0128MCA048) || defined(DEVICE_32MM0128GPM028) \
|| defined(DEVICE_32MM0128GPM036) || defined(DEVICE_32MM0128GPM048) || defined(DEVICE_32MM0128GPM064) || defined(DEVICE_32MX130F128H) \
|| defined(DEVICE_32MX130F128L) || defined(DEVICE_32MX150F128B) || defined(DEVICE_32MX150F128C) || defined(DEVICE_32MX150F128D) \
|| defined(DEVICE_32MX154F128B) || defined(DEVICE_32MX154F128D) || defined(DEVICE_32MX230F128H) || defined(DEVICE_32MX230F128L) \
|| defined(DEVICE_32MX250F128B) || defined(DEVICE_32MX250F128C) || defined(DEVICE_32MX250F128D) || defined(DEVICE_32MX254F128B) \
|| defined(DEVICE_32MX254F128D) || defined(DEVICE_32MX320F128H) || defined(DEVICE_32MX320F128L) || defined(DEVICE_32MX340F128H) \
|| defined(DEVICE_32MX340F128L) || defined(DEVICE_32MX350F128H) || defined(DEVICE_32MX350F128L) || defined(DEVICE_32MX440F128H) \
|| defined(DEVICE_32MX440F128L) || defined(DEVICE_32MX450F128H) || defined(DEVICE_32MX450F128L) || defined(DEVICE_32MX530F128H) \
|| defined(DEVICE_32MX530F128L) || defined(DEVICE_32MX564F128H) || defined(DEVICE_32MX564F128L) || defined(DEVICE_32MX664F128H) \
|| defined(DEVICE_32MX664F128L) || defined(DEVICE_32MX764F128H) || defined(DEVICE_32MX764F128L)
# define NVM_SIZE 131072
#elif defined(DEVICE_32MK0256GPG048) || defined(DEVICE_32MK0256GPG064) || defined(DEVICE_32MK0256MCJ048) || defined(DEVICE_32MK0256MCJ064) \
|| defined(DEVICE_32MM0256GPM028) || defined(DEVICE_32MM0256GPM036) || defined(DEVICE_32MM0256GPM048) || defined(DEVICE_32MM0256GPM064) \
|| defined(DEVICE_32MX130F256B) || defined(DEVICE_32MX130F256D) || defined(DEVICE_32MX150F256H) || defined(DEVICE_32MX150F256L) \
|| defined(DEVICE_32MX170F256B) || defined(DEVICE_32MX170F256D) || defined(DEVICE_32MX174F256B) || defined(DEVICE_32MX174F256D) \
|| defined(DEVICE_32MX230F256B) || defined(DEVICE_32MX230F256D) || defined(DEVICE_32MX250F256H) || defined(DEVICE_32MX250F256L) \
|| defined(DEVICE_32MX270F256B) || defined(DEVICE_32MX270F256D) || defined(DEVICE_32MX274F256B) || defined(DEVICE_32MX274F256D) \
|| defined(DEVICE_32MX340F256H) || defined(DEVICE_32MX350F256H) || defined(DEVICE_32MX350F256L) || defined(DEVICE_32MX360F256L) \
|| defined(DEVICE_32MX440F256H) || defined(DEVICE_32MX450F256H) || defined(DEVICE_32MX450F256L) || defined(DEVICE_32MX460F256L) \
|| defined(DEVICE_32MX550F256H) || defined(DEVICE_32MX550F256L) || defined(DEVICE_32MX575F256H) || defined(DEVICE_32MX575F256L) \
|| defined(DEVICE_32MX675F256H) || defined(DEVICE_32MX675F256L) || defined(DEVICE_32MX775F256H) || defined(DEVICE_32MX775F256L)
# define NVM_SIZE 262144
#elif defined(DEVICE_32MK0512GPD064) || defined(DEVICE_32MK0512GPD100) || defined(DEVICE_32MK0512GPE064) || defined(DEVICE_32MK0512GPE100) \
|| defined(DEVICE_32MK0512GPG048) || defined(DEVICE_32MK0512GPG064) || defined(DEVICE_32MK0512GPK064) || defined(DEVICE_32MK0512GPK100) \
|| defined(DEVICE_32MK0512MCF064) || defined(DEVICE_32MK0512MCF100) || defined(DEVICE_32MK0512MCJ048) || defined(DEVICE_32MK0512MCJ064) \
|| defined(DEVICE_32MK0512MCM064) || defined(DEVICE_32MK0512MCM100) || defined(DEVICE_32MX170F512H) || defined(DEVICE_32MX170F512L) \
|| defined(DEVICE_32MX270F512H) || defined(DEVICE_32MX270F512L) || defined(DEVICE_32MX340F512H) || defined(DEVICE_32MX360F512L) \
|| defined(DEVICE_32MX370F512H) || defined(DEVICE_32MX370F512L) || defined(DEVICE_32MX440F512H) || defined(DEVICE_32MX460F512L) \
|| defined(DEVICE_32MX470F512H) || defined(DEVICE_32MX470F512L) || defined(DEVICE_32MX570F512H) || defined(DEVICE_32MX570F512L) \
|| defined(DEVICE_32MX575F512H) || defined(DEVICE_32MX575F512L) || defined(DEVICE_32MX675F512H) || defined(DEVICE_32MX675F512L) \
|| defined(DEVICE_32MX695F512H) || defined(DEVICE_32MX695F512L) || defined(DEVICE_32MX775F512H) || defined(DEVICE_32MX775F512L) \
|| defined(DEVICE_32MX795F512H) || defined(DEVICE_32MX795F512L) || defined(DEVICE_32MZ0512EFE064) || defined(DEVICE_32MZ0512EFE100) \
|| defined(DEVICE_32MZ0512EFE124) || defined(DEVICE_32MZ0512EFE144) || defined(DEVICE_32MZ0512EFF064) || defined(DEVICE_32MZ0512EFF100) \
|| defined(DEVICE_32MZ0512EFF124) || defined(DEVICE_32MZ0512EFF144) || defined(DEVICE_32MZ0512EFK064) || defined(DEVICE_32MZ0512EFK100) \
|| defined(DEVICE_32MZ0512EFK124) || defined(DEVICE_32MZ0512EFK144)
# define NVM_SIZE 524288
#elif defined(DEVICE_32MK1024GPD064) || defined(DEVICE_32MK1024GPD100) || defined(DEVICE_32MK1024GPE064) || defined(DEVICE_32MK1024GPE100) \
|| defined(DEVICE_32MK1024GPK064) || defined(DEVICE_32MK1024GPK100) || defined(DEVICE_32MK1024MCF064) || defined(DEVICE_32MK1024MCF100) \
|| defined(DEVICE_32MK1024MCM064) || defined(DEVICE_32MK1024MCM100) || defined(DEVICE_32MZ1024ECG064) || defined(DEVICE_32MZ1024ECG100) \
|| defined(DEVICE_32MZ1024ECG124) || defined(DEVICE_32MZ1024ECG144) || defined(DEVICE_32MZ1024ECH064) || defined(DEVICE_32MZ1024ECH100) \
|| defined(DEVICE_32MZ1024ECH124) || defined(DEVICE_32MZ1024ECH144) || defined(DEVICE_32MZ1024ECM064) || defined(DEVICE_32MZ1024ECM100) \
|| defined(DEVICE_32MZ1024ECM124) || defined(DEVICE_32MZ1024ECM144) || defined(DEVICE_32MZ1024EFE064) || defined(DEVICE_32MZ1024EFE100) \
|| defined(DEVICE_32MZ1024EFE124) || defined(DEVICE_32MZ1024EFE144) || defined(DEVICE_32MZ1024EFF064) || defined(DEVICE_32MZ1024EFF100) \
|| defined(DEVICE_32MZ1024EFF124) || defined(DEVICE_32MZ1024EFF144) || defined(DEVICE_32MZ1024EFG064) || defined(DEVICE_32MZ1024EFG100) \
|| defined(DEVICE_32MZ1024EFG124) || defined(DEVICE_32MZ1024EFG144) || defined(DEVICE_32MZ1024EFH064) || defined(DEVICE_32MZ1024EFH100) \
|| defined(DEVICE_32MZ1024EFH124) || defined(DEVICE_32MZ1024EFH144) || defined(DEVICE_32MZ1024EFK064) || defined(DEVICE_32MZ1024EFK100) \
|| defined(DEVICE_32MZ1024EFK124) || defined(DEVICE_32MZ1024EFK144) || defined(DEVICE_32MZ1024EFM064) || defined(DEVICE_32MZ1024EFM100) \
|| defined(DEVICE_32MZ1024EFM124) || defined(DEVICE_32MZ1024EFM144) || defined(DEVICE_32MZ1025DAA169) || defined(DEVICE_32MZ1025DAA176) \
|| defined(DEVICE_32MZ1025DAA288) || defined(DEVICE_32MZ1025DAB169) || defined(DEVICE_32MZ1025DAB176) || defined(DEVICE_32MZ1025DAB288) \
|| defined(DEVICE_32MZ1025DAG169) || defined(DEVICE_32MZ1025DAG176) || defined(DEVICE_32MZ1025DAH169) || defined(DEVICE_32MZ1025DAH176) \
|| defined(DEVICE_32MZ1025DAK169) || defined(DEVICE_32MZ1025DAK176) || defined(DEVICE_32MZ1025DAL169) || defined(DEVICE_32MZ1025DAL176) \
|| defined(DEVICE_32MZ1025DAR169) || defined(DEVICE_32MZ1025DAR176) || defined(DEVICE_32MZ1025DAS169) || defined(DEVICE_32MZ1025DAS176) \
|| defined(DEVICE_32MZ1064DAA169) || defined(DEVICE_32MZ1064DAA176) || defined(DEVICE_32MZ1064DAA288) || defined(DEVICE_32MZ1064DAB169) \
|| defined(DEVICE_32MZ1064DAB176) || defined(DEVICE_32MZ1064DAB288) || defined(DEVICE_32MZ1064DAG169) || defined(DEVICE_32MZ1064DAG176) \
|| defined(DEVICE_32MZ1064DAH169) || defined(DEVICE_32MZ1064DAH176) || defined(DEVICE_32MZ1064DAK169) || defined(DEVICE_32MZ1064DAK176) \
|| defined(DEVICE_32MZ1064DAL169) || defined(DEVICE_32MZ1064DAL176) || defined(DEVICE_32MZ1064DAR169) || defined(DEVICE_32MZ1064DAR176) \
|| defined(DEVICE_32MZ1064DAS169) || defined(DEVICE_32MZ1064DAS176)
# define NVM_SIZE 1048576
#elif defined(DEVICE_32MZ2025DAA169) || defined(DEVICE_32MZ2025DAA176) || defined(DEVICE_32MZ2025DAA288) || defined(DEVICE_32MZ2025DAB169) \
|| defined(DEVICE_32MZ2025DAB176) || defined(DEVICE_32MZ2025DAB288) || defined(DEVICE_32MZ2025DAG169) || defined(DEVICE_32MZ2025DAG176) \
|| defined(DEVICE_32MZ2025DAH169) || defined(DEVICE_32MZ2025DAH176) || defined(DEVICE_32MZ2025DAK169) || defined(DEVICE_32MZ2025DAK176) \
|| defined(DEVICE_32MZ2025DAL169) || defined(DEVICE_32MZ2025DAL176) || defined(DEVICE_32MZ2025DAR169) || defined(DEVICE_32MZ2025DAR176) \
|| defined(DEVICE_32MZ2025DAS169) || defined(DEVICE_32MZ2025DAS176) || defined(DEVICE_32MZ2048ECG064) || defined(DEVICE_32MZ2048ECG100) \
|| defined(DEVICE_32MZ2048ECG124) || defined(DEVICE_32MZ2048ECG144) || defined(DEVICE_32MZ2048ECH064) || defined(DEVICE_32MZ2048ECH100) \
|| defined(DEVICE_32MZ2048ECH124) || defined(DEVICE_32MZ2048ECH144) || defined(DEVICE_32MZ2048ECM064) || defined(DEVICE_32MZ2048ECM100) \
|| defined(DEVICE_32MZ2048ECM124) || defined(DEVICE_32MZ2048ECM144) || defined(DEVICE_32MZ2048EFG064) || defined(DEVICE_32MZ2048EFG100) \
|| defined(DEVICE_32MZ2048EFG124) || defined(DEVICE_32MZ2048EFG144) || defined(DEVICE_32MZ2048EFH064) || defined(DEVICE_32MZ2048EFH100) \
|| defined(DEVICE_32MZ2048EFH124) || defined(DEVICE_32MZ2048EFH144) || defined(DEVICE_32MZ2048EFM064) || defined(DEVICE_32MZ2048EFM100) \
|| defined(DEVICE_32MZ2048EFM124) || defined(DEVICE_32MZ2048EFM144) || defined(DEVICE_32MZ2064DAA169) || defined(DEVICE_32MZ2064DAA176) \
|| defined(DEVICE_32MZ2064DAA288) || defined(DEVICE_32MZ2064DAB169) || defined(DEVICE_32MZ2064DAB176) || defined(DEVICE_32MZ2064DAB288) \
|| defined(DEVICE_32MZ2064DAG169) || defined(DEVICE_32MZ2064DAG176) || defined(DEVICE_32MZ2064DAH169) || defined(DEVICE_32MZ2064DAH176) \
|| defined(DEVICE_32MZ2064DAK169) || defined(DEVICE_32MZ2064DAK176) || defined(DEVICE_32MZ2064DAL169) || defined(DEVICE_32MZ2064DAL176) \
|| defined(DEVICE_32MZ2064DAR169) || defined(DEVICE_32MZ2064DAR176) || defined(DEVICE_32MZ2064DAS169) || defined(DEVICE_32MZ2064DAS176)
# define NVM_SIZE 2097152
#endif
#ifdef __cplusplus
}
#endif
#endif // NVM_PIC32_H