Error handled when using flash_emulation when compiling in c++, not present in c
Hi,
I'm facing to a strange behaviors when I'm compiling my project in cpp but the issue disappear when compiling in c only.
The problem is on initialization of eeprom_emulation library on a STM32L476RG @ 80mhz
(line 657 of stm32l4xx_hal_flash.c) :
/**
* @brief Wait for a FLASH operation to complete.
* @param Timeout maximum flash operation timeout
* @retval HAL_StatusTypeDef HAL Status
*/
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
{
/* Wait for the FLASH operation to complete by polling on BUSY flag to be reset.
Even if the FLASH operation fails, the BUSY flag will be reset and an error
flag will be set */
uint32_t tickstart = HAL_GetTick();
uint32_t error;
while(__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY))
{
if(Timeout != HAL_MAX_DELAY)
{
if((HAL_GetTick() - tickstart) >= Timeout)
{
return HAL_TIMEOUT;
}
}
}
error = (FLASH->SR & FLASH_FLAG_SR_ERRORS);The while statement is never executed and error raised is decimal 128.
As you may know it's not relatively easy to use stm32cube configuration tools when project is cpp. But it's not the subject here.
So to be clear : This error appear only when project is compiled with a main.cpp extension. The while statement is well executed when main get .c extension.
Do you have any idea how to reach out of this ?
