标题:
STM32F030 IAP和APP例程
[打印本页]
作者:
weidni2009
时间:
2019-12-11 18:45
标题:
STM32F030 IAP和APP例程
对于需求STM32F0 IAP升级的朋友,这个例程不要错过,足够你在研发使用了
单片机源程序如下:
#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;
}
}
}
复制代码
所有资料51hei提供下载:
STM32F030IAP.7z
(174.19 KB, 下载次数: 128)
2019-12-11 18:54 上传
点击文件名下载附件
下载积分: 黑币 -5
作者:
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