標(biāo)題:
STM32F030 IAP和APP例程
[打印本頁]
作者:
weidni2009
時(shí)間:
2019-12-11 18:45
標(biāo)題:
STM32F030 IAP和APP例程
對于需求STM32F0 IAP升級的朋友,這個(gè)例程不要錯(cuò)過,足夠你在研發(fā)使用了
單片機(jī)源程序如下:
#include "stm32f0xx.h"
#include "main.h"
#include "delay.h"
#include "tim1.h"
#include "usart.h"
#include "iap.h"
#include "gpio.h"
uint32_t TimingDelay;
uint32_t Program_Addr1=0x8002000; //FLASH前8K直接給BootLoad
uint32_t Program_Addr2=0x8002400;
uint32_t Program_Addr3=0x8002800;
uint32_t Program_Addr4=0x8002C00;
uint8_t RX_Value;
int main(void)
{
uint32_t CNT;
// //void IAP_Set(void)
uint32_t i = 0;
/* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/
/* Copy the vector table from the Flash (mapped at the base of the application
load address 0x08003000) to the base address of the SRAM at 0x20000000. */
FLASH_Unlock();
for(i = 0; i < 48; i++)
{
*((uint32_t*)(0x20000000 + (i << 2)))=*(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));
}
/* Enable the SYSCFG peripheral clock*/
FLASH_Lock();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Remap SRAM at 0x00000000 */
SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);
if (SysTick_Config(SystemCoreClock / 1000)) //1ms中斷一次
{
/* Capture error */
while (1);
}
while(1)
{
LED_Init();
STM32_USART_Init();
while(1)
{
GPIOF->ODR|=1<<7;
delay_ms(500);
GPIOF->ODR&=~(1<<7);
delay_ms(300);
if(RX_Value==0x05) GPIOB->ODR^=3;
}
}
}
復(fù)制代碼
所有資料51hei提供下載:
STM32F030IAP.7z
(174.19 KB, 下載次數(shù): 128)
2019-12-11 18:54 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
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