2017-03-29 01:26 PM
I'm working with STM32f027B discovery board, Keil uVision 5.23 MDK and the FLASH_EraseProgram FLASH Erase and Program example. When I try to step through the flash programming example in the debugger, it disconnects from the debugger when it executes the first HAL routine associated with Flash. The precise routine is HAL_FLASHEx_Erase() . Once that line is executed, the IDE displays a message 'Cannot access target. Shutting down debug session' and then the debugger detaches. Any idea how to modify the example code so I can run it in the MDK debugger?
#flash #stm32f027 #keil-ide #hal-library2017-03-30 02:14 AM
Hi
netskink
,-Nesrine-
2017-03-30 06:23 AM
Hello Nesrine,
Yes, I'm using the example from the STM32F0cube installed samples. This is from the code header of the code which does the HAL call.:
******************************************************************************
* @file FLASH/FLASH_EraseProgram/Src/main.c * @author MCD Application Team * @version V1.7.0 * @date 04-November-2016 * @brief This example provides a description of how to erase and program the * STM32F0xx FLASH. ******************************************************************************This is the code in HAL which performs the call which fails:
******************************************************************************
* @file stm32f0xx_hal_flash_ex.c * @author MCD Application Team * @version V1.5.0 * @date 04-November-2016 * @brief Extended FLASH HAL module driver.If I step over this line in main.c
if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK)
then it drops the debug session.
If I instead step into the same line and then step over each of the calls in the flash erase routine, then it will work and eventually step out of the routine and I can debug the rest of the code.
I have a question on stackoverflow for this as well. Its here if anyone is interested: