Here's a simulation driver for a BaseFlash. It uses a file on disk as the backing store.
One cool feature is that it supports a memory mapped mode as well - caching the file in RAM, and using the base address of the cache as the .address in the flash_descriptor. Downside is that it allocates enough memory to cache the entire simulated flash, and refreshes it on every erase/program operation. This is relatively cheap for small flash sizes, but can become prohibitive for large ones. An improvement would be to mmap() the file with PROT_READ (anyone wanna contribute this?)
I've tested this with the MFS test suite, and and other custom higher level libraries that use BaseFlash objects.
BaseFlash simulation driver
Re: BaseFlash simulation driver
Here's one that specific for EFL - which can be added to os/hal/ports/simulator/posix. It's very similar. A notable difference is that this has a flash_descriptor_t that is defined in the LLD driver itself (configurable via preprocessor symbols) - as opposed to the generic driver above which expects a ptr to a flash_descriptor_t as part of the configuration.
- Attachments
-
- hal_efl_lld.zip
- (4.4 KiB) Downloaded 337 times
- Giovanni
- Site Admin
- Posts: 14565
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1113 times
- Been thanked: 937 times
- Contact:
Return to “Small Change Requests”
Who is online
Users browsing this forum: No registered users and 4 guests