Fake EEPROM module just added #95
Replies: 22 comments
-
Posted at 2015-11-13 by the1laz Nice! Features like this really make Espruino great, really really easy to use. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-13 by DrAzzy What do you mean by:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-13 by tve Q: what is flash.length set to? Basically are you putting the eeprom area by default just after the flashed code/data, such that it gets lots if a new version of espruino changes the length in pages? Wouldn't it be better to add a param to the board config to specify where the eeprom area should start? At least going forward that would be safer. Have you thought of any CRC to validate that the eeprom contents is still valid and hasn't been corrupted? This module only works on a single flash page, correct? Might be nice to state that. It looks like the addr parameter of FlashEEPROM.prototype.readAll is not used? What are the memory requirements of this module in order to rewrite the data? If the flash area contains, say, 1KB of data the memory requirements will be much more than that, right? Have you thought of using two pages in order to incrementally copy from one to the other? This would also avoid data loss in case the flash page write gets interrupted. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by @gfwilliams
You should be able to specify an object for flash as the last argument. If we have flash modules that implement read/write/getPage/erasePage (I think there was one?) then you can just use them.
STM32F4 has only a few pages, so there isn't any choice in the matter. It uses the page starting at 384kB - the one that the chip isn't supposed to have (but that exists anyway) - all the rest are used. I thought it said in the docs. ... and by using a page that the STM32 shouldn't have, it doesn't get overwritten by the bootloader :)
That's the optional first argument of the module? I don't think it needs to go in the firmware...
Hmm... maybe - I wonder what the chances of it being wrong are? The flash memory seems very reliable - so much so I have now turned off verify when flashing as it just wastes time :)
It'd be nice to use a second page, but on STM32F4 there aren't enough pages, and on the F1 the pages are 1024 or 2048k, so storing the contents for that in RAM isn't a big deal (although yes, if it got interrupted while writing a page you'd lose stuff) It depends what you've written to the EEPROM what memory gets used. You could obviously fill a 128kB page with data and it wouldn't rewrite, but if you just wrote values at maybe 100 addresses and changed them enough to fill up memory, rewriting would not be an issue. I'll get rid of the readAll argument... That was a copy/paste bug :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by tve
Mhh, you seem to be taking a very stm32-centric view. On the esp8266 the flash_start and flash_length values don't make a ton of sense because there are multiple areas with settings and such. Flash_start+Flash_length=Flash_end, basically, so you can't put anything beyond that. So the way this is coded, a user has to go and look up the memory map and decide into which gap to put the 4KB eeprom page. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by @gfwilliams Well, as you say, something defining a |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by @gfwilliams Just to add, it looks like there's a big rant on Gitter that this doesn't 'just work' on ESP8266. All you have to do is if you want to use this at the moment. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by tve Big rant on gitter? where? there were some questions and responses, but no rant that I see. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by @gfwilliams Ahh, sorry - I literally just scanned over it this morning while answering mail and forum posts and saw:
But as you spotted that's not right. So no, not much of a rant :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by JumJum I had to translate rant, interesting. Anyway lets go back to the facts:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by tve
That is probably correct if it works for you ;-). The start really depends on where the current firmware binary ends. However, with the soon-to-happen change to a single firmware image for all flash chip sizes this is likely to change and may be different between flash chip sizes. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by @gfwilliams I'd like to keep FlashEEPROM in a state where it still works on a normal 1v81 release, but I think reporting free flash areas in Perhaps something like:
I guess for now, only one might get reported, but in a lot of cases I imagine there may be several small areas free that could potentially be used. I don't know if we'd only report whole free pages, or maybe we could report if there were parts of pages that were free as well. Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by JumJum @gordon, AFAIK, erasing can only be done on whole page(usually 4K). Therefore I would recommend to publish empty pages only. Otherwise it would happen too often, that data needed somewhere else, will be deleted. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by @gfwilliams
To be fair, this was @tve's idea originally ;) The list would be created by the |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-21 by tve I think a list of free page regions would be awesome. Would it make things too complicated to be able to reserve a chunk from that? That info would have to be persisted in the save() area, perhaps? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-21 by @gfwilliams
I'm not sure I understand this? You mean that when you update firmware you don't want to overwrite it? Really good documentation on the memory layout though - I need one of those for Espruino boards :) I think if we added I guess probably returning a set of ranges (from + length) would be best, as otherwise you're going to get swamped with data items if you ask how many pages are in the 4MB parts :) ... other option is to just have |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-21 by @allObjects ...[[from,length,pageSize],...], or [[from, pageSize,numberOfPages],...]... if page size varies. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-21 by tve Adding the page size sounds like a good idea. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-23 by @gfwilliams But you can just do |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-23 by tve Ah, good point. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-25 by @gfwilliams DO NOT USE THIS ON ESPRUINO PICO FIRMWARE 1v82 - it'll cause your Pico to overwrite part of its firmware, and you'll have to enter the bootloader and re-update it. I'll fix this in 1v83 which I'll release shortly. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-27 by @gfwilliams And 1v83 is released now, so it's fine to use again. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-13 by @gfwilliams
Hi,
I just uploaded this: http://www.espruino.com/FlashEEPROM
Hopefully it'll give you nice easy access to nonvolatile memory, without having to faff around with pages.
Beta Was this translation helpful? Give feedback.
All reactions