久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

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

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 4164|回復(fù): 5
收起左側(cè)

STM8s的IAP升級(jí)源程序 bootloader與APP

  [復(fù)制鏈接]
ID:125378 發(fā)表于 2019-10-9 17:36 | 顯示全部樓層 |閱讀模式
測(cè)試有效,僅供參考

單片機(jī)源程序如下:
  1. /*****
  2. Copyright 2016-2020 Alex.Fang  All rights reserved.

  3. Header:   stm8s105c6t6 IAP code
  4. File Name: main.c
  5. Author: Alex.Fang
  6. Date: 2016-07-22

  7. 免責(zé)聲明:
  8. 此代碼你可以用來(lái)學(xué)習(xí)和交流。不得商用!應(yīng)用此程序釀成事故由你自己承擔(dān)!
  9. 本人不負(fù)責(zé)維護(hù)和支持此代碼!如有疑問(wèn)和看不懂別來(lái)煩我!  ^_^
  10. openedv論壇好友可以隨便下載和轉(zhuǎn)給他人參閱學(xué)習(xí)。
  11. 版權(quán)遵循 = GPL

  12. Disclaimer of liability:
  13. This code you can use to learn and communicate. No commercial!
  14. Use this procedure to cause accidents by yourself!
  15. I am not responsible for the maintenance and support of this code!
  16. If you have any questions and cannot read don't bother me! ^_^
  17. Openedv forum friends can easily download and
  18. transfer to other people see learning.
  19. copyright = GPL

  20. ********/


  21. /* Includes ------------------------------------------------------------------*/

  22. #include <string.h>
  23. #include <stdio.h>
  24. #include "stm8s.h"
  25. #include "stm8s_clk.h"
  26. #include "main.h"
  27. //#include "stm8s_wwdg.h"
  28. #include "delay.h"
  29. #include "flash.h"
  30. #include "stm8s_flash.h"

  31. #include "config.h"
  32. #include "IO_config.h"

  33. #include "crc16.h"
  34. #include "xmodem.h"

  35. #include "stm8s_uart2.h"

  36. #include "uart2.h"
  37. //#include "stm8s_tim2.h"

  38. //#include "wwdg.h"

  39. //#define NGI()     _asm("sim");    /* 禁止全局中斷 */
  40. //#define EGI()     _asm("rim");    /* 使能全局中斷 */
  41. //#define WFI()     _asm("halt");   /*進(jìn)入到低功耗模 WFI */


  42. /* Private defines -----------------------------------------------------------*/
  43. /* Private function prototypes -----------------------------------------------*/
  44. /* Private functions ---------------------------------------------------------*/

  45. //address for GO command
  46. //TFunction GoAddress;



  47. void STM8_CLK_Init(void)
  48. {
  49.                 CLK_DeInit();//復(fù)位時(shí)鐘寄存器
  50.     CLK_HSICmd(ENABLE);//HSI = 16MHz
  51.     CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); //f_psc = 16MHz/1
  52.                
  53.                 //CLK_ClockSecuritySystemEnable();//開(kāi)啟時(shí)鐘安全系統(tǒng)
  54.     //enableInterrupts();
  55. }


  56. void system_init(void)
  57. {
  58.         STM8_CLK_Init();
  59.         FLASH_DeInit();
  60.         Init_GPIO();
  61.         Init_UART2();

  62. }


  63. void main(void)
  64. {        
  65.   //_asm("sim");//關(guān)全部中斷
  66.         
  67.         disableInterrupts();
  68.         system_init();
  69.         //_asm("rim");//開(kāi)全部中斷
  70.         enableInterrupts();
  71.         
  72.         
  73.         uart2_data("\r\n\r\n",4);
  74.         uart2_data("Bootloader Start...\r\n",21);        
  75.         uart2_data("Ver=20160722_1.0\r\n",18);
  76.         disableInterrupts();
  77.         

  78.         //unlock_PROG();        
  79.   //unlock_DATA();
  80.         
  81.         //Print("goto app...\r\n");
  82.         //goto_app();        
  83.         //Print("Failed!\r\n");
  84.         //waiting_time_count=200;
  85.   Xmoden_STate = IDLE;
  86.         //RS232_Tran_Chr(NAK);
  87.         disp_menu();
  88.   while (1)
  89.   {
  90.                 RS232_ISR();
  91.                 RS232_Rec_Xmodem();
  92.                
  93.   }//end while
  94.   
  95. }
復(fù)制代碼

所有資料51hei提供下載:
bootloader.7z (3.99 MB, 下載次數(shù): 86)

評(píng)分

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

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

ID:642557 發(fā)表于 2019-11-16 17:04 | 顯示全部樓層
感謝分享
回復(fù)

使用道具 舉報(bào)

ID:642557 發(fā)表于 2019-11-17 12:36 | 顯示全部樓層
能簡(jiǎn)單說(shuō)一下如何使用嗎?
回復(fù)

使用道具 舉報(bào)

ID:125378 發(fā)表于 2019-11-26 15:44 | 顯示全部樓層
jeeseliu 發(fā)表于 2019-11-17 12:36
能簡(jiǎn)單說(shuō)一下如何使用嗎?

先把BootLoader1程序燒進(jìn)板子,然后用上位機(jī)給MCU發(fā)送APP代碼,讓mcu自己寫(xiě)進(jìn)flash里面去執(zhí)行
回復(fù)

使用道具 舉報(bào)

ID:50961 發(fā)表于 2020-1-5 15:51 | 顯示全部樓層
上位機(jī)工具有提供嗎?
回復(fù)

使用道具 舉報(bào)

ID:281113 發(fā)表于 2020-6-19 19:57 | 顯示全部樓層
學(xué)習(xí)了!
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

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

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

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 在线看亚洲 | 亚洲国产精品一区二区三区 | 免费观看av | 亚洲国产成人精品女人久久久野战 | 久久伊人影院 | 爱操影视 | 中文字幕11页 | 99re热这里只有精品视频 | 成人视屏在线观看 | 国产一区二区美女 | 一区二区三区国产好的精 | 国产高清无av久久 | 我想看一级黄色毛片 | 亚洲精品一区av在线播放 | 国产美女特级嫩嫩嫩bbb片 | 国产清纯白嫩初高生在线播放视频 | 成人妇女免费播放久久久 | 69热视频在线观看 | 欧美三级三级三级爽爽爽 | 日韩乱码av | 色综合天天天天做夜夜夜夜做 | 亚洲情综合五月天 | 日p视频免费看 | 国产亚洲一区二区精品 | 久久99精品久久久久久国产越南 | 综合久久av | 亚洲精品一区二区在线观看 | 日韩爱爱网 | 精品99在线 | 91毛片在线看 | 黄色毛片免费 | 午夜小影院 | 久久com | 嫩草视频在线免费观看 | 麻豆精品国产91久久久久久 | 精品国产91亚洲一区二区三区www | 91精品一区二区 | 午夜成人免费视频 | 91av在线看 | 卡通动漫第一页 | 久久久久亚洲av毛片大全 |