/** * @brief main * Main routine for IAP application * @param None * @retval int */ int main(void) { /* STM32 evalboard user initialization */ BSP_Init(); /* Flash unlock */ FLASH_If_FlashUnlock(); /* Test if User button on the Discovery kit is pressed */ if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_RESET) { /* Check Vector Table: Test if user code is programmed starting from address "APPLICATION_ADDRESS" */ if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000) { /* Jump to user application */ JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); Jump_To_Application(); } } /* Init Host Library */ USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks); while (1) { /* Host Task handler */ USBH_Process(&USB_OTG_Core, &USB_Host); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Unlock the Flash to enable the flash control register access */ FLASH_If_FlashUnlock(); /* Test if User button on the STM324x9I_EVAL is pressed */ if (BSP_PB_GetState(BUTTON_KEY) != GPIO_PIN_RESET) { /* Check Vector Table: Test if user code is programmed starting from address "APPLICATION_ADDRESS" */ if ((((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFF000000 ) == 0x20000000) || \ (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFF000000 ) == 0x10000000)) { /* Jump to user application */ JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); Jump_To_Application(); } } /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 168 MHz */ SystemClock_Config(); /* Init FW upgrade Application */ FW_InitApplication(); /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); /* Run Application (Blocking mode)*/ while (1) { /* USB Host Background task */ USBH_Process(&hUSBHost); /* FW Menu Process */ FW_UPGRADE_Process(); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Unlock the Flash to enable the flash control register access */ FLASH_If_FlashUnlock(); /* Test if User button on the STM32446E_EVAL is pressed */ if (BSP_PB_GetState(BUTTON_KEY) != GPIO_PIN_SET) { /* Check Vector Table: Test if user code is programmed starting from address "APPLICATION_ADDRESS" */ if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFF000000 ) == 0x20000000) { /* Jump to user application */ JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); Jump_To_Application(); } } /* STM32F446xx HAL library initialization */ HAL_Init(); /* Configure the system clock to 180 Mhz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* Init FW upgrade Application */ FW_InitApplication(); /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); /* Run Application (Blocking mode)*/ while (1) { /* USB Host Background task */ USBH_Process(&hUSBHost); /* FW Menu Process */ FW_UPGRADE_Process(); } }