MicroPython and flash memory issues
Posted: Tue Sep 29, 2020 7:39 am
Hey everybody!
Being a total newbie, i am sorry in advance for the hard time I am giving you
Let me start quoting the following from the MicroPython Documentation:
"The file system is typically backed by internal flash memory on the device, but can also use external flash, RAM, or a custom block device."
So, if i understand correctly MicroPython provides an on-device file system which usually "resides" in flash memory.
My first question is: are there any built-in functions of any module that can show me what is the size of the flash memory (when the filesystem "resides" in the flash)?
Secondly, what does it mean that the file system can be backed in a custom block device? Custom block devices are something like a custom file system, isn't? Is that stored in the flash memory too?
And something irrelevant. According to what i have understood, MicroPython can be implemented in bare-metal environment (no OS) or even when there is some underlying OS. Is there any way i can know that, given that when accessing the MicroPython environment, it acts as a small OS?
Now, in a bit different aspect, but again with memory issues in mind.
I have a Digi XBee 3 Zigbee and according to its specs, it has the following memory:
1 MB / 128 KB RAM (32 KB are available for MicroPython)
Well, correct me if I am wrong, but:
the 1MB is flash memory and 128MB are RAM, of which 32KB are available for MicroPython.
Now, I tried to use the uos.statvfs function from the uos module. The result I got was a tuple which indicated that I have 2048 free blocks of memory.
Since the name of the function indicates that it is about the virtual file system (VFS), which as mentioned before, I expected it to "reside" in flash memory, would that mean that that is my free flash memory? This doesn't really make any sense though...(not to mention that through XCTU GUI, the file system is said to have a total of 382KB)
So my guess was that this is referring to the available RAM memory. In specific, taken into consideration that a block is 16bits (not sure if that is true though) then by multiplying it to the number of free blocks, then i would have about 4KB of memory, which could correspond to the amount of stack memory (in the RAM) - which is actually what Xbee allocates, as Xbee's documentation states.
So, is that true? Does uos.statvfs() show info about stack memory? (doubt it, but I got no better idea for the time being)
Hopefully, I didn't confuse you all.
Thank you in advance for any help!!!
Being a total newbie, i am sorry in advance for the hard time I am giving you
Let me start quoting the following from the MicroPython Documentation:
"The file system is typically backed by internal flash memory on the device, but can also use external flash, RAM, or a custom block device."
So, if i understand correctly MicroPython provides an on-device file system which usually "resides" in flash memory.
My first question is: are there any built-in functions of any module that can show me what is the size of the flash memory (when the filesystem "resides" in the flash)?
Secondly, what does it mean that the file system can be backed in a custom block device? Custom block devices are something like a custom file system, isn't? Is that stored in the flash memory too?
And something irrelevant. According to what i have understood, MicroPython can be implemented in bare-metal environment (no OS) or even when there is some underlying OS. Is there any way i can know that, given that when accessing the MicroPython environment, it acts as a small OS?
Now, in a bit different aspect, but again with memory issues in mind.
I have a Digi XBee 3 Zigbee and according to its specs, it has the following memory:
1 MB / 128 KB RAM (32 KB are available for MicroPython)
Well, correct me if I am wrong, but:
the 1MB is flash memory and 128MB are RAM, of which 32KB are available for MicroPython.
Now, I tried to use the uos.statvfs function from the uos module. The result I got was a tuple which indicated that I have 2048 free blocks of memory.
Since the name of the function indicates that it is about the virtual file system (VFS), which as mentioned before, I expected it to "reside" in flash memory, would that mean that that is my free flash memory? This doesn't really make any sense though...(not to mention that through XCTU GUI, the file system is said to have a total of 382KB)
So my guess was that this is referring to the available RAM memory. In specific, taken into consideration that a block is 16bits (not sure if that is true though) then by multiplying it to the number of free blocks, then i would have about 4KB of memory, which could correspond to the amount of stack memory (in the RAM) - which is actually what Xbee allocates, as Xbee's documentation states.
So, is that true? Does uos.statvfs() show info about stack memory? (doubt it, but I got no better idea for the time being)
Hopefully, I didn't confuse you all.
Thank you in advance for any help!!!