STM32F4 IAP串口下载 程序跑飞 求助

2019-07-20 01:12发布

如题,源码见附件,串口接收到bin文件后,按下按键下载至FLASH ADRR 0x8020000  ,然后第二次按键跳转APP起始地址,跳转后跑飞,请各位大神帮忙解答,谢谢

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
5条回答
nsqdy1
1楼-- · 2019-07-20 06:16
 精彩回答 2  元偷偷看……
candylife9
2楼-- · 2019-07-20 09:04
 精彩回答 2  元偷偷看……
nsqdy1
3楼-- · 2019-07-20 14:08
candylife9 发表于 2019-5-2 11:42
SCB->VTOR = FLASH_BASE | 0x20000;向量表偏移放在程序的最开始,也就是main的第一行。

请问你说的是APP里的向量表偏移吧,我在systeminit里已经修改了:
void SystemInit(void)
{
  /* FPU settings ------------------------------------------------------------*/
  #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */
  #endif
  /* Reset the RCC clock configuration to the default reset state ------------*/
  /* Set HSION bit */
  RCC->CR |= (uint32_t)0x00000001;

  /* Reset CFGR register */
  RCC->CFGR = 0x00000000;

  /* Reset HSEON, CSSON and PLLON bits */
  RCC->CR &= (uint32_t)0xFEF6FFFF;

  /* Reset PLLCFGR register */
  RCC->PLLCFGR = 0x24003010;

  /* Reset HSEBYP bit */
  RCC->CR &= (uint32_t)0xFFFBFFFF;

  /* Disable all interrupts */
  RCC->CIR = 0x00000000;

#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
  SystemInit_ExtMemCtl();
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
         
  /* Configure the System clock source, PLL Multiplier and Divider factors,
     AHB/APBx prescalers and Flash settings ----------------------------------*/
  SetSysClock();

  /* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
  SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
  SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
}

将VECT_TAB_OFFSET设置为0x20000,这里和你说的main函数最开始设置SCB->VTOR = FLASH_BASE | 0x20000是一样的吧?
nsqdy1
4楼-- · 2019-07-20 16:44
求助!!求助!!求助,求帮忙解答,不要沉下去呀
mjwang
5楼-- · 2019-07-20 18:27
 精彩回答 2  元偷偷看……

一周热门 更多>