prremote 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -13
- data/VERSION +1 -1
- data/lib/prremote/esp_flasher.rb +29 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfce7ce99a7bd04bbfde40aad5c53640f14f1ad90da41998c7399e6366d25198
|
|
4
|
+
data.tar.gz: d60e5701e6d42baf78a82a6d7d919d3bb5664cd34cb9cb02cdf7a2a749368121
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fd70f1266d67f8f41aef2018c102d4827c53cb103f304a16d40f78ee618c99556bc45fbc94447f66ff4e157f5318ff5b62956e8edf5dd1d1acda5a53ac1d94d
|
|
7
|
+
data.tar.gz: 70372664611e75517b6ea974ff85b222ecb6b53944ffdc345f423e6c15720b4daeedc84cdba20e5338c3c754f6090ac1aeb605ef34f498f1a4a6849236b62c31
|
data/README.md
CHANGED
|
@@ -18,9 +18,9 @@ Inspired by [mpremote](https://docs.micropython.org/en/latest/reference/mpremote
|
|
|
18
18
|
|
|
19
19
|
- Ruby 3.4 or later
|
|
20
20
|
- Supported boards:
|
|
21
|
-
- Raspberry Pi Pico W / Pico
|
|
22
|
-
- ESP32 (classic) — e.g. M5GO / M5Stack Core gen1, generic dev boards
|
|
23
|
-
- ESP32-C6 (RISC-V) — e.g. Seeed Studio XIAO ESP32C6
|
|
21
|
+
- [Raspberry Pi Pico W](https://www.raspberrypi.com/products/raspberry-pi-pico-w/) / [Pico](https://www.raspberrypi.com/products/raspberry-pi-pico/)
|
|
22
|
+
- ESP32 (classic) — e.g. [M5GO / M5Stack Core gen1](https://docs.m5stack.com/en/core/m5go), generic [ESP32](https://www.espressif.com/en/products/socs/esp32) dev boards
|
|
23
|
+
- ESP32-C6 (RISC-V) — e.g. [Seeed Studio XIAO ESP32C6](https://wiki.seeedstudio.com/xiao_esp32c6_getting_started/)
|
|
24
24
|
- `mrbc` (mruby 4.x) for `run`, `deploy`, and `eval`
|
|
25
25
|
- macOS: `brew install mruby`
|
|
26
26
|
- Linux: build from source — [github.com/mruby/mruby/releases](https://github.com/mruby/mruby/releases)
|
|
@@ -74,7 +74,11 @@ The firmware is downloaded from GitHub Releases on first use and cached in `~/.p
|
|
|
74
74
|
|
|
75
75
|
Pico boards: put the device into BOOTSEL mode (hold BOOTSEL, connect USB, release) when prompted.
|
|
76
76
|
|
|
77
|
-
ESP32
|
|
77
|
+
ESP32 (classic): no button dance and no extra tools needed — the firmware is written over the serial port by prremote's pure-Ruby implementation of the Espressif bootloader protocol (the chip is reset into its boot ROM automatically, and the write is verified with an on-chip MD5).
|
|
78
|
+
|
|
79
|
+
ESP32-C6: flashing is delegated to [esptool](https://docs.espressif.com/projects/esptool/en/latest/), because the C6 boot ROM rejects the direct write the classic ESP32 accepts. Install it first (`brew install esptool`, or `pip3 install esptool`), and put the board into bootloader mode when prompted — on the XIAO ESP32C6, hold **BOOT**, press **RST**, then release both.
|
|
80
|
+
|
|
81
|
+
Reflashing the runtime does not erase a deployed script on either chip.
|
|
78
82
|
|
|
79
83
|
---
|
|
80
84
|
|
|
@@ -128,7 +132,7 @@ Evaluate a Ruby one-liner on the device.
|
|
|
128
132
|
|
|
129
133
|
```bash
|
|
130
134
|
prremote eval "puts 1 + 1"
|
|
131
|
-
prremote eval "
|
|
135
|
+
prremote eval "GPIO.led.write 1"
|
|
132
136
|
```
|
|
133
137
|
|
|
134
138
|
---
|
|
@@ -172,8 +176,8 @@ Show the gem version, mrbc version, and the connected device's runtime version.
|
|
|
172
176
|
|
|
173
177
|
```bash
|
|
174
178
|
prremote version
|
|
175
|
-
# prremote: 0.
|
|
176
|
-
# runtime: 0.
|
|
179
|
+
# prremote: 0.3.0
|
|
180
|
+
# runtime: 0.3.0 (/dev/tty.usbmodem101)
|
|
177
181
|
# mrbc: mruby 4.0.0 (2026-04-20) (/opt/homebrew/bin/mrbc)
|
|
178
182
|
```
|
|
179
183
|
|
|
@@ -218,7 +222,7 @@ prremote flashes a minimal C firmware (built on mruby/c) onto the Pico W. The fi
|
|
|
218
222
|
- `DPLY` + `.mrb` bytecode → save to flash and confirm with `DEPLOYED` (`deploy`)
|
|
219
223
|
3. Waits for the next command
|
|
220
224
|
|
|
221
|
-
Scripts saved via `deploy` are stored in flash and run automatically on every boot. GPIO / ADC / PWM / I2C / SPI bindings are available on all boards; WiFi
|
|
225
|
+
Scripts saved via `deploy` are stored in flash and run automatically on every boot. GPIO / ADC / PWM / I2C / SPI bindings are available on all boards; a `WiFi` module on boards with a radio (Pico W and ESP32); an `LCD` class (ILI9342C) on ESP32 / M5Stack.
|
|
222
226
|
|
|
223
227
|
---
|
|
224
228
|
|
|
@@ -284,8 +288,4 @@ bundle exec rake test
|
|
|
284
288
|
|
|
285
289
|
- [mruby/c](https://github.com/mrubyc/mrubyc) — Lightweight mruby implementation used in the runtime
|
|
286
290
|
- [picotool](https://github.com/raspberrypi/picotool) — Official Raspberry Pi tool for inspecting and managing Pico devices; useful for checking what's on flash or force-rebooting outside of prremote
|
|
287
|
-
- [mpremote](https://docs.micropython.org/en/latest/reference/mpremote.html) — MicroPython equivalent (inspiration)
|
|
288
|
-
|
|
289
|
-
https://wiki.seeedstudio.com/ja/xiao_esp32c6_getting_started/
|
|
290
|
-
|
|
291
|
-
brew install esptool
|
|
291
|
+
- [mpremote](https://docs.micropython.org/en/latest/reference/mpremote.html) — MicroPython equivalent (inspiration)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.3.0
|
data/lib/prremote/esp_flasher.rb
CHANGED
|
@@ -104,21 +104,42 @@ module Prremote
|
|
|
104
104
|
MSG
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
ctx = { esptool: esptool, port: port, image_path: image_path, board: board, verbose: verbose }
|
|
108
|
+
|
|
109
|
+
# USB-Serial/JTAG chips (e.g. XIAO ESP32C6) can be dropped into the
|
|
110
|
+
# download ROM over USB, so esptool's usb-reset flashes hands-free — no
|
|
111
|
+
# BOOT/RST button dance. --after hard-reset then reboots straight into the
|
|
112
|
+
# freshly flashed firmware. Verified on a physical XIAO ESP32C6.
|
|
113
|
+
return if esptool_write(ctx, before: 'usb-reset', after: 'hard-reset', connect_attempts: 7)
|
|
114
|
+
|
|
115
|
+
# Fallback for hosts/boards where usb-reset doesn't take: enter the
|
|
116
|
+
# bootloader by hand and let esptool retry forever. --before no-reset never
|
|
117
|
+
# resets the chip, so each attempt just re-sends SYNC until the manual
|
|
118
|
+
# BOOT/RST lands the board in download mode — no timeout to race against.
|
|
107
119
|
warn ''
|
|
108
|
-
warn '
|
|
120
|
+
warn "Couldn't reset #{board} automatically. Put it in bootloader mode by hand:"
|
|
109
121
|
warn ' XIAO ESP32C6: hold BOOT, press RST, release both.'
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
'--before', 'no-reset', '--after', 'no-reset',
|
|
114
|
-
'write-flash', '0x0', image_path]
|
|
115
|
-
warn "[flash] #{cmd.join(' ')}" if verbose
|
|
116
|
-
system(*cmd) or raise Error, 'esptool exited with an error'
|
|
122
|
+
warn 'No rush — esptool keeps retrying the SYNC handshake until it connects.'
|
|
123
|
+
esptool_write(ctx, before: 'no-reset', after: 'no-reset', connect_attempts: 0) or
|
|
124
|
+
raise Error, 'esptool exited with an error'
|
|
117
125
|
|
|
118
126
|
warn ''
|
|
119
127
|
warn 'Flash complete. Press RST to start the firmware.'
|
|
120
128
|
end
|
|
121
129
|
|
|
130
|
+
# Runs one `esptool write-flash 0x0 <image>` pass, returning esptool's
|
|
131
|
+
# success boolean. connect_attempts 0 = retry the connect forever.
|
|
132
|
+
# `ctx` carries the fixed invocation context (esptool/port/image_path/board/verbose).
|
|
133
|
+
def self.esptool_write(ctx, before:, after:, connect_attempts:)
|
|
134
|
+
cmd = [*ctx[:esptool],
|
|
135
|
+
'--chip', ctx[:board], '--port', ctx[:port],
|
|
136
|
+
'--connect-attempts', connect_attempts.to_s,
|
|
137
|
+
'--before', before, '--after', after,
|
|
138
|
+
'write-flash', '0x0', ctx[:image_path]]
|
|
139
|
+
warn "[flash] #{cmd.join(' ')}" if ctx[:verbose]
|
|
140
|
+
system(*cmd)
|
|
141
|
+
end
|
|
142
|
+
|
|
122
143
|
def self.find_esptool
|
|
123
144
|
dirs = ENV.fetch('PATH', '').split(File::PATH_SEPARATOR)
|
|
124
145
|
%w[esptool esptool.py].each do |exe|
|