- Wed Jan 07, 2015 6:20 pm
#6623
zeroday wrote:.....I add a file.format() api in the build 20150107, to clean a flash(delete everything in filesystem)
until now, no reboot spotted.
Yes, with firmware build 20150107 situation has improved, but not completely solved.
file.format() works.
On module with 512K flash is performed for
1 ... 1.5 seconds.
On module with 4M flash is performed for
27 seconds.
I tested again with a script (added control heap):
Code: Select allfor j=1,50 do
print("20K"..j.." heap = "..node.heap())
file.open("20K"..j..".txt", "w")
for i=1,1280 do
file.writeline('0123456789ABCDE')
end
file.close()
end
The result for module 512K flash:
20K1 heap = 21728
20K2 heap = 21552
20K3 heap = 21552
20K4 heap = 21552
20K5 heap = 21552
20K6 heap = 21552
20K7 heap = 21552
stdin:5: open a file first
> for n,s in pairs(file.list()) do print(n.." size: "..s) end
20K6.txt size: 2304
20K1.txt size: 20480
20K5.txt size: 7168
20K3.txt size: 20480
20K2.txt size: 20480
20K4.txt size: 20480
The recording process is interrupted when the total files size is ~90 KB (for files of different sizes (10KB, 15KB, 20KB) are slightly different results).
The result for module 4M flash:
200K1 heap = 21768
200K2 heap = 21592
200K3 heap = 21592
200K4 heap = 21592
200K5 heap = 21592
200K6 heap = 21592
200K7 heap = 21592
200K8 heap = 21592
200K9 heap = 21592
ь!¤<
жЗ!„ю1д)m†1¤сBCб
NodeMCU 0.9.5 build 20150107 powered by Lua 5.1.4
lua: cannot open init.lua
> for n,s in pairs(file.list()) do print(n.." size: "..s) end
200K8.txt size: 204800
200K4.txt size: 204800
200K7.txt size: 204800
200K9.txt size: 105216
200K1.txt size: 204800
200K2.txt size: 204800
200K6.txt size: 204800
200K3.txt size: 204800
200K5.txt size: 204800
The recording process is interrupted and reboot of the module when the total file size is exactly 1743616 bytes (for files of different sizes (100 KB, 200 KB) the results are the same).
Interesting: the total size of the recorded files + firmware size approximately equal to half the size of the flash.
Incorrectly determined the type and size of the flash memory?