m-mcgowan / spark-flashee-eeprom

Eeprom emulation using external flash on Particle devices. Includes unit tests cross compiled to regular gcc, and on-device integration tests.
GNU Affero General Public License v3.0
34 stars 8 forks source link

Infinite recursion during addressErase scheme write #16

Closed m-mcgowan closed 9 years ago

m-mcgowan commented 9 years ago

When performing the 8th destructive write to an address, the page is copied to a new location and the data refreshed to allow each slot to have the full number of writes again.

However, with some writes, the page copying is invoked recursively and continually, causing the stack to eventually overflow.

m-mcgowan commented 9 years ago

The fix is here - https://github.com/m-mcgowan/spark-flashee-eeprom/commit/44a2903a624779f89c5e6ec278c16df22bbeb031

The error boils down to not correctly converting between the logical address space in the current layer and the address space in the layer below. This caused the underlying pages to not be correctly updated, and an infinite recursion as a result.