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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

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

stm32f107智嵌以太網(wǎng)IAP遠(yuǎn)程更新附源代碼和說明文件

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
附IAP遠(yuǎn)程更新源代碼和說明文件




單片機(jī)源程序如下:

  1. /* Includes ------------------------------------------------------------------*/
  2. #include "stm32_eth.h"
  3. #include "netconf.h"
  4. #include "main.h"
  5. #include "helloworld.h"
  6. #include "httpd.h"
  7. #include "tftpserver.h"
  8. #include "KEY.H"
  9. #include "stdio.h"
  10. #include "bkp.h"
  11. #include "LED.H"

  12. /* Private typedef -----------------------------------------------------------*/
  13. /* Private define ------------------------------------------------------------*/
  14. #define SYSTEMTICK_PERIOD_MS  10

  15. #ifdef __GNUC__
  16.   /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
  17.      set to 'Yes') calls __io_putchar() */
  18.   #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
  19. #else
  20.   #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
  21. #endif /* __GNUC__ */

  22. /* Private macro -------------------------------------------------------------*/
  23. /* Private variables ---------------------------------------------------------*/
  24. __IO uint32_t LocalTime = 0; /* this variable is used to create a time reference incremented by 10ms */
  25. uint32_t timingdelay;

  26. typedef  void (*pFunction)(void);
  27. pFunction Jump_To_User_Application;
  28. uint32_t Jump_User_Address;

  29. /* Private function prototypes -----------------------------------------------*/
  30. void System_Periodic_Handle(void);
  31. void IAP_httpd_init(void);
  32. void IAP_tftpd_init(void);
  33. void MY_NVIC_Configuration(void);
  34. void NVIC_DeInit(void);
  35. void BKP_Configuration(void);
  36. void MCU_Reset(void);
  37. void EARES_SRAM(void);
  38. void NVIC_Configuration(void);
  39. /* Private functions ---------------------------------------------------------*/

  40. /**
  41.   * @brief  Main program.
  42.   * @param  None
  43.   * @retval None
  44.   */

  45.         
  46. int main(void)
  47. {
  48.         unsigned int g_bUpdateFlag = 0;

  49.         NVIC_DeInit();
  50.         RCC_DeInit();        
  51.         SystemInit();
  52.         BKP_Configuration();
  53.         NVIC_Configuration();

  54.         SEI(); //開全局中斷

  55.         g_bUpdateFlag = BKP_ReadBackupRegister(BKP_DR9);  //讀取更新標(biāo)志
  56.         //if(!(KEY1 | KEY2 | KEY3 | KEY4)
  57.         if(g_bUpdateFlag  == 0x0)     //不需要升級(jí),
  58.         {  
  59.                 /* Check if valid stack address (RAM address) then jump to user application */
  60.                 if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
  61.                 {
  62.                         CLI();                        //關(guān)閉總中斷,必須有、
  63.                         NVIC_DeInit();
  64.                         RCC_DeInit();
  65.                         /* Jump to user application */
  66.                         Jump_User_Address = *(__IO uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4);
  67.                         Jump_To_User_Application = (pFunction) Jump_User_Address;
  68.                         /* Initialize user application's Stack Pointer */
  69.                         __set_MSP(*(__IO uint32_t*) USER_FLASH_FIRST_PAGE_ADDRESS);
  70.                         Jump_To_User_Application();
  71.                         while (1);
  72.                 }
  73.                 else
  74.                 {
  75.                         //printf("非法SRAM\n");
  76.                 }
  77.         }
  78.    
  79.    else         //初始化網(wǎng)絡(luò)模塊,等待用戶遠(yuǎn)程登錄,更新固件
  80.    {
  81.                 /* Setup STM32 system (clocks, Ethernet, GPIO, NVIC) and STM3210C-EVAL resources */
  82.                 BKP_WriteBackupRegister(BKP_DR9,0x00);// 標(biāo)志已經(jīng)下載了程序了
  83.                 System_Setup();
  84.                 /* Initilaize the LwIP satck ip地址設(shè)置,mac設(shè)置,*/

  85.                 LwIP_Init();
  86.                
  87.                 IAP_httpd_init();
  88.                 /* Infinite loop */
  89.                 while (1)
  90.                 {   
  91.                       /* Periodic tasks */
  92.                     System_Periodic_Handle();
  93.                 }
  94.         }
  95. }

  96. void MCU_Reset(void)
  97. {
  98.         __disable_fault_irq();      // STM32 軟復(fù)位  
  99.         NVIC_SystemReset();
  100. }

  101. PUTCHAR_PROTOTYPE
  102. {
  103.   /* Place your implementation of fputc here */
  104.   /* e.g. write a character to the USART */
  105.   USART_SendData(USART2, (uint8_t) ch);

  106.   /* Loop until the end of transmission */
  107.   while (USART_GetFlagStatus(USART2, USART_FLAG_TC) == RESET)
  108.   {}

  109.   return ch;
  110. }
  111. /**
  112.   * @brief  Inserts a delay time.
  113.   * @param  nCount: number of 10ms periods to wait for.
  114.   * @retval None
  115.   */
  116. void Delay(uint32_t nCount)
  117. {
  118.   /* Capture the current local time */
  119.   timingdelay = LocalTime + nCount;  

  120.   /* wait until the desired delay finish */  
  121.   while(timingdelay > LocalTime)
  122.   {     
  123.   }
  124. }

  125. /**
  126.   * @brief  Updates the system local time
  127.   * @param  None
  128.   * @retval None
  129.   */
  130. void Time_Update(void)
  131. {
  132.   LocalTime += SYSTEMTICK_PERIOD_MS;
  133. }


  134. /**
  135.   * @brief  Handles the periodic tasks of the system
  136.   * @param  None
  137.   * @retval None
  138.   */
  139. void System_Periodic_Handle(void)
  140. {
  141.   /* Update the LCD display and the LEDs status */
  142.   /* Manage the IP address setting */
  143.   Display_Periodic_Handle(LocalTime);
  144.   
  145.   /* LwIP periodic services are done here */
  146.   LwIP_Periodic_Handle(LocalTime);
  147. }


  148. #ifdef  USE_FULL_ASSERT
  149. ……………………

  150. …………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
智嵌以太網(wǎng)遠(yuǎn)程更新.7z (6.42 MB, 下載次數(shù): 176)




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

使用道具 舉報(bào)

沙發(fā)
ID:319585 發(fā)表于 2018-12-9 14:10 | 只看該作者
這個(gè)不錯(cuò)的,需要的,我還需要串口通信的例子
回復(fù)

使用道具 舉報(bào)

板凳
ID:272158 發(fā)表于 2021-8-9 14:57 | 只看該作者
我這里油串口通訊的》,智嵌
回復(fù)

使用道具 舉報(bào)

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

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

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

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: a级毛片基地 | 精品成人一区二区 | 国产成人精品一区二区三 | www.亚洲精品 | 精品视频久久久 | 欧美精品一区二区三区在线播放 | 亚洲视频在线播放 | 亚洲免费人成在线视频观看 | 国产免费一区 | 成人不卡视频 | 91精品久久久久久久 | 日本精品一区二区在线观看 | 久久剧场 | 日韩视频精品 | 成人做爰69片免费观看 | 国产成人免费视频网站高清观看视频 | 久久午夜视频 | 亚洲成人午夜电影 | 精品国产亚洲一区二区三区大结局 | 国内久久 | 韩日在线视频 | 成人美女免费网站视频 | 91在线精品一区二区 | 成年人免费网站 | 亚洲视频手机在线 | 国产精品久久二区 | 亚洲精品中文字幕在线观看 | 国产区一区二区三区 | 欧美日韩成人在线 | 91视频网址 | 国产免费一区二区三区 | 在线免费观看毛片 | 亚洲第一成人av | 欧美激情视频一区二区三区在线播放 | 久久九九99| 日韩精品二区 | 久久人 | 国产高清在线 | 亚洲少妇综合网 | 国产精品一区二区欧美黑人喷潮水 | 久久免费小视频 |