打印
[应用相关]

还是关于STM32 IAP的问题,再来请教版主

[复制链接]
2035|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
tuy0326|  楼主 | 2009-7-20 09:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我的IAP顺序是这样的: 

1.程序启动检查标志 
2.更具标志进入IAP 
3.擦除用到的页 
4.编程数据进FLASH(我的一个bin文件) 
5.清除标志位 

上面几步都没有问题,顺利的编程进去,但是就是不能引导程序进入,跳转程序是这样写的 

#define ApplicationAddress 0x08002000   //应用程序区 

int main(void) 

  /* Setup STM32 system (clock, PLL and Flash configuration) */ 
  SystemInit(); 
   
  /*Init Spi*/ 
  SPI_Flash_Init(); 
   
  /*USART Init*/ 
  Usart_init(); 

  RunRead(STATEADDRESS,0,100,(u8 *)State.InArray);//读SPI Flash         
  if((State.InState.UpdateApption0 + State.InState.UpdateApption1  
         + State.InState.UpdateApption2 + State.InState.UpdateApption3  
         + State.InState.UpdateApption4) > 3)//检查更新标志位,是否需要更新 
        { 
                UpDateApplication(); 
        } 
  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(); 
            } 
  }            
   /* Infinite loop */ 
  while (1) 
  { 
  } 


程序执行到这句: 
/* 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(); 
执行后。程序就进入了: 
void HardFault_Handler(void) 中断 

我用官方的IAP程序(AN2557),下载我的bin文件,是可以执行的,为何我的就不能执行呢???

同一个bin文件,烧写在同一个地址!

另再弱弱的问一声:jlink可以读出flash里的内容吗?我怎么找半天找不到在哪读啊?
 
还请版主及大虾提示! 
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

123

主题

144

帖子

1

粉丝