Go Down

Topic: Arduino Due's IAP Routine (Urgent) (Read 386 times) previous topic - next topic

emmhaych

Hi,

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:

Code: [Select]
(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?

Thanks,
EmmHaych

Moderator: Apologies, I'm new here and posted this earlier in the wrong forum. Would appreciate if you could delete it from there (http://forum.arduino.cc/index.php?topic=177593.0).

Go Up