標(biāo)題: STM32F030 IAP和APP例程 [打印本頁]

作者: weidni2009    時(shí)間: 2019-12-11 18:45
標(biāo)題: STM32F030 IAP和APP例程
對于需求STM32F0 IAP升級的朋友,這個(gè)例程不要錯(cuò)過,足夠你在研發(fā)使用了

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

所有資料51hei提供下載:
STM32F030IAP.7z (174.19 KB, 下載次數(shù): 128)



作者: gmail2009@qq.co    時(shí)間: 2020-1-5 12:38
下載學(xué)習(xí)一下。。!
作者: wpsookwpsook    時(shí)間: 2020-3-16 13:51
謝謝!好人一生平安
作者: wpsookwpsook    時(shí)間: 2020-3-16 13:58
謝謝!
作者: 0x00000000    時(shí)間: 2020-9-10 11:31
參考一下,感謝樓主的共享!




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1