标题: STM32F030 IAP和APP例程 [打印本页]

作者: weidni2009    时间: 2019-12-11 18:45
标题: STM32F030 IAP和APP例程
对于需求STM32F0 IAP升级的朋友,这个例程不要错过,足够你在研发使用了

单片机源程序如下:
  1. #include "stm32f0xx.h"
  2. #include "main.h"
  3. #include "delay.h"
  4. #include "tim1.h"
  5. #include "usart.h"
  6. #include "iap.h"
  7. #include "gpio.h"
  8. uint32_t TimingDelay;
  9. uint32_t Program_Addr1=0x8002000;     //FLASH前8K直接给BootLoad
  10. uint32_t Program_Addr2=0x8002400;
  11. uint32_t Program_Addr3=0x8002800;
  12. uint32_t Program_Addr4=0x8002C00;
  13. uint8_t RX_Value;
  14. int main(void)
  15. {
  16.         uint32_t CNT;

  17. //        //void IAP_Set(void)

  18.    uint32_t i = 0;
  19. /* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/  
  20.   /* Copy the vector table from the Flash (mapped at the base of the application
  21.      load address 0x08003000) to the base address of the SRAM at 0x20000000. */  
  22.   FLASH_Unlock();
  23.   for(i = 0; i < 48; i++)
  24.   {
  25.     *((uint32_t*)(0x20000000 + (i << 2)))=*(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));
  26. }
  27.   /* Enable the SYSCFG peripheral clock*/
  28.   FLASH_Lock();
  29.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

  30. /* Remap SRAM at 0x00000000 */
  31.   SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);


  32.         if (SysTick_Config(SystemCoreClock / 1000))       //1ms中断一次
  33.   {
  34.     /* Capture error */
  35.     while (1);
  36.   }
  37.         while(1)
  38.         {
  39.           
  40.         LED_Init();
  41.                 STM32_USART_Init();
  42.         while(1)
  43.         {
  44.          
  45.                 GPIOF->ODR|=1<<7;
  46.                 delay_ms(500);
  47.                 GPIOF->ODR&=~(1<<7);
  48.                 delay_ms(300);
  49.           if(RX_Value==0x05) GPIOB->ODR^=3;
  50.         }
  51. }
  52. }
复制代码

所有资料51hei提供下载:
STM32F030IAP.7z (174.19 KB, 下载次数: 128)



作者: gmail2009@qq.co    时间: 2020-1-5 12:38
下载学习一下!!!!
作者: wpsookwpsook    时间: 2020-3-16 13:51
谢谢!好人一生平安
作者: wpsookwpsook    时间: 2020-3-16 13:58
谢谢!
作者: 0x00000000    时间: 2020-9-10 11:31
参考一下,感谢楼主的共享!




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1