28.2.71 __builtin_write_NVM_secure
Description
Enables the Flash for writing by issuing an unlock sequence specified by two keys and enabling the Write bit of the NVMCON register. After completion, the two keys are cleared to zero.
Interrupts may need to be disabled for proper operation.
This builtin
function can be used as a part of a complex sequence
discussed in your device data sheet or Family Reference Manual (FRM). See these
documents for more information.
Prototype
void __builtin_write_NVM_secure(unsigned int key1, unsigned int
key2);
Argument
key1
– first key in the NVM unlock sequence
key2
– second key in the NVM unlock sequence
Return Value
None
Assembler Operator/ Machine Instruction
Depending on the location of the keys:
mov W0, Wn
mov Wn, _NVMKEY
mov W1, Wn
mov Wn, _NVMKEY
bset _NVMCON, #15
nop
nop
Error Messages
None