Skip to content

MPU preventing EEPROM access on STM32L151/MTB_RAK811 #10220

@wmcelderry

Description

@wmcelderry

Description

STM32L151/RAK811 MPU update conflict with internal EEPROM.

Detection:
When working with the RAK811 (STM32L151CB), using an EEPROM library works prior to 5.11.0

Error symptom is a HardFault dump, which seems to be a Data access violation (from my reading of the Cortex-M3 TRM (page 8-32):

HFSR : 40000000
MMFSR: 00000082
BFSR : 00000000
UFSR : 00000000
DFSR : 00000000
AFSR : 00000000
MMFAR: 08080000

I created an absolutely minimal test from the STM32L151xx Reference manual (RM0038) to minimise the code that could have an impact when changing between commits.

Using git bisect identified the first 'bad' release as: 1821d37 (HEAD, refs/bisect/bad) Overhaul MPU for new requirements
That makes sense as writing to EEPROM is essentially using an unlock sequence and writing to the appropriate address (0x08080000 + EEPROM offset). It is possible to read from the address in later versions, but not write to it.

Looking at the debug message, it looks like the author was expecting such issues as they have provided comments to allow customising by ether defining MBED_MPU_ROM_END or a vector specific ARM MPU driver by defining MBED_MPU_CUSTOM.

While I may be able to hack something to get this working, it would be much better if someone who understands the issues can comment on
A) which method of customisation is appropriate (and what would it look like please)?
B) how would that be best integrated in to mbed-os for others to benefit from (targets.json for which devices?)?

target: MTB_RAK811 (suspect all STM32L1xx?)
toolchain: ARM_GCC
tools: mbed-cli (running on Linux)
first affected commit: 1821d37 (HEAD, refs/bisect/bad) Overhaul MPU for new requirements

Steps to reproduce:

Call the minimal_test() function from main() from https://gist.github.com/wmcelderry/87f1031db5c3e4a11350999bfc7e2ede#file-minimal_eeprom_test-cpp

NB: Apologies if something is missing! Please ask for any missing information or useful expansions. I have not been able to find any similar reports.

Big thanks to the contributors for all the hard work that's gone in to the system!

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions