找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4013|回复: 4
收起左侧

STM32F1 SD卡升级用户代码 bootloader_IAP

  [复制链接]
ID:320543 发表于 2018-5-2 16:12 | 显示全部楼层 |阅读模式
SD卡升级具体看代码 , 以后还有U盘升级, 远程升级等
bootloader_iap_sd

单片机源程序如下:
  1. /*************************************************************
  2. *************************************************************/

  3. #include "includes.h"


  4. extern pFunction Jump_To_Application;
  5. extern uint32_t JumpAddress;

  6. /* Private function prototypes -----------------------------------------------*/


  7. /* Private functions ---------------------------------------------------------*/


  8. /*******************************************************************************
  9. * @brief  Main program.
  10. * @param  None
  11. * @retval None
  12. *******************************************************************************/
  13. unsigned int key_flag = 0;
  14. int main(void)
  15. {
  16.         GPIO_InitTypeDef GPIO_InitStructure;       
  17.   //Flash解锁
  18.         FLASH_Unlock();       
  19.   //Test if Key push-button on STM3210X-EVAL Board is pressed
  20.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);//       
  21.         GPIO_InitStructure.GPIO_Pin  = GPIO_Pin_5;//PA5
  22.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //
  23.         GPIO_Init(GPIOA, &GPIO_InitStructure);//
  24.        
  25.         key_flag = GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_5);
  26.        
  27.   /* 如果按键按下, 执行IAP驱动程序更新Flash程序 */
  28.   if (!key_flag)
  29.   {
  30.                 //串口初始化
  31.     BSP_Init();
  32.     SerialPutString("\r\n======================================================================");
  33.                 SerialPutString("\r\n                .\"\".    .\"\",");
  34.                 SerialPutString("\r\n                |  |   /  /");
  35.                 SerialPutString("\r\n                |  |  /  /");
  36.                 SerialPutString("\r\n                |  | /  /");
  37.                 SerialPutString("\r\n                |  |/  ;-._ ");
  38.                 SerialPutString("\r\n                }  ` _/  / ;");
  39.                 SerialPutString("\r\n                |  /` ) /  /");
  40.                 SerialPutString("\r\n                | /  /_/\\_/\\");
  41.                 SerialPutString("\r\n                |/  /      |");
  42.                 SerialPutString("\r\n                (  ' \\ '-  |");
  43.                 SerialPutString("\r\n                 \\    `.  /");
  44.                 SerialPutString("\r\n                  |      |");
  45.                 SerialPutString("\r\n                  |      |");
  46.                 SerialPutString("\r\n=                               Bootloader for STM32F10X  v1.0.1     =");
  47.                 SerialPutString("\r\n=                               COPYRIGHT@2012     Wanwei Tech       =");
  48.     SerialPutString("\r\n======================================================================");
  49.     SerialPutString("\r\n\r\n");
  50.     Main_Menu ();
  51.   }
  52.   else       
  53.         {  
  54.                 IAP_JumpToApplication();  /* 执行用户程序 */
  55.         }
  56.        
  57.   while (1)
  58.   {
  59.         }
  60. }


  61. #ifdef  USE_FULL_ASSERT
  62. /*******************************************************************************
  63. * @brief                Reports the name of the source file and the source line number
  64. *                                 where the CHECK_PARAM error has occurred.
  65. * @param[in]        file Pointer to the source file name
  66. * @param[in]    line assert_param error line source number
  67. * @return                None
  68. *******************************************************************************/
  69. void assert_failed(uint8_t* file, uint32_t line)
  70. {
  71.         printf("Wrong parameters value: file %s on line %d\r\n", file, line);
  72. //while(1);
  73. }
  74. #endif /* USE_FULL_ASSERT */


  75. /**
  76.   * @}
  77.   */

  78. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
复制代码

所有资料51hei提供下载:
bootloader_iap_sd.rar (1.16 MB, 下载次数: 177)
回复

使用道具 举报

ID:445582 发表于 2019-2-27 15:42 | 显示全部楼层
F1系列小容量和中容量貌似没有SDIO接口啊
回复

使用道具 举报

ID:130559 发表于 2019-4-9 16:33 | 显示全部楼层
程序占用了19K的ROM啊,从3000开始跑APP程序会不会不够啊
回复

使用道具 举报

ID:297069 发表于 2020-5-2 14:43 | 显示全部楼层
谢谢分享
回复

使用道具 举报

ID:59363 发表于 2021-7-28 15:26 | 显示全部楼层
试试好不好用
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表