/** * @brief Main program. * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured to 168 MHz, this is done through SystemInit() function which is called from startup file (startup_stm32f4xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f4xx.c file */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); #ifdef SERIAL_DEBUG /* Configure serial debugging. */ DebugComPort_Init(); #endif #ifdef DEBUG printf("\n\rSerial Port Initialized.\n\r"); #endif /* Enable the PWR APB1 Clock Interface */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); /* Allow access to BKP Domain */ PWR_BackupAccessCmd(ENABLE); if ((RTC_ReadBackupRegister(RTC_CONFIGURED_REG ) & RTC_CONFIGURED) != RTC_CONFIGURED) { #ifdef DEBUG printf("[Main] Configuring the RTC domain.\n\r"); #endif /* Initialize the RTC and Backup registers */ /* RTC_Config(); */ /* Setup date and time */ /* TODO: Set up date and time */ } else { /* Wait for RTC APB registers synchronization */ RTC_WaitForSynchro(); } /* Setup Watchdog debug leds */ /** * Check if the system has resumed from a WWDG reset */ if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST ) != RESET) { /* This is a watchdog reset */ /* Clear the reset flags */ RCC_ClearFlag(); /* Do any watchdog reset specific stuff here */ /* TODO: Watchdog reset specific handling */ } else { /* This is not a watchdog reset */ /* Do any normal reset stuff here */ if (RCC_GetFlagStatus(RCC_FLAG_SFTRST )) { /* Software reset */ } else if (RCC_GetFlagStatus(RCC_FLAG_PORRST )) { /* Power on Reset/Power down reset */ } else if (RCC_GetFlagStatus(RCC_FLAG_PINRST )) { /* Reset pin reset */ } else { /* Some other reset */ } } /* Clear the reset flags */ RCC_ClearFlag(); /* Initialize the Tekdaqc's peripheral hardware */ Tekdaqc_Init(); Init_Locator(); if (InitializeTelnetServer() == TELNET_OK) { CreateCommandInterpreter(); program_loop(); } else { /* We have a fatal error */ /* Reset the board */ NVIC_SystemReset(); } return 0; }
int main(int argc, char *argv[]) { program_loop(); return 0; }