Dear All,
I want to stash few data in internal flash for next power up. I can read/write internal flash by
print(esp.flash_user_start())
>>2097152
so I write data to 2097152:
>>esp.flash_write(2097152, buf)
Then I ruin fat32 table....
How do I know the actual code size, Read-Only(constant) size and R/W size ?
I want to know how much flash size I can use to store some data.
Thank you all for reading this question.
How to use internal flash ?
Re: How to use internal flash ?
The mostz obvious method would writing your data into a file, e.g. using the JSON methods. If you like to use direct write to flash, you have to adapt the driver for that file system, which is in modules/flashbdev.py. In line 6 there is the definition of START_SEC, which defines the fist address of the file system. You may add a few sector (4096 bytes each) to get room for your data.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: How to use internal flash ?
You can use the standard python file handling in Micro-Python. see bottom of this page https://docs.python.org/3/tutorial/inputoutput.html
Re: How to use internal flash ?
That assumes you’re running on top of an OS.OutoftheBOTS_ wrote:You can use the standard python file handling in Micro-Python. see bottom of this page https://docs.python.org/3/tutorial/inputoutput.html
If you’re running on bare metal, those won’t work
Sent from my iPhone using Tapatalk Pro
Re: How to use internal flash ?
@salto seems to work with an ESP32 or ESP8266, and mentioned, that his first attempts damaged the FAT. So there is a file system.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: How to use internal flash ?
So far I have used MP on ESP8266, ESP32 and STM32F7 and I have just used standard python file handing to create/edit files on both flash and SD and all 3 platforms. As far as I was aware this is some of the special magic performed by MP.jickster wrote: ↑Wed Sep 05, 2018 1:35 pmThat assumes you’re running on top of an OS.OutoftheBOTS_ wrote:You can use the standard python file handling in Micro-Python. see bottom of this page https://docs.python.org/3/tutorial/inputoutput.html
If you’re running on bare metal, those won’t work
Sent from my iPhone using Tapatalk Pro
As far as I am aware it works similar to how a SSD (PC flash storage) works on a PC, It creates a boot sector for the MP firmware then creates a FAT with the left over flash.
Re: How to use internal flash ?
Yes, I am using ESP32 board.
@OutoftheBOTS_, thanks for providing this idea, I find an interesting article here:
https://techtutorialsx.com/2017/06/03/e ... ng-a-file/
It demonstrate a way to read/write a file, then I can follow @Roberthh suggestion to create a csv file.
To @Roberthh, I have a question. I downloaded binary file from micropython website, in your suggestion, it need to modify modules/flashbdev.py. It looks I have to install linux then run "make" ?? Am I right ?
Thanks for everyone.
@OutoftheBOTS_, thanks for providing this idea, I find an interesting article here:
https://techtutorialsx.com/2017/06/03/e ... ng-a-file/
It demonstrate a way to read/write a file, then I can follow @Roberthh suggestion to create a csv file.
To @Roberthh, I have a question. I downloaded binary file from micropython website, in your suggestion, it need to modify modules/flashbdev.py. It looks I have to install linux then run "make" ?? Am I right ?
Thanks for everyone.