SD卡升级具体看代码 , 以后还有U盘升级, 远程升级等
bootloader_iap_sd
单片机源程序如下:
- /*************************************************************
- *************************************************************/
- #include "includes.h"
- extern pFunction Jump_To_Application;
- extern uint32_t JumpAddress;
- /* Private function prototypes -----------------------------------------------*/
- /* Private functions ---------------------------------------------------------*/
- /*******************************************************************************
- * @brief Main program.
- * @param None
- * @retval None
- *******************************************************************************/
- unsigned int key_flag = 0;
- int main(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- //Flash解锁
- FLASH_Unlock();
- //Test if Key push-button on STM3210X-EVAL Board is pressed
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);//
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;//PA5
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //
- GPIO_Init(GPIOA, &GPIO_InitStructure);//
-
- key_flag = GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_5);
-
- /* 如果按键按下, 执行IAP驱动程序更新Flash程序 */
- if (!key_flag)
- {
- //串口初始化
- BSP_Init();
- SerialPutString("\r\n======================================================================");
- SerialPutString("\r\n .\"\". .\"\",");
- SerialPutString("\r\n | | / /");
- SerialPutString("\r\n | | / /");
- SerialPutString("\r\n | | / /");
- SerialPutString("\r\n | |/ ;-._ ");
- SerialPutString("\r\n } ` _/ / ;");
- SerialPutString("\r\n | /` ) / /");
- SerialPutString("\r\n | / /_/\\_/\\");
- SerialPutString("\r\n |/ / |");
- SerialPutString("\r\n ( ' \\ '- |");
- SerialPutString("\r\n \\ `. /");
- SerialPutString("\r\n | |");
- SerialPutString("\r\n | |");
- SerialPutString("\r\n= Bootloader for STM32F10X v1.0.1 =");
- SerialPutString("\r\n= COPYRIGHT@2012 Wanwei Tech =");
- SerialPutString("\r\n======================================================================");
- SerialPutString("\r\n\r\n");
- Main_Menu ();
- }
- else
- {
- IAP_JumpToApplication(); /* 执行用户程序 */
- }
-
- while (1)
- {
- }
- }
- #ifdef USE_FULL_ASSERT
- /*******************************************************************************
- * @brief Reports the name of the source file and the source line number
- * where the CHECK_PARAM error has occurred.
- * @param[in] file Pointer to the source file name
- * @param[in] line assert_param error line source number
- * @return None
- *******************************************************************************/
- void assert_failed(uint8_t* file, uint32_t line)
- {
- printf("Wrong parameters value: file %s on line %d\r\n", file, line);
- //while(1);
- }
- #endif /* USE_FULL_ASSERT */
- /**
- * @}
- */
- /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
复制代码
所有资料51hei提供下载:
bootloader_iap_sd.rar
(1.16 MB, 下载次数: 183)
|