void DueFlashStorage::setGPNVMBootMode(bool mode) { //SerialUSB.println("About to set how to boot"); __disable_irq(); //flash_clear_gpnvm(1); //boot from ROM for testing flash_set_gpnvm(1); //boot from Flash for production //SerialUSB.print("Set GPNVM Mode to "); //SerialUSB.println(mode); if (mode) flash_set_gpnvm(2); else flash_clear_gpnvm(2); //I think that this becomes active IMMEDIATELY so the sketch will pretty much be guaranteed to crash after this is run. __enable_irq(); }
/** * \brief Set security bit. * * \return 0 if successful; otherwise returns an error code. */ uint32_t flash_enable_security_bit(void) { return flash_set_gpnvm(0); }