1、单独跑APP,运行正常。2、把usb cdc初始化的函数去掉,boot跳转到app,运行也正常。
一旦初始化了usb,就直接卡死在usb那。
boot的跳转函数用的官方bsp里的升级demo里的代码:
void IAP_Jump(uint32_t dwAddr)
{
uint32_t dwStkPtr, dwJumpAddr;
uint32_t i = 0;
dwStkPtr = *(UINT32 *)dwAddr;
dwJumpAddr = *(UINT32 *)(dwAddr + sizeof(UINT32));
if ((dwStkPtr < SRAM_BASE) || ((dwStkPtr & 0xFF000000) != SRAM_BASE || (dwJumpAddr < FLASH_APP1_ADDR) || ((dwJumpAddr & 0xFF000000) != FLASH_BASE)))
return;
for (i = 0; i < 1000000; i ++)
{
__NOP();
}
RCC->APB2RST = 0xFFFF;
RCC->APB2RST = 0;
RCC->APB1RST = 0xFFFF;
RCC->APB1RST = 0;
RCC->APB2EN = 0;
RCC->APB1EN = 0;
RCC->AHBRST = 0xFFFF;
RCC->AHBRST = 0;
BIT_SET(RCC->CTRL, RCC_CTRL_HSIEN);
/* Reset SW, AHBPSC, APB1PSC, APB2PSC, ADCPSC and CLKOUT bits */
BIT_CLEAR(RCC->CFG, RCC_CFG_SYSCLKSEL | RCC_CFG_AHBPSC | \
RCC_CFG_APB1PSC | RCC_CFG_APB2PSC | \
RCC_CFG_ADCPSC | RCC_CFG_CLKOUT);
/* Reset HSEEN, HSECFDEN and PLLEN bits */
BIT_CLEAR(RCC->CTRL, RCC_CTRL_HSEEN | RCC_CTRL_HSECFDEN | \
RCC_CTRL_PLLEN);
/* Reset HSEBYPS bit */
BIT_CLEAR(RCC->CTRL, RCC_CTRL_HSEBYPS);
/* Reset PLLRC, PLLHSEPSC, PLLMUL, USBPSC and PLLRANGE bits */
BIT_CLEAR(RCC->CFG, RCC_CFG_PLLRC | RCC_CFG_PLLHSEPSC | \
RCC_CFG_PLLMULT | RCC_CFG_USBPSC | RCC_CFG_PLLRANGE);
/* Disable all interrupts and clear pending bits */
RCC->CLKINT = RCC_CLKINT_LSISTBLFC | RCC_CLKINT_LSESTBLFC | \
RCC_CLKINT_HSISTBLFC | RCC_CLKINT_HSESTBLFC | \
RCC_CLKINT_PLLSTBLFC | RCC_CLKINT_HSECFDFC;
SET_MSP(dwStkPtr);
pfTarget = (void (*)(void))dwJumpAddr;
pfTarget();
}
boot跳转到app的地址是0x0800A000,
app里重定位向量表
请教大家,哪里有问题,提供个思路
|