Skip to main content
Andrew Neil
Super User
May 17, 2024
Solved

EEPROM Emulation - Virtual Addresses

  • May 17, 2024
  • 3 replies
  • 5102 views

Both X-CUBE-EEPROM and STSW-STM32117 (AN4061 - for STM32F0) use "Virtual Addresses" in the emulated storage:

AndrewNeil_0-1715945255193.png

 

AndrewNeil_1-1715945273599.png

But nowhere explains how these "Virtual Address" numbers are determined/decided.

It seems to me that (apart from 0x0000 and 0xFFFF being reserved)*, the choice is completely arbitrary - is that right?

The examples use "sparse" virtual address values - is there any advantage in doing that ?

Would there be any benefit in choosing values with maximum spacing - more "entropy" ?

 

EDIT:

* Both 0x0000 and 0xFFFF are reserved by X-CUBE-EEPROM;

Only 0xFFFF is reserved by AN4061 (presumably also by AN2594, AN3390, AN4056, and AN3969?)

Best answer by Florian LR

Hi @Andrew Neil , 

Yes these 3 values are arbitrary chosen. You can give them the value you want (in the X-Cube example the value are 1/2/3, etc.). 
The thing is that you can give the value you want, it can be useful if you want to give a value that means something in your application, but right there, that's totally arbitrary. 

 

I hope this helps, 

Best Regards, 

Florian LR

3 replies

Tesla DeLorean
Guru
May 17, 2024

As I understand it they are arbitrary, stored as metadata in a journal, and allowing for recovery of a subset of the entire virtual address space.

Personally I'd journal a configuration structure over doing it this way.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
May 17, 2024

@Tesla DeLorean wrote:

Personally I'd journal a configuration structure over doing it this way.


Hmmmm ... maybe you're right.

The 100% overhead, and only being able to access individual 16-bit "items" does seem cumbersome.

I have mostly 8-bit data, and a number of strings.

So maybe something more like this: https://www.silabs.com/documents/public/application-notes/AN568.pdf ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Grant Bt
Associate III
May 21, 2024

Andy,

Assuming you really need the wear leveling, I found AN568 and AN798 both worth looking at. In my opinion, some of these are better for structures (AN568) and some better for individual bytes (AN798).

https://www.silabs.com/documents/public/application-notes/AN798.pdf

GB

 

Andrew Neil
Super User
May 21, 2024

Yes, I saw them & got the same impression.

I also saw their UG103.7 - "Non-Volatile Data Storage Fundamentals" – for their Cortex-M parts. It seems rather more advanced (complicated!).

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
May 21, 2024

@STTwo-32 for the ST implementations, can you confirm that the values of the  "Virtual Addresses" are, indeed, purely arbitrary?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Florian LR
Florian LRBest answer
ST Employee
June 11, 2024

Hi @Andrew Neil , 

Yes these 3 values are arbitrary chosen. You can give them the value you want (in the X-Cube example the value are 1/2/3, etc.). 
The thing is that you can give the value you want, it can be useful if you want to give a value that means something in your application, but right there, that's totally arbitrary. 

 

I hope this helps, 

Best Regards, 

Florian LR

Andrew Neil
Super User
June 11, 2024

Thanks for clarifying that.

Having now looked at it for a while, I find the term "Virtual Address" unhelpful - maybe even misleading.

I think something like "Tag" or "Key" would be more appropriate.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.