ERMsg CWeatherUpdate::Execute(const CFileManager& fileManager, CCallback& callback) { ERMsg msg; string filePath; msg = GetFM().WeatherUpdate().GetFilePath(m_fileTitle, filePath); if (msg) { //try to open log string logFilePath(filePath); SetFileExtension(logFilePath, ".log"); callback.PushTask("Call WeatherUpdater...", NOT_INIT); msg = CallApplication(CRegistry::WEATHER_UPDATER, "\"" + filePath + "\" -e -l \"" + logFilePath + (m_bShowApp ? "\" -Show" : "\""), NULL, m_bShowApp ? SW_SHOW : SW_HIDE, false, true); if (msg) { ifStream log; if (log.open(logFilePath)) callback.AddMessage(log.GetText()); } callback.PopTask(); } return msg; }
void main(void) { if(CheckForceUpdate()) { HandleUpdate(); } else { CallApplication(); } }
//***************************************************************************** // // Main entry point for the USB stick update example. // // This function will check to see if a flash update should be performed from // the USB memory stick, or if the user application should just be run without // any update. // // The following checks are made, any of which mean that an update should be // performed: // - the PC and SP for the user app do not appear to be valid // - a memory location contains a certain value, meaning the user app wants // to force an update // - the user button on the eval board is being pressed, meaning the user wants // to force an update even if there is a valid user app in memory // // If any of the above checks are true, then that means that an update should // be attempted. The USB stick updater will then wait for a USB stick to be // plugged in, and once it is look for a firmware update file. // // If none of the above checks are true, then the user application that is // already in flash is run and no update is performed. // // \return None. // //***************************************************************************** int main(void) { uint32_t *pui32App; // // See if the first location is 0xfffffffff or something that does not // look like a stack pointer, or if the second location is 0xffffffff or // something that does not look like a reset vector. // pui32App = (uint32_t *)APP_START_ADDRESS; if((pui32App[0] == 0xffffffff) || ((pui32App[0] & 0xfff00000) != 0x20000000) || (pui32App[1] == 0xffffffff) || ((pui32App[1] & 0xfff00001) != 0x00000001)) { // // App starting stack pointer or PC is not valid, so force an update. // UpdaterMain(); } // // Check to see if the application has requested an update // if(HWREG(FORCE_UPDATE_ADDR) == FORCE_UPDATE_VALUE) { HWREG(FORCE_UPDATE_ADDR) = 0; UpdaterMain(); } // // Enable the GPIO input for the user button. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM); ROM_GPIODirModeSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN); ROM_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); // // Check if the button is pressed, if so then force an update. // if(ROM_GPIOPinRead(GPIO_PORTM_BASE, GPIO_PIN_4) == 0) { UpdaterMain(); } // // If we get to here that means that none of the conditions that should // cause an update are true. Therefore, call the application. // CallApplication(APP_START_ADDRESS); }