3161|1

1

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

STM32F103RE 的IAP升级问题,有的程序可以下载进去,有的下载后进入HardFault_Hand... [复制链接]

最近做个项目,采用了STM32的IAP升级,采用的是官方的超级终端版本的程序,IAP程序可以使用,下载了很多例程都可以正常运行,但是下载我自己的用户程序进去,不能正常运行,运行到IAP后进入HardFault_Handler;

IAP程序:
int main(void)
{
  /* Flash unlock */
  FLASH_Unlock();
  /* Initialize Key Button mounted on STM3210X-EVAL board */      
  STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);   
  /* Test if Key push-button on STM3210X-EVAL Board is pressed */
if (STM_EVAL_PBGetState(BUTTON_KEY)  == 0x00)
  {
   /* If Key is pressed */
   /* Execute the IAP driver in order to re-program the Flash */
   STM_EVAL_LEDInit(LED1);  
   STM_EVAL_LEDOn(LED1);
   IAP_Init();
   SerialPutString("\r\n======================================================================");
   SerialPutString("\r\n=              (C) COPYRIGHT 2010 STMicroelectronics                 =");
   SerialPutString("\r\n=                                                                    =");
   SerialPutString("\r\n=     In-Application Programming Application  (Version 3.2.0)        =");
   SerialPutString("\r\n=                                                                    =");
   SerialPutString("\r\n=                                   By MCD Application Team          =");
   SerialPutString("\r\n======================================================================");
   SerialPutString("\r\n\r\n");
   Main_Menu ();
  /* Keep the user application running */
  }
  else
  {
    /* Test if user code is programmed starting from address "ApplicationAddress" */
    if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
    {
      /* Jump to user application */
      JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
      Jump_To_Application = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) ApplicationAddress);
      Jump_To_Application();
    }
  }
  while (1)
  {}
}
其中#define ApplicationAddress    0x8002000

APP程序

int main(void)
{
SCB->VTOR = FLASH_BASE | 0x02000;
。。。。。。

另外Target中IROM1设置为0x8002000

其他没有特别设置,但是下载了几个例程都可以使用超级终端下载并正常运行,而我自己的用户程序可以下载,一运行就到HardFault_Handler里面,请高手们指引个查找问题的方向,谢谢。


1.png (40.03 KB, 下载次数: 4)

1.png
此帖出自stm32/stm8论坛

最新回复

你的iap在跳转的时候把所有的中断disable  详情 回复 发表于 2015-10-8 10:31
点赞 关注
 

回复
举报

466

帖子

0

TA的资源

版主

沙发
 
你的iap在跳转的时候把所有的中断disable
此帖出自stm32/stm8论坛
 
 

回复
您需要登录后才可以回帖 登录 | 注册

猜你喜欢
随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条
电源解决方案和技术 | DigiKey 应用探索站
当月好物、电源技术资源、特色活动、DigiKey在线实用工具,干货多多~

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表