Josverl / micropython-stubber

Generate and maintain stubs for different MicroPython ports to use with VSCode and Pylance, PyRight, Thonny, PyCharm or MyPy
https://micropython-stubber.readthedocs.io
Other
175 stars 14 forks source link

MPflash: unable to flash rp2040 /.uf2 on macos #557

Closed Josverl closed 3 months ago

Josverl commented 5 months ago

To round off the test on the rpi pico, no luck so far. I had done a mpflash download and it downloaded the appropriate mp. I then did a mpflash flash and got a choice of port / board to select but got some errors about something would only run on linux when appropriate choices were made. I did not take a note of this as to start with I wanted to get rid of some of those ports I no longer use as your program took some while to examine them. Now, whilst I can see the pico in the mpflash list, a mpflash download reports already downloaded, but a mpflash flash now never gets to the point of providing a list of what to flash. I always just get the following:

image

Originally posted by @beetlegigg in https://github.com/micropython/micropython/discussions/14395#discussioncomment-9310160

Josverl commented 4 months ago

@Beetlegigg,

Can you try to update to mpflash 0.7.7 and tru to run 2 variants of the command and share the output. Also can you check if you see any (USB) drive mounting during either variant ?

  1. mpflash --verbose flash
  2. mpflash --verbose --test macos_uf2 flash
beetlegigg commented 4 months ago

Hi Jos, Here is the output of the latest test copied from the terminal - see the commands you requested highlighted in blue bold after a scroll down the output text. Also to note is that, at the end of my test, I saw that a rpi disk had been created on the desktop, the same as if manually holding the rpi boot button on power on.

Successfully installed jsons-1.6.3 mpflash-0.7.7 typish-1.9.3

mpflash --verbose flash

*iMacBG*:~:% mpflash --version
mpflash, version 0.7.7
*iMacBG*:~:% mpflash --verbose flash
21:42:19 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
β ΄ Scanning cu.Bluetooth-Incoming-Port ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0:00:0221:42:22 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m
mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
β Έ Scanning cu.Bluetooth-Incoming-Port ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0:00:0521:42:25 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m
mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
Error: Failed to get mcu_info for /dev/cu.Bluetooth-Incoming-Port
β ‡ Scanning cu.Bluetooth-Incoming-Port ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0:00:0721:42:27 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m
mpremote
connect /dev/cu.usbmodem141101 run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
21:42:27 | 🐞 *FlashParams(*ports=*[*'rp2'*]*, boards=*[*'PICO'*]*,
versions=*[*'stable'*]*,
fw_folder=*PosixPath(*'/Users/BG/Downloads/firmware'*)*, serial='auto',
erase=*True*,
bootloader=*True*, cpu=*None**)*
21:42:27 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
21:42:30 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
21:42:33 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
21:42:35 | ❌ *Error connecting to boards: Failed to get mcu_info for *
*/dev/cu.Bluetooth-Incoming-Port*
21:42:35 | ❌ *No boards were flashed*
*iMacBG*:~:% mpflash --verbose --test macos_uf2 flash
21:43:25 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
β ΄ Scanning cu.Bluetooth-Incoming-Port ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0:00:0221:43:28 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m
mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
β Έ Scanning cu.Bluetooth-Incoming-Port ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0:00:0521:43:32 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m
mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
Error: Failed to get mcu_info for /dev/cu.Bluetooth-Incoming-Port
β ‡ Scanning cu.Bluetooth-Incoming-Port ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0:00:0721:43:34 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m
mpremote
connect /dev/cu.usbmodem141101 run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py

21:43:34 | 🐞 *FlashParams(*ports=*[*'rp2'*]*, boards=*[*'PICO'*]*,
versions=*[*'stable'*]*,
fw_folder=*PosixPath(*'/Users/BG/Downloads/firmware'*)*, serial='auto',
erase=*True*,
bootloader=*True*, cpu=*None**)*
21:43:34 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
21:43:37 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
21:43:40 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.Bluetooth-Incoming-Port run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremotebo
ard/mpy_fw_info.py
21:43:42 | ❌ *Error connecting to boards: Failed to get mcu_info for *
*/dev/cu.Bluetooth-Incoming-Port*
21:43:42 | ❌ *No boards were flashed*
*iMacBG*:~:% mpflash list
Error: Failed to get mcu_info for /dev/cu.Bluetooth-Incoming-Port

                           Connected boards
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓
┃*Ser.                      *┃*Fam.*┃*Board                        *┃
*Version*┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩
β”‚cu.Bluetooth-Incoming-Portβ”‚unknβ”‚                             β”‚       β”‚
β”‚cu.usbmodem141101         β”‚upy β”‚PICO                         β”‚v1.19.1β”‚
β”‚                          β”‚    β”‚*Raspberry Pi Pico with RP2040*β”‚       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
*iMacBG*:~:% mpflash --ignore cu.Bluetooth-Incoming-Port list
Error: Failed to get mcu_info for /dev/cu.Bluetooth-Incoming-Port

                                     Connected boards

┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━┓
┃*Serial                    *┃*Family     *┃*Port*┃*Board
      *┃*CPU   *┃*Version*┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━┩
β”‚cu.Bluetooth-Incoming-Portβ”‚unknown    β”‚    β”‚
β”‚      β”‚       β”‚
β”‚cu.usbmodem141101         β”‚micropythonβ”‚rp2 β”‚PICO
β”‚RP2040β”‚v1.19.1β”‚
β”‚                          β”‚           β”‚    β”‚*Raspberry Pi Pico with RP2040*β”‚
    β”‚       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
*iMacBG*:~:% mpflash --ignore /dev/cu.Bluetooth-Incoming-Port list

                                Connected boards

┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━┓
┃*Serial           *┃*Family     *┃*Port*┃*Board                        *┃*CPU
  *┃*Version*┃
┑━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━┩
β”‚cu.usbmodem141101β”‚micropythonβ”‚rp2 β”‚PICO
β”‚RP2040β”‚v1.19.1β”‚
β”‚                 β”‚           β”‚    β”‚*Raspberry Pi Pico with RP2040*β”‚      β”‚
      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
*iMacBG:~:% mpflash --ignore /dev/cu.Bluetooth-Incoming-Port --verbose
flash*
21:47:49 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.usbmodem141101 run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremoteboard/mpy_fw_info.py

21:47:49 | 🐞 *FlashParams(*ports=*[*'rp2'*]*, boards=*[*'PICO'*]*,
versions=*[*'stable'*]*, fw_folder=*PosixPath(*
'/Users/BG/Downloads/firmware'*)*, serial='auto',
erase=*True*, bootloader=*True*, cpu=*None**)*
21:47:49 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.usbmodem141101 run
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremoteboard/mpy_fw_info.py
21:47:50 | ℹ️ *Try (2) to find a firmware for the board PICO*
21:47:50 | ℹ️ *Found v1.22.2 firmware rp2/RPI_PICO-v1.22.2.uf2 for PICO on
/dev/cu.usbmodem141101.*
21:47:50 | ℹ️ *Updating PICO on /dev/cu.usbmodem141101 to 1.22.2*
21:47:50 | ℹ️ *Entering bootloader on PICO on /dev/cu.usbmodem141101*
21:47:50 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect /dev/cu.usbmodem141101 resume bootloader
21:47:52 | ℹ️ *Erasing not yet implemented for UF2 flashing.*
21:47:52 | ⚠️ OS darwin not tested/supported
Traceback (most recent call last):
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/blkinfo/wrappers.py",
line 58, in __init__
    self._disks = LsBlkWrapper._build_disk_tree()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/blkinfo/wrappers.py",
line 132, in _build_disk_tree
    disk_info_list = subprocess.check_output(['lsblk', '-a', '-n', '-r',
'-b', '-o', filter_str])

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/subprocess.py",
line 465, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/subprocess.py",
line 546, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/subprocess.py",
line 1022, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/subprocess.py",
line 1899, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'lsblk'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/BG/.pyenv/versions/3.11.0/bin/mpflash", line 8, in <module>
    sys.exit(mpflash())
             ^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/cli_main.py",
line 20, in mpflash
    result = cli(standalone_mode=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/rich_click/rich_command.py",
line 360, in __call__
    return super().__call__(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/click/core.py",
line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/rich_click/rich_command.py",
line 152, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/click/core.py",
line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/click/core.py",
line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/click/core.py",
line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/cli_flash.py",
line 171, in cli_flash_board
    if flashed := flash_list(
                  ^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/flash.py",
line 37, in flash_list
    updated = flash_uf2(mcu, fw_file=fw_file, erase=erase)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/flash_uf2.py",
line 52, in flash_uf2
    destination = wait_for_UF2_linux()
                  ^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/flash_uf2_linux.py",
line 107, in wait_for_UF2_linux
    uf2_drives += list(get_uf2_drives())
                  ^^^^^^^^^^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/flash_uf2_linux.py",
line 28, in get_uf2_drives
    myblkd = BlkDiskInfo()
             ^^^^^^^^^^^^^
  File
"/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/blkinfo/wrappers.py",
line 60, in __init__
    raise NoLsblkFound('lsblk command-line tool from util-linux package is
not found.')
blkinfo.errors.NoLsblkFound: lsblk command-line tool from util-linux
package is not found.

--test macos_uf2

*iMacBG:~:% mpflash --ignore /dev/cu.Bluetooth-Incoming-Port --verbose
--test macos_uf2 flash*

[?] Which serial port do you want to flash ?:
   /dev/cu.Bluetooth-Incoming-Port n/a
 + Other
[?] Which serial port do you want to flash ?: cu.usbmodem141101

[?] Which port do you want to flash to cu.usbmodem141101 ?:
   esp32
   esp8266
   mimxrt
   nrf
   renesas-ra
 > rp2
   samd
   stm32

[?] Which rp2 board firmware do you want to flash to cu.usbmodem141101 ?:
   v1.22.2 GARATRONIC_PYBSTICK26_RP2040
   v1.22.2 Pimoroni Pico LiPo 16MB
   v1.22.2 Pimoroni Pico LiPo 4MB
   v1.22.2 Pimoroni Tiny 2040
   v1.22.2 Pololu 3pi+ 2040 Robot
   v1.22.2 Pololu Zumo 2040 Robot
 > v1.22.2 Raspberry Pi Pico
   v1.22.2 Raspberry Pi Pico W
   v1.22.2 Silicognition RP2040-Shim
   v1.22.2 SparkFun Pro Micro RP2040
   v1.22.2 SparkFun Thing Plus RP2040
   v1.22.2 W5100S-EVB-Pico
   v1.22.2 W5500-EVB-Pico

21:50:53 | 🐞 *FlashParams(*ports=*[*'rp2'*]*, boards=*[*'RPI_PICO'*]*,
versions=*[*'stable'*]*, fw_folder=*PosixPath(*
'/Users/BG/Downloads/firmware'*)*,
serial='cu.usbmodem141101', erase=*True*, bootloader=*True*, cpu=*None**)*
21:50:53 | ℹ️ *Updating RPI_PICO on cu.usbmodem141101 to 1.22.2*
21:50:53 | ℹ️ *Entering bootloader on RPI_PICO on cu.usbmodem141101*
21:50:53 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote
connect cu.usbmodem141101 bootloader
21:50:53 | ℹ️ *failed to access cu.usbmodem141101 (it may be in use by
another program)*
21:50:55 | ℹ️ *Erasing not yet implemented for UF2 flashing.*
21:50:55 | ⚠️ OS darwin not tested/supported
Waiting for mcu to mount as a drive
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--21:50:55 | ❌ *pumount
only works on Linux*
21:50:55 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--21:50:56 | ❌ *pumount
only works on Linux*
21:50:56 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  10% -:--:--21:50:57 | ❌ *pumount
only works on Linux*
21:50:57 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  20% 0:00:0921:50:58 | ❌ *pumount
only works on Linux*
21:50:58 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━  30% 0:00:0821:50:59 | ❌ *pumount
only works on Linux*
21:50:59 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━  40% 0:00:0621:51:00 | ❌ *pumount
only works on Linux*
21:51:00 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━  50% 0:00:0621:51:01 | ❌ *pumount
only works on Linux*
21:51:01 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━  60% 0:00:0521:51:02 | ❌ *pumount
only works on Linux*
21:51:02 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━  70% 0:00:0421:51:03 | ❌ *pumount
only works on Linux*
21:51:03 | ❌ *pumount only works on Linux*
Waiting for mcu to mount as a drive
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━  80% 0:00:0321:51:04 | ❌ *pumount
only works on Linux*
21:51:04 | ❌ *pumount only works on Linux*
21:51:05 | ❌ *Board is not in bootloader mode*
21:51:05 | ❌ *Failed to flash RPI_PICO on cu.usbmodem141101*
21:51:05 | ❌ *No boards were flashed*
*iMacBG*:~:%

On 7 May 2024, at 21:38, Jos Verlinde @.***> wrote:

@beetlegigg https://github.com/beetlegigg,

Can you try to update to mpflash 0.7.7 and tru to run 2 variants of the command and share the output. Also can you check if you see any (USB) drive mounting during either variant ?

  1. mpflash --verbose flash
  2. mpflash --verbose --test macos_uf2 flash

β€” Reply to this email directly, view it on GitHub https://github.com/Josverl/micropython-stubber/issues/557#issuecomment-2099268133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIHTXIKYVXE3PHYZ46GOGZDZBE3UVAVCNFSM6AAAAABHHCK2YOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGI3DQMJTGM . You are receiving this because you were mentioned.Message ID: @.***>

Josverl commented 4 months ago

@beetlegigg, @andypiper,

I tried my hand at a new version of the MacOS flashing of UF2 devices. install with pip install mpflash==0.8.1b1

beetlegigg commented 4 months ago

@Josverl Re. MacOS. The list looks better :-), but it does not seem to want to download a newer version - screenshot attached below

image

It creates a 'firmware' folder in my Download folders that contains a file firmware.jsonl but the file has zero bytes. I note that you indicate that the latest V1.23 is not yet downloadable, but it did not download the available V1.22.2.
Thanks for your continued efforts on this.

Josverl commented 4 months ago

The default version is stable which is resolved of the published GitHub tags, and is currently v1.23.0. (but not downloadable)

If you use --version preview or --version 1.22.2 or -v ?with the download and flash commands that should use these versions

beetlegigg commented 4 months ago

Thanks for the suggestion but still cannot download, am I putting in the commands incorrectly?

image
Josverl commented 4 months ago

using mpflash -VV download -v ? (with a space) should:

meanwhile version v1.23.0 is available for download - so there is no specific need to specify a different version anymore.

to test just the download part : using mpflash -VV download --board RPI_PICO

πŸ’‘: Typing that last command makes me think of the fact that the BOARD_ID of the PICO board has changed in a recent version from PICO to RPI_PICO. I try to accommodate for that, but it seems you have found a bug in that part of the code.

if you can download it , then the command to flash would need to specify --board RPI_PICO as well. so something like mpflash -VV flash --serial ? --board RPI_PICO

I will check later tonight if I can repro wrt to PICO/RPI_PICO and and sanity check why it slipped through the unit tests

beetlegigg commented 4 months ago

@Josverl Thanks for the info, I gave it another go and some good success, but it seems to report a 1.24 preview rather than the 1.23 stable release. I checked again with mpflash list and indeed it shows:

image

Connecting to the board with Thonny it reports

image

so not a 1.24 preview but an earlier v1.23 preview release.

Here is the terminal output of my endeavours:

iMacBG:~:% mpflash list

                                Connected boards                                 
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━┓
┃Serial           ┃Family     ┃Port┃Board                        ┃CPU   ┃Version┃
┑━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━┩
β”‚cu.usbmodem141301β”‚micropythonβ”‚rp2 β”‚PICO                         β”‚RP2040β”‚v1.19.1β”‚
β”‚                 β”‚           β”‚    β”‚Raspberry Pi Pico with RP2040β”‚      β”‚       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
iMacBG:~:% mpflash -VV download --board RPI_PICO
21:46:32 | ✏️ ask_missing_params: DownloadParams(ports=['rp2'], boards=['RPI_PICO'], versions=['stable'], 
fw_folder=PosixPath('/Users/BG/Downloads/firmware'), serial=['*'], ignore=[], clean=True, force=False)
21:46:32 | ✏️ answers: {'action': 'download', 'versions': ['stable']}
21:46:32 | ✏️ ask_missing_params returns: DownloadParams(ports=['rp2'], boards=['RPI_PICO'], versions=['stable'], 
fw_folder=PosixPath('/Users/BG/Downloads/firmware'), serial=['*'], ignore=[], clean=True, force=False)
21:46:34 | ✏️ Using latest stable version: v1.23.0
21:46:34 | ✏️ Checking MicroPython download pages
21:46:34 | 🐞 Total 17 firmwares
21:46:34 | 🐞 Matching firmwares: 2
21:46:34 | 🐞 Last preview only: 1
21:46:34 | 🐞 RPI_PICO-v1.23.0-5.uf2
21:46:34 | ℹ️ Found 1 relevant unique firmwares
21:46:34 | ℹ️ Downloading https://micropython.org/resources/firmware/RPI_PICO-20240531-v1.23.0-5.g3613ad962.uf2
21:46:34 | ℹ️          to /Users/BG/Downloads/firmware/rp2/RPI_PICO-v1.23.0-5.uf2
21:46:35 | ℹ️ Downloaded 1 firmwares, skipped 0 existing files.
iMacBG:~:% mpflash -VV flash --serial ? --board RPI_PICO
zsh: no matches found: ?
iMacBG:~:% mpflash -VV flash --serial  --board RPI_PICO 
21:47:33 | ❌ Error: Got unexpected extra argument (RPI_PICO)
iMacBG:~:% mpflash -VV flash --board RPI_PICO          
21:48:00 | ✏️ ask_missing_params: FlashParams(ports=(), boards=['RPI_PICO'], versions=['stable'], 
fw_folder=PosixPath('/Users/BG/Downloads/firmware'), serial=['*'], ignore=[], erase=True, bootloader=True, cpu=None)
21:48:00 | ✏️ answers: {'action': 'flash', 'serial': ['*'], 'versions': ['stable']}
21:48:00 | ✏️ ask_missing_params returns: FlashParams(ports=[], boards=['RPI_PICO'], versions=['stable'], 
fw_folder=PosixPath('/Users/BG/Downloads/firmware'), serial=['*'], ignore=[], erase=True, bootloader=True, cpu=None)
21:48:02 | ✏️ Using latest stable version: v1.23.0
21:48:02 | ✏️ No boards detected yet, scanning for connected boards
21:48:02 | ✏️ include=['*'], ignore=[], bluetooth=False
21:48:02 | ✏️ comports: ['/dev/cu.Bluetooth-Incoming-Port', '/dev/cu.usbmodem141301']
21:48:02 | ✏️ no Bluetooth: ['/dev/cu.usbmodem141301']
21:48:02 | 🐞 filtered_comports: ['/dev/cu.usbmodem141301']
21:48:02 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote connect /dev/cu.usbmodem141301 run 
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremoteboard/mpy_fw_info.py

21:48:03 | ✏️ Auto updating all boards to v1.23.0
21:48:03 | ✏️ include=['*'], ignore=[], bluetooth=False
21:48:03 | ✏️ comports: ['/dev/cu.Bluetooth-Incoming-Port', '/dev/cu.usbmodem141301']
21:48:03 | ✏️ no Bluetooth: ['/dev/cu.usbmodem141301']
21:48:03 | 🐞 filtered_comports: ['/dev/cu.usbmodem141301']
21:48:03 | ℹ️ Try (2) to find a firmware for the board PICO
21:48:03 | ℹ️ Found v1.23.0 firmware rp2/RPI_PICO-v1.23.0-5.uf2 for PICO on /dev/cu.usbmodem141301.
21:48:03 | ℹ️ Updating PICO on /dev/cu.usbmodem141301 to 1.23.0
21:48:03 | ℹ️ Entering bootloader on PICO on /dev/cu.usbmodem141301
21:48:03 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote connect /dev/cu.usbmodem141301 resume bootloader
21:48:05 | ℹ️ Erasing not yet implemented for UF2 flashing.
21:48:05 | ⚠️ OS darwin not tested/supported
21:48:05 | ℹ️ Board is in bootloader mode
21:48:05 | ✏️ Found Board-ID=RPI-RP2
21:48:05 | ℹ️ Board ID: RPI-RP2
21:48:05 | ℹ️ Copying /Users/BG/Downloads/firmware/rp2/RPI_PICO-v1.23.0-5.uf2 to /Volumes/RPI-RP2.
21:48:05 | βœ… Done copying, resetting the board and wait for it to restart
21:48:12 | ℹ️ Flashed 1 boards
Updating board info ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--21:48:12 | 🐞 /Users/BG/.pyenv/versions/3.11.0/bin/python3.11 -m mpremote connect /dev/cu.usbmodem141301 resume run 
/Users/BG/.pyenv/versions/3.11.0/lib/python3.11/site-packages/mpflash/mpremoteboard/mpy_fw_info.py
                              Updated boards after flashing                              
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━┓
┃Serial           ┃Family     ┃Port┃Board                        ┃CPU   ┃Version        ┃
┑━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━┩
β”‚cu.usbmodem141301β”‚micropythonβ”‚rp2 β”‚RPI_PICO                     β”‚RP2040β”‚v1.24.0-previewβ”‚
β”‚                 β”‚           β”‚    β”‚Raspberry Pi Pico with RP2040β”‚      β”‚               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
iMacBG:~:% 
Josverl commented 4 months ago

OK, we're moving forward slowly, What is the current mpflash --version you are running?

Josverl commented 4 months ago

Failed download of PICO firmware The issue is that the download command is unable to find the PICO image as the firmware images have been renamed in v1.20.0. Likely a similar issue exists for some other boards that were renamed at the same time. I will create a separate issue to track that.

.UF2 flashing As I understand that the .UF2 flashing part now works thanks to your testing. Much appreciated I have updated mpflash v0.8.2 to use that as standard

Josverl commented 3 months ago

Update : pip install -U mpflash should now get you v0.8.2 (is now actually published)

Josverl commented 3 months ago

AFAIK this should now work fine. Please do feel free to re-open if this fails.

beetlegigg commented 3 months ago

Thanks, I gave it a try with a rpi pico and a rpi pico W and both worked perfectly. I then tried a arduino rp2040 connect and it flashed the latest, programs would run, but somehow it lost the ability to load files on the board (probably nothing to do with the MPFlash). I then tried a UM feather ESP32 S3 and this did not work and I had a bunch of error messages. I have not had the time to investigate and make a sensible report on the attempts with these last two boards and I wont have a chance to have another play for a month or so. Many thanks for getting the pico variants working and I hope to have another go with this in a few months time.