• 大小: 7.35MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-12-18
  • 语言: 其他
  • 标签: stm32  IAP  c代码  

资源简介

stm32 iap功能实现,包含两个工程,下载到单片机内后,发送0xaa可以实现来回跳转执行两个代码

资源截图

代码片段和文件信息

#include   “driver.h“

#define  ApplicationAddress0     0x08000000    //应用程序起始地址 

#define  ApplicationAddress1     0x08008000    //应用程序起始地址 

extern void jump(void);

uint8 flg = 0;
uint32_t JumpAddress;
pFunction Jump_To_Application;  //应用程序地址指针


int main(void)
{
InitAllPeriph();



while(1)
{
if(flg!=0)
{
jump();
}
if(SysMsCnt>=50)
{
LED1_Toggle();
COM1_printf(“Programm0 is running……\r\n“);
SysMsCnt = 0;
}
}
}
void jump(void)
{
uint32 ApplicationAddress=0;
if(0x01==flg)
{
ApplicationAddress = ApplicationAddress1;
COM1_printf(“Execute user Program1\r\n“);
}
else
{
return ;
}
if (((*(volatile uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
{
JumpAddress = *(volatile uint32_t*)(ApplicationAddress + 4);
Jump_To_Application = (pFunction)JumpAddress;

__set_MSP(*(volatile uint32_t*)ApplicationAddress);    //初始化用户程序的堆栈指针 

Jump_To_Application();
}
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-30 23:36  1\
     目录           0  2013-04-30 23:36  1\Driver\
     文件       12953  2013-04-30 13:30  1\Driver\driver.c
     文件        2180  2013-04-30 23:32  1\Driver\driver.h
     文件        2511  2013-01-21 22:34  1\Driver\iflash.c
     文件        4448  2013-01-20 23:01  1\Driver\rtc.c
     文件         908  2013-01-20 22:36  1\Driver\rtc.h
     文件        1225  2013-05-01 08:53  1\Driver\usart.c
     文件         235  2013-05-01 08:53  1\Driver\usart.h
     目录           0  2013-04-30 23:36  1\Libraries\
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\CM3\
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\CM3\CoreSupport\
     文件       17273  2010-06-07 10:25  1\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c
     文件       85714  2011-02-09 14:59  1\Libraries\CMSIS\CM3\CoreSupport\core_cm3.h
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\CM3\DeviceSupport\
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\CM3\DeviceSupport\ST\
     文件       25107  2012-07-14 14:30  1\Libraries\CMSIS\CM3\DeviceSupport\ST\Release_Notes_for_STM32F10x_CMSIS.html
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\
     文件       26297  2011-03-14 12:31  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\Release_Notes.html
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\
     目录           0  2013-04-30 23:36  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\
     文件       15766  2011-03-10 10:52  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_cl.s
     文件       15763  2012-07-14 14:30  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_cl112.s
     文件       15503  2011-03-10 10:52  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_hd.s
     文件       15692  2011-03-10 10:52  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_hd_vl.s
     文件       12376  2011-03-10 10:52  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_ld.s
     文件       13656  2011-03-10 10:52  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_ld_vl.s
     文件       12765  2011-03-10 10:52  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_md.s
     文件       14073  2011-03-10 10:51  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_md_vl.s
     文件       15955  2011-03-10 10:51  1\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_xl.s
............此处省略404个文件信息

评论

共有 条评论