Arduino Due's IAP Routine


I’m trying to access the IAP routine on the Due using the Arduino IDE.

The Atmel documentation for SAM3x (doc11057.pdf) states the following code:

(unsigned int) (*IAP_Function)(unsigned long);
void main (void){
unsigned long FlashSectorNum = 200; //
unsigned long flash_cmd = 0;
unsigned long flash_status = 0;
unsigned long EFCIndex = 0; // 0:EEFC0, 1: EEFC1
/* Initialize the function pointer (retrieve function address from NMI
vector) */
IAP_Function = ((unsigned long) (*)(unsigned long)) 0x00800008;
/* Send your data to the sector here */
/* build the command to send to EEFC */
flash_cmd = (0x5A << 24) | (FlashSectorNum << 8) | AT91C_MC_FCMD_EWP;
/* Call the IAP function with appropriate command */
flash_status = IAP_Function (EFCIndex, flash_cmd);

Now I understand that the function’s NMI address is 0x00800008 and the code accesses the function from the address. How can I implement a similar code in the Arduino IDE?


You need to get this thread move to the DUE's own forum.