2

I am working on trying to get the EEPROM Emulator from stm32 working. I have followed the example given for a stm32 l47x board however I am still running into issues. When I call EE_init I end up running into a stack overflow. I am not too familiar with this emulator and am using the default configurations from the example.

This is how I am initializing everything.

EE_Status ee_status = EE_OK; 

/* Enable and set FLASH Interrupt priority */
/* FLASH interrupt is used for the purpose of pages clean up under interrupt */
HAL_NVIC_SetPriority(FLASH_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(FLASH_IRQn);

 
HAL_FLASH_Unlock();


if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) == RESET)
{
   /* Blink LED_OK (Green) twice at startup */
   LEDInterface_toggleColor(GREEN);
   HAL_Delay(100);
   LEDInterface_toggleColor(NONE);
   HAL_Delay(100);
   LEDInterface_toggleColor(GREEN);
   HAL_Delay(100);
   LEDInterface_toggleColor(NONE);

   ee_status = EE_Init(EE_FORCED_ERASE);
   if(ee_status != EE_OK) 
   {
       while(1);
   }

This is the eeprom_emul_conf.h settings which I also have not changed

/* Configuration of eeprom emulation in flash, can be custom */
#if defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx)
#define START_PAGE_ADDRESS      0x08100000U /*!< Start address of the 1st page in flash, for EEPROM emulation */
#else
#define START_PAGE_ADDRESS      0x08080000U /*!< Start address of the 1st page in flash, for EEPROM emulation */
#endif
#define CYCLES_NUMBER           1U   /*!< Number of 10Kcycles requested, minimum 1 for 10Kcycles (default),
                                        for instance 10 to reach 100Kcycles. This factor will increase
                                        pages number */
#define GUARD_PAGES_NUMBER      2U   /*!< Number of guard pages avoiding frequent transfers (must be multiple of 2): 0,2,4.. */

/* Configuration of crc calculation for eeprom emulation in flash */
#define CRC_POLYNOMIAL_LENGTH   LL_CRC_POLYLENGTH_16B /* CRC polynomial lenght 16 bits */
#define CRC_POLYNOMIAL_VALUE    0x8005U /* Polynomial to use for CRC calculation *

/

I am running into the osal_hooks.c file where I am getting stuck in this while loop

#if defined(DOXYGEN)
void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )
#else
OSAL_WEAK_FN(void, vApplicationStackOverflowHook)( TaskHandle_t xTask, char *pcTaskName )
#endif
{
   volatile char * name = pcTaskName;
   (void)name;
   while (1)
   {
      ;
   }
}

Im sure I need to change where I allocate the memory but what is the best way to go about this. Thank you

glts
  • 21,808
  • 12
  • 73
  • 94
malhin
  • 21
  • 1
  • 1
    Maybe you need to increase the stack size. What tool chain are you using? – kkrambo Feb 09 '21 at 19:22
  • 1
    For example, if you're using Keil, then the stack size may be defined by the `Stack_Size` setting in the startup source code file with a name like startup_stm32l476xx.s – kkrambo Feb 09 '21 at 19:35
  • Also make sure your EEPROM will not grow in used RAM areas. I once had overwrite issues with EEPROM simulation – GabrielT Feb 10 '21 at 14:42

0 Answers0