stm32-fly-boot下载bin文件说明

来源:互联网 发布:我国石油分布数据图 编辑:程序博客网 时间:2024/06/05 06:02
 

fly-boot下载bin文件说明  (wang@20111124)
1、fly-boot引导程序下载在flash 0x8000000 地址上

2、需要生成bin文件 bin下载放在0x8003000地址上
iar生成bin: 打开Options--Output Converter--选中Generate additional output  Output format选binary
MDK生成bin: 打开Options for Target,选择User标签页;构选Run User Programs After Build/Rebuild框中的Run #1多选框,
在后边的文本框中输入D:\Program Files\keil\ARM\BIN40\fromelf.exe --bin -o ./Project.bin ./Project.axf命令行;


3、app-bin文件配置

stm32f10x_flash.icf文件修改
define symbol __ICFEDIT_intvec_start__ = 0x08003000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__   = 0x08003000 ;

配置新的中断向量入口地址
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x3000);   //更改

main()中加FLASH_Unlock 解锁FLASH,确保FLASH可写
FLASH_Unlock();
 

4、cb-com-boot\目录下的pTest.exe  Fly-BootV1.0应用程序,用来下载bin文件

5、操作说明
fly-boot复位时先请求下载bin文件,5次请求失败后,进入0x8003000地址启动app-bin程序
如果请求成功,下载bin文件,下载完后,进入0x8003000地址启动app-bin程序


6、Juma_IAP代码
#define ApplicationAddress    0x08030000

typedef  void (*pFunction)(void);

pFunction Jump_To_Application;

u32 JumpAddress;

extern void __set_MSP(u32 topOfMainStack);

void Jump_IAP(void)
{

    /* Test if user code is programmed starting from address "ApplicationAddress" */
    if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
    { /* Jump to user application */
      JumpAddress = *(volatile u32*) (ApplicationAddress + 4);
      Jump_To_Application = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */

 __set_PSP(*(volatile unsigned int*) ApplicationAddress);
      __set_CONTROL(0);
      __set_MSP(*(volatile u32*) ApplicationAddress);
      Jump_To_Application();
    }
}