找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 500|回复: 2
收起左侧

STM32单片机bootloader IAP升级例程

[复制链接]
ID:1109580 发表于 2024-1-18 12:32 | 显示全部楼层 |阅读模式
基于STM32F103ZET6芯片,实际使用没有问题

单片机源程序如下:
  1. /** @addtogroup IAP
  2.   * @{
  3.   */

  4. /* Includes ------------------------------------------------------------------*/
  5. #include "common.h"
  6. #include "bsp.h"
  7. #include "cortexm3_macro.h"

  8. /* Private typedef -----------------------------------------------------------*/
  9. /* Private define ------------------------------------------------------------*/
  10. /* Private macro -------------------------------------------------------------*/
  11. /* Private variables ---------------------------------------------------------*/


  12. /* Private function prototypes -----------------------------------------------*/




  13. /*******************************************************************************
  14. * Function Name  : main
  15. * Description    : Main program.
  16. * Input          : None
  17. * Output         : None
  18. * Return         : None
  19. *******************************************************************************/
  20. int main(void)
  21. {
  22.     u8 flg = 0;

  23. #ifdef DEBUG
  24.     debug();
  25. #endif
  26.    
  27.     BspInit();
  28.     CommonInit();

  29.     while (1)
  30.     {
  31.         CommonExec();
  32.         
  33.         if (IS_TIMEOUT_1MS(eTim1, 1000))
  34.         {
  35.             flg? LedOn(LED_5) : LedOff(LED_5);
  36.             flg = !flg;
  37.         }
  38.     }
  39. }

  40. #ifdef  DEBUG
  41. /*******************************************************************************
  42. * Function Name  : assert_failed
  43. * Description    : Reports the name of the source file and the source line number
  44. *                  where the assert_param error has occurred.
  45. * Input          : - file: pointer to the source file name
  46. *                  - line: assert_param error line source number
  47. * Output         : None
  48. * Return         : None
  49. *******************************************************************************/
  50. void assert_failed(u8* file, u32 line)
  51. {
  52.   /* User can add his own implementation to report the file name and line number,
  53.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  54.   /* Infinite loop */
  55.   while (1)
  56.   {
  57.   }
  58. }
  59. #endif
复制代码

原理图: 无
仿真: 无
代码(仅供参考,有错误请指出): bootloader.7z (198.05 KB, 下载次数: 20)

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

回复

使用道具 举报

ID:164385 发表于 2024-1-25 23:11 | 显示全部楼层
很好的介绍,谢谢了
回复

使用道具 举报

ID:18591 发表于 2024-2-2 09:50 | 显示全部楼层
非常好,谢谢楼主
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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