找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 1522|回復(fù): 2
打印 上一主題 下一主題
收起左側(cè)

STM32單片機(jī)bootloader IAP升級(jí)例程

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
#
ID:1109580 發(fā)表于 2024-1-18 12:32 | 只看該作者 回帖獎(jiǎng)勵(lì) |正序?yàn)g覽 |閱讀模式
基于STM32F103ZET6芯片,實(shí)際使用沒有問題

單片機(jī)源程序如下:
  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
復(fù)制代碼

原理圖: 無
仿真: 無
代碼(僅供參考,有錯(cuò)誤請(qǐng)指出): bootloader.7z (198.05 KB, 下載次數(shù): 28)

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏3 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:18591 發(fā)表于 2024-2-2 09:50 | 只看該作者
非常好,謝謝樓主
回復(fù)

使用道具 舉報(bào)

樓主
ID:164385 發(fā)表于 2024-1-25 23:11 | 只看該作者
很好的介紹,謝謝了
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表