Wemos W600-Pico

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
federico
Posts: 10
Joined: Tue Feb 07, 2017 11:34 pm

Re: Wemos W600-Pico

Post by federico » Mon Apr 13, 2020 6:31 am

To correct my previous:

In my opinion uPyCraft , at the moment, is the only IDE that can be easily used with the new W600-PICO board and I am using it( Not only - also the ESPlorer jar file but with more limitations ). From your PC you can load and check the micropython scripts in the Editor area, load(*) scripts from the W600-PICO board in the Editor area and/or download scripts from the Editor to the board.

Anyway, with the Windows uPyCraft version V1.1, also without the capability of loading the board code from the GUI device tree, a workaround is to load in the uPyCraft REPL shell the onboard micropython code using :

>>>print(open('./<filename.py>','rU').read())

and after to copy and paste it in the Editor area.

A precondition to work minimizing the problems with uPyCraft is of flashing the last micropython firmware( file wm_w600.fls) for W600-PICO in place of the default one on the board, following the Shymanskyy procedure. In the same dir where we have the w600tool.py copy the last micropython firmware file wm_w600.fls and :

1st - erase the flash with (**):
python ./w600tool.py -p COM15 -b 115200 -e
2nd - upload the fls file:
python ./w600tool.py -p COM15 -b 115200 --upload wm_w600.fls

(**) or with the w600tool.exe

To download un new firmware we need to use the Volodymyr Shymanskyy w600tool ( Python or Windows version) that can be downloaded from github.


As in the board specs the available flash is 1MB but what's more important to know is the available free flash size that we can use to store our micropython script.
To be short ( if I am right) I have found that we have a total of 63 blocks of 512 bytes of available flash size(about 32k) with 58 of them free (29k) for our scripts storage ( 5 are used by the default storage including. 3 dir - lib-sys-cert- and the boot and w600easy files).
Clearly a lot af flash is used to store the firmware wm_w600.fls of 528 kBytes).
Until now the reason of the flash deficit is unknown to me.
I have tested the same script ( substituting the import of w600 module with esp module and :
print('W600 flash size : '+ str( w600.flash_size()))
with :
print('ESP flash size : '+ str( w600.flash_size()))
)
with an ESP8266 board having 4MB flash founding an available free flash around 3.5MB that is a acceptable value.


# free flash size micropython script
import uos, w600
def run():
files_space = 0
for i in range(len(uos.listdir())):
if len(uos.listdir().split('.')) < 2:
a= uos.listdir()
print("Dir:{} bytes:{}".format(a,uos.stat(a)[6]))
files_space = files_space + uos.stat(a)[6]
else:
a = uos.listdir()
files_space = files_space + uos.stat(a)[6]
b = uos.listdir().split('.')[0]
print(" File:{} bytes:{}".format(b,uos.stat(a)[6]))
s = uos.statvfs(uos.getcwd())
print('Root Dir : '+ uos.getcwd())
print(s)
print('W600 flash size : '+ str( w600.flash_size()))
print('Flash avl size : '+'{0} bytes'.format((s[0]*s[2])))
print('Free flash size : '+'{0} bytes'.format((s[0]*s[3])))
print('Used flash size : '+'{0} bytes'.format((s[0]*(s[2] - s[3]))))
print('Stored files size : '+ str(files_space))
==================================

(*) with the python version - because the WM600-PICO root is '/flash' - to be able to load/run script from the uPyCraft device tree some changes to the python code in uPyCraft.py are required.
Attachments
W600_free_flash_2.PNG
W600_free_flash_2.PNG (102.67 KiB) Viewed 190 times
8_open_error.PNG
8_open_error.PNG (90.48 KiB) Viewed 190 times

User avatar
Roberthh
Posts: 1958
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Wemos W600-Pico

Post by Roberthh » Mon Apr 13, 2020 9:23 am

About flash usage: The flash map is shown in the file wm_flash_map.h of the SDK. Snippet below

Code: Select all

******************LAYOUT For 1M Flash**********************
    *Reserved   0x8000000-0x8010000    64Kbyte
    *Code       0x8010100-0x808FFFF    512Kbyte - 256 byte
    *Update     0x8090000-0x80EFFFF    384Kbyte
    *User       0x80F0000-0x80FBFFF    48Kbyte    
    *Parameter  0x80FC000-0x80FFFFF    16Kbyte
*********************************************************
As you can see, there is a 384k area reserved for update images. These are the gz-compressed images intended for OTA updates.
the User area is the one dedicated for the file system. When using FAT (and you seem to use that), already 32k of that are given to the file system, restricting gz files to 352k. If you do not need OTA (or os gz image upload), you can use that area either for the Code or for the file system. Both requires building your own firmware images. The code area can be extend by modifying the loader file tools/link_w600_1m.ld. The file system area requires modification of the flash driver file hal/modflash.c

federico
Posts: 10
Joined: Tue Feb 07, 2017 11:34 pm

Re: Wemos W600-Pico

Post by federico » Mon Apr 13, 2020 1:43 pm

Now everything is clearer to me .Thanks Roberthh for your quick and exhaustive explanation

Post Reply