enable MPU protect on SBSFU for STM32L1 returns memory fault on accessing eeprom
According to the integration guide (an5056) it should be possible to use the flash memory to store user data (chapter 8.2) . However, when turning on the MPU protect define the controller goes into a memory fault when accessing the eeprom for reading (located at position 0x0808 0001) on stm32l151RE
The code used for accessing the eeprom is the following:
#include "sfu_low_level_eeprom.h"
#include <stdbool.h>
#include "sfu_low_level_flash.h"
static bool checkBounds(uint16_t address)
{
return address >= FLASH_EEPROM_END - FLASH_EEPROM_BASE;
}
uint8_t sfu_ll_eeprom_readByte(uint16_t address, uint8_t * data)
{
if(checkBounds(address))
{
return 0;
}
memcpy(data, (uint8_t *) (address + FLASH_EEPROM_BASE), 1);
return 1;
}
I've had the same problem when accessing the eeprom from the user application while using similar code.
Should the eeprom only be accessible through the secure engine callgate ? because this seems like quite an unnecessary workaround for just accessing user data seeing as it's stated that this is possible even is we use the flash memory itself for storing user data.
