int main(void) { uint32_t suffix[4]; /* disable watchdog */ AVR32_WDT.ctrl = (0x55 << AVR32_WDT_CTRL_KEY_OFFSET); AVR32_WDT.ctrl = (0xaa << AVR32_WDT_CTRL_KEY_OFFSET); interruptsInit(); interruptsDisable(); clocksInit(); flashEraseAllFuses(); flashEraseWrite((void *) update_data_start, update_data, update_data_length); memset(suffix, 0xff, sizeof(suffix)); flashEraseWrite((void *) ((uint32_t) _FlashAppStart + (uint32_t) _FlashAppLength - sizeof(suffix)), suffix, sizeof(suffix)); flashWriteAllFuses(CONFIG_GP_FUSES); utilsReboot(0, UTILS_REBOOT_MODE_LOADER); return 0; /* not reached */ }
int main(void) { clocksInit(); systickInit(); chSysInit(); gpioConfig(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN, GPIO_OUTPUT | GPIO_LOW); gpioConfig(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN, GPIO_OUTPUT | GPIO_LOW); chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); hwInterruptsEnable(); while (TRUE) { chThdSleepMilliseconds(123); gpioToggle(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN); } return 0; }