我在IAP跳转后出现了FLASH_FLAG_PGSERR的错误,跳转后app能正确跑了起来,但是读写内部的flash出错,出现的是FLASH_FLAG_PGSERR的错误,打印的寄存器值是:>>>>>>>>>>>>FLASH->ACR:[0x705] >>>>>>>>>>>>FLASH->KEYR:[0x0] >>>>>>>>>>>>FLASH->OPTKEYR:[0x0] >>>>>>>>>>>>FLASH->SR:[0x80] >>>>>>>>>>>>FLASH->CR:[0x80000200] >>>>>>>>>>>>FLASH->OPTCR:[0xfffaaed] >>>>>>>>>>>>FLASH->OPTCR1:[0x0] 我在跳转前打印的寄存器是这样的: >>>>>>>>>>>>FLASH->ACR:[0x705] >>>>>>>>>>>>FLASH->KEYR:[0x0] >>>>>>>>>>>>FLASH->OPTKEYR:[0x0] >>>>>>>>>>>>FLASH->SR:[0x0] >>>>>>>>>>>>FLASH->CR:[0x80000200] >>>>>>>>>>>>FLASH->OPTCR:[0xfffaaed] >>>>>>>>>>>>FLASH->OPTCR1:[0x0] ===================================================== 打印前的 UsartDeInit(); HAL_DeInit(); NVIC_DisableIRQ(SysTick_IRQn); __disable_irq(); /* Jump to user application */ JumpAddress = *(__IO uint32_t*)(APPLICATION_ADDRESS + 4); Jump_To_Application = (pFunction)JumpAddress; //SCB->VTOR = (uint32_t)APP_VECTOR_TABLE; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); Jump_To_Application(); 跳转后是: __disable_irq(); NVIC_SetVectorTable(NVIC_VectTab_FLASH, VECTOR_ADDRESS); /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); __enable_irq(); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); /* USER CODE BEGIN 2 */ GPIOInit(); UsartInit(); ===================================================== 求大神分析一下,为啥跳转前后会导致flash的FLASH_FLAG_PGSERR错误??????????????? |
当该位为’1’时表示FPEC和FLASH_CR被锁住。
在检测到正确的解锁序列后,硬件清除此位为’0’。
在一次不成功的解锁操作后,下次系统复位前,该位不能再被改变。
评分
查看全部评分
SCB->VTOR = FLASH_BASE | APPLICATION_ADDRESS;