如何在 ESP32 上使用 micropython 绕过 boot.py?

问题描述

我有一个带有 micropython 固件的 ESP32 开发板。我在 boot.py 中的应用程序在加电时开始正常。 但是现在我想更改boot.py。如果我尝试通过 rshell 连接,我会出错。我猜这是因为一个应用程序已经在 ESP32 上运行了。

如何在 ESP32 启动(安全模式?)时绕过 boot.py?

错误信息:

$ rshell -p COM3
Using buffer-size of 32
Connecting to COM3 (buffer-size 32)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... b"Connection successful\r\n('192.168.1.122','255.255.255.0','192.168.1.1','192.168.1.1')\r\nets Jun  8 2016 00:22:57\r\n\r\nrst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)\r\nconfigsip: 0,SPIWP:0xee\r\nclk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00\r\nmode:dio,clock div:2\r\nload:0x3fff0018,len:4\r\nload:0x3fff001c,len:5008\r\nho 0 tail 12 room 4\r\nload:0x40078000,len:10600\r\nho 0 tail 12 room 4\r\nload:0x40080400,len:5684\r\nentry 0x400806bc\r\n\x1b[0;32mI (539) cpu_start: Pro cpu up.\x1b[0m\r\n\x1b[0;32mI (539) cpu_start: Application information:\x1b[0m\r\n\x1b[0;32mI (539) cpu_start: Compile time:     Sep  2 2020 03:00:08\x1b[0m\r\n\x1b[0;32mI (542) cpu_start: ELF file SHA256:  0000000000000000...\x1b[0m\r\n\x1b[0;32mI (548) cpu_start: ESP-IDF:          v3.3.2\x1b[0m\r\n\x1b[0;32mI (553) cpu_start: Starting app cpu,entry point is 0x40082f30\x1b[0m\r\n\x1b[0;32mI (0) cpu_start: App cpu up.\x1b[0m\r\n\x1b[0;32mI (564) heap_init: Initializing. RAM available for dynamic allocation:\x1b[0m\r\n\x1b[0;32mI (571) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (577) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (583) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (589) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (595) heap_init: At 3FFCA9E8 len 00015618 (85 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (601) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM\x1b[0m\r\n\x1b[0;32mI (607) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM\x1b[0m\r\n\x1b[0;32mI (614) heap_init: At 4009DE28 len 000021D8 (8 KiB): IRAM\x1b[0m\r\n\x1b[0;32mI (620) cpu_start: Pro cpu start user code\x1b[0m\r\n\x1b[0;32mI (303) cpu_start: Starting scheduler on PRO cpu.\x1b[0m\r\n\x1b[0;32mI (0) cpu_start: Starting scheduler on APP cpu.\x1b[0m\r\n\x1b[0;32mI (190) modsocket: Initializing\x1b[0m\r\n\x1b[0;32mI (905) phy: phy_version: 4180,cb3948e,Sep 12 2019,16:39:13,0\x1b[0m\r\nets Jun  8 2016 00:22:57\r\n\r\nrst:0x1 (POWERON_RESET),0\x1b[0m\r\nConnection successful\r\n('192.168.1.122','192.168.1.1')\r\n"
Traceback (most recent call last):
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 1307,in connect
    ip_address = socket.gethostbyname(port)
socket.gaierror: [Errno 11001] getaddrinfo Failed

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ue73011\AppData\Local\Programs\Python\python38-32\Scripts\rshell-script.py",line 11,in <module>
    load_entry_point('rshell==0.0.28','console_scripts','rshell')()
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\command_line.py",line 4,in main
    rshell.main.main()
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 2966,in main
    real_main()
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 2928,in real_main
    connect(args.port,baud=args.baud,wait=args.wait,user=args.user,password=args.password)
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 1313,in connect
    connect_serial(port,baud=baud,wait=wait)
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 1337,in connect_serial
    dev = DeviceSerial(port,baud,wait)
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 1627,in __init__
    Device.__init__(self,pyb)
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 1391,in __init__
    unhexlify_exists = self.remote_eval(test_unhexlify)
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 1515,in remote_eval
    return eval(self.remote(func,*args,**kwargs))
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\main.py",line 1493,in remote
    self.pyb.enter_raw_repl()
  File "c:\users\ue73011\appdata\local\programs\python\python38-32\lib\site-packages\rshell\pyboard.py",line 209,in enter_raw_repl
    raise PyboardError('Could not enter raw repl')
rshell.pyboard.PyboardError: Could not enter raw repl

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)