# http://micropython.org/resources/micropython-ChangeLog.txt
主要的更新有兩個 :
- 新增 mpy_bin2res.py 工具可將二進檔轉為 Python 模組
- 改進了 ussl 模組, 增加 server_hostname 與 server_side 模式
# MicroPython on ESP8266 (一) : 燒錄韌體
# MicroPython v1.9.1 版韌體測試
以下為在 D1 Mini 上的測試結果 :
b▒#5 ets_task(40100164, 3, 3fff837c, 4)
Performing initial setup
OSError: [Errno 2] ENOENT
MicroPython v1.9.2-8-gbf8f45cf on 2017-08-23; ESP module with ESP8266
Type "help()" for more information.
>>> import port_diag #系統診斷
FlashROM:
Flash ID: 1640e0 (Vendor: e0 Device: 4016)
Flash bootloader data:
Byte @2: 02
Byte @3: 40 (Flash size: 4MB Flash freq: 40MHZ)
Firmware checksum:
size: 601120 #韌體 bytes 數
md5: ac146b0593c8dd61b2b032233bc4a417
True #韌體完好無損
Networking:
STA ifconfig: ('0.0.0.0', '0.0.0.0', '0.0.0.0', '208.67.222.222')
AP ifconfig: ('192.168.4.1', '255.255.255.0', '192.168.4.1', '208.67.222.222')
Free WiFi driver buffers of type:
0: 8 (1,2 TX)
1: 0 (4 Mngmt TX(len: 0x41-0x100))
2: 8 (5 Mngmt TX (len: 0-0x40))
3: 4 (7)
4: 7 (8 RX)
lwIP PCBs:
Active PCB states:
Listen PCB states:
TIME-WAIT PCB states:
>>> import esp
>>> esp.check_fw() #檢查韌體是否有問題
size: 601120
md5: ac146b0593c8dd61b2b032233bc4a417
True #True 表示韌體正常無損壞
>>> import os
>>> os.uname() #檢查韌體備註 (版本與釋出日期)
(sysname='esp8266', nodename='esp8266', release='2.0.0(5a875ba)', version='v1.9.2-8-gbf8f45cf on 2017-08-23', machine='ESP module with ESP8266')
>>> import os
>>> os.listdir() #檢查檔案系統初始內容
['boot.py'] #只有 boot.py 一個檔案
>>> import os
>>> os.statvfs("/") #查詢檔案之記憶體占用情形
(4096, 4096, 860, 852, 852, 0, 0, 0, 0, 255) #總共 860 區塊, 可用 852 區塊
... print('File: {} stats: {}'.format(f, os.stat(f))) #檢查檔案系統使用情形
...
...
...
File: boot.py stats: (32768, 0, 0, 0, 0, 0, 162, 0, 0, 0) #boot.py 占 162 bytes
>>> f=open('boot.py','r') #開啟檔案 boot.py
>>> ls=f.readlines() #顯示檔案內容>>> for i in ls:
... print(i)
...
...
...
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import gc
#import webrepl
#webrepl.start()
gc.collect()
>>> import webrepl_setup
WebREPL daemon auto-start status: disabled
Would you like to (E)nable or (D)isable it running on boot?
(Empty line to quit)
> E #大寫 E 為啟動
To enable WebREPL, you must set password for it
New password: 123456 #WebREPL 登入密碼
Confirm password: 123456
Changes will be activated after reboot
Would you like to reboot now? (y/n) y #小寫 y 重新啟動才會生效 (不可用大寫 Y)
重新開機 WebREPL 才會生效 :
lÜŸ<ÿƒ{g#‡þ#5 ets_task(40100164, 3, 3fff837c, 4)
WebREPL daemon started on ws://192.168.4.1:8266
WebREPL daemon started on ws://0.0.0.0:8266
Started webrepl in normal mode
MicroPython v1.9.2-8-gbf8f45cf on 2017-08-23; ESP module with ESP8266
Type "help()" for more information.
>>> import os
>>> os.listdir()
['boot.py', 'webrepl_cfg.py']
>>>
>>> f=open('webrepl_cfg.py','r')
>>> ls=f.readlines()
>>> for i in ls:
... print(i)
...
...
...
PASS = '123456'
可見啟動 WebREPL 後, 根目錄下多了 webrepl_cfg.py 這檔案, 其內容就是密碼 PASS 而已.
沒有留言 :
張貼留言