2017年5月27日 星期六

MicroPython v1.9 釋出

今天在測試 ESP8266 時發現上傳 main.py 到 MicroPython 根目錄下後卻執行異常, 檢查檔案系統發現連 boot.py 也不見了, 我按照之前重建檔案系統的步驟 run 一遍, 結果還是不行. 到這地步看起來必須重燒韌體才行. 原來 MicroPython 的檔案系統也是會 crash 掉的.

連線 MicroPython 檢查是否有穩定的新版韌體釋出, 果然 5/26 推出了 1.9 的穩定版, 檔案稍大, 約 585KB 左右. 燒錄完畢開機 REPL 介面如下 :

MicroPython v1.9-8-gfcaadf92 on 2017-05-26; ESP module with ESP8266
Type "help()" for more information.
>>>
PYB: soft reboot
#6 ets_task(40100164, 3, 3fff829c, 4)
OSError: [Errno 2] ENOENT
MicroPython v1.9-8-gfcaadf92 on 2017-05-26; ESP module with ESP8266
Type "help()" for more information.
>>>

使用 ampy 查詢檔案系統, 發現這個 1.9 新版解決了 1.8.7 版預設沒檔案系統的問題了, 裡面已經有 boot.py 開機檔案 :

D:\test>ampy --port COM4 ls
boot.py

使用 get 指令將其抓回本地端, 發現其 boot.py 沒有開啟 webrepl :

D:\test>ampy --port COM4 get boot.py
# 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()

我將之前保存的 boot.py 上傳檔案系統, 蓋掉 v1.9 版預設之 boot.py :

#import esp
#esp.osdebug(None)
import gc
import webrepl
webrepl.start(password="123456")
gc.collect()

D:\test>ampy --port COM4 put boot.py

重新開機就可以使用 webrepl 了, 參考 :

# MicroPython on ESP8266 (五) : WiFi 連線與 WebREPL 測試

~~~ 20170528 補充 :

換 1.9 版韌體後發現執行 ampy 會出現 "could not enter raw repl" 錯誤 :

E:\test>ampy --port COM3 ls
b'#6 ets_task(40100164, 3, 3fff829c, 4)\r\n\r\n ets Jan  8 2013,rst cause:4, boot mode:(3,3)\r\n\r\nwdt reset\r\nload 0x40100000, len 32112, room 16 \r\ntail 0\r\nchksum 0xe0\r\nload 0x3ffe8000, len 1104, room 8 \r\ntail 8\r\nchksum 0x4d\r\nload 0x3ffe8450, len 3000, room 0 \r\ntail 8\r\nchksum 0x46\r\ncsum 0x46\r\n\x0e\xfc\x80\x0cl\x9c\x9e|\xfe\x82\x12rrnb\x8e\x8c\x0cl\xec\x12\x0c\x0cb\xecl\x0cb\xec\x8c\x9c\x9c\xe2\xe2\x0c\x8c\x0c\x0cb\x0c\x8elrl\x0el\x0cl\x9c\x9e|\xfe\x82\x12rrnb\x8e\x8cll\x9c\x1c\x82\x0c\x0cb\xec\x8c\x0cb\xec\x8c\x9c\x9c\xe2\x02\x12\x12\x02\x0cb\xec\x0c\x8elrl\x0e\x8c\x0cl\x9c\x9e|\xfe\x82\x12rrnb\x8e\x8cl\x0c\x9c\x1c\x92\x0c\x0cb\x8c\x0c\x0cb\xec\x8c\x9c\x9c\xe2\x02\x02\x8c\x0c\x0cb\xeclb\x0el\x8c\xe2\x02\xec\x12\x82n\xec\x92r\x82\xf2n|\xec\x0c\x8cl\x8eprl\x8c\xe2r\x92l\x8cl\x12\x8c\x0c\x0c\x0cl`\x02\x8c\xe2r\x92l\xecl\x12\x8c\x0c\x0c\x0cl`\x02\x8c\xe2r\x92l\x0c\x8e\x9e\x00\x8c\x0c\x0cll`\x02rl\x8e\x82rl\x8c\x9e\xe2\x8cb\x0c\x8c\x8cb\x8cb\x0cbr\x02\x02\xec\x8er\x0c\x12\x12b\xec\xf2n\xee\x80\x12nn\xe2\x10\x02\x0c\x02l\x92\xf2\x02\x0cl\x0c\x8c\x0cl\x8c\x8ell\x8e\x1e\x82\x8c\x8c\x8c\xec\x8e\x0el\x80\x02n\xfc\x00\x8c\x9e\xe2\x8cb\x0cl\x0cl\x8erp\x0c\x0c\x02\x02\x8c\x9e\xe2\x8cb\x0cl\x0c\x8cb\x1crlrlr\xf2n\x9c\xe2\x00\x8c\x0c\xec\x82\x12\x02b\xe0\x80\x8c\x8c\x0c\x8cl\xe2\x8c\x0c\xec\x8e\x1e\x02\x02\x8c\x8c\x92lb\xecb\xec\xf2n\x9c\x9e\x80\x80\x02b\xe0\x8c\x8c\x8c\x0c\x8cl\xe2\x8c\x0c\xec\x8e\x1e\x02\x02\x8c\x8c\x92lb\x0el\x0e\xec\x0cl\x9c\x9e|\xfe\x82\x12rrnb\x8e\x8c\x0cl\x9c\x9c\x0c\x0cb\x8c\x0c\x0cb\xec\x8c\x9c\x9c\x9c|\x90\x8c\x0c\x0cbl\x0clb\x0el\x02\x82\x82\x02ln\x9cl`\x02\x02\x82\x82\x02ln\x9cprl\x0e\x0c\x8el\x9c\x9e|\xfe\x82\x12rrnb\x8e\x8c\xfe#5 ets_task(40100164, 3, 3fff829c, 4)\r\nWebREPL daemon started on ws://192.168.4.1:8266\r\nWebREPL daemon started on ws://0.0.0.0:8266\r\nStarted webrepl in manual override mode\r\n\r\nMicroPython v1.9-8-gfcaadf92 on 2017-05-26; ESP module with ESP8266\r\nType "help()" for more information.\r\n>>> '
Traceback (most recent call last):
  File "c:\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python36\Scripts\ampy.exe\__main__.py", line 9, in <module>
  File "c:\python36\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\python36\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\python36\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python36\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python36\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\python36\lib\site-packages\ampy\cli.py", line 142, in ls
    for f in board_files.ls(directory):
  File "c:\python36\lib\site-packages\ampy\files.py", line 91, in ls
    self._pyboard.enter_raw_repl()
  File "c:\python36\lib\site-packages\ampy\pyboard.py", line 202, in enter_raw_repl
    raise PyboardError('could not enter raw repl')
ampy.pyboard.PyboardError: could not enter raw repl

只好使用 webrepl 或 mpfshell 了.

沒有留言 :