Rename BOOTSEL to PICOBOOT, disable mass storage in bootsel mode

This commit is contained in:
Ian Gulliver
2026-04-03 17:44:32 +09:00
parent 64953ef985
commit 21ea6c9332
5 changed files with 16 additions and 16 deletions

View File

@@ -40,18 +40,18 @@ func run(buildDir string) error {
return err return err
} }
if dev != "" { if dev != "" {
fmt.Printf("Sending BOOTSEL request to %s...\n", dev) fmt.Printf("Sending PICOBOOT request to %s...\n", dev)
t, err := picoserial.Open(dev) t, err := picoserial.Open(dev)
if err != nil { if err != nil {
return err return err
} }
c := client.New(t, 2*time.Second) c := client.New(t, 2*time.Second)
err = c.BOOTSEL() err = c.PICOBOOT()
c.Close() c.Close()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "warning: BOOTSEL request failed: %v\n", err) fmt.Fprintf(os.Stderr, "warning: PICOBOOT request failed: %v\n", err)
} else { } else {
fmt.Println("Device confirmed reboot into BOOTSEL mode.") fmt.Println("Device confirmed reboot into PICOBOOT mode.")
} }
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
} }

View File

@@ -4,13 +4,13 @@
#include <tuple> #include <tuple>
#include <vector> #include <vector>
struct ResponseBOOTSEL { struct ResponsePICOBOOT {
static constexpr int8_t ext_id = 1; static constexpr int8_t ext_id = 1;
auto as_tuple() const { return std::tie(); } auto as_tuple() const { return std::tie(); }
auto as_tuple() { return std::tie(); } auto as_tuple() { return std::tie(); }
}; };
struct RequestBOOTSEL { struct RequestPICOBOOT {
static constexpr int8_t ext_id = 2; static constexpr int8_t ext_id = 2;
auto as_tuple() const { return std::tie(); } auto as_tuple() const { return std::tie(); }
auto as_tuple() { return std::tie(); } auto as_tuple() { return std::tie(); }

View File

@@ -78,12 +78,12 @@ func (c *Client) roundTrip(req any) (any, error) {
return c.receive(id) return c.receive(id)
} }
func (c *Client) BOOTSEL() error { func (c *Client) PICOBOOT() error {
resp, err := c.roundTrip(&RequestBOOTSEL{}) resp, err := c.roundTrip(&RequestPICOBOOT{})
if err != nil { if err != nil {
return err return err
} }
if _, ok := resp.(*ResponseBOOTSEL); !ok { if _, ok := resp.(*ResponsePICOBOOT); !ok {
return fmt.Errorf("unexpected response: %T", resp) return fmt.Errorf("unexpected response: %T", resp)
} }
return nil return nil

View File

@@ -2,8 +2,8 @@ package client
import "github.com/theater/picomap/lib/msgpack" import "github.com/theater/picomap/lib/msgpack"
type ResponseBOOTSEL struct{} type ResponsePICOBOOT struct{}
type RequestBOOTSEL struct{} type RequestPICOBOOT struct{}
type DeviceError struct { type DeviceError struct {
Code uint32 Code uint32
@@ -22,7 +22,7 @@ type Envelope struct {
func init() { func init() {
msgpack.RegisterExt(0, (*Envelope)(nil)) msgpack.RegisterExt(0, (*Envelope)(nil))
msgpack.RegisterExt(1, (*ResponseBOOTSEL)(nil)) msgpack.RegisterExt(1, (*ResponsePICOBOOT)(nil))
msgpack.RegisterExt(2, (*RequestBOOTSEL)(nil)) msgpack.RegisterExt(2, (*RequestPICOBOOT)(nil))
msgpack.RegisterExt(3, (*DeviceError)(nil)) msgpack.RegisterExt(3, (*DeviceError)(nil))
} }

View File

@@ -30,10 +30,10 @@ int main() {
rx_buf.clear(); rx_buf.clear();
switch (msg->type_id) { switch (msg->type_id) {
case RequestBOOTSEL::ext_id: case RequestPICOBOOT::ext_id:
send_bytes(encode_response(msg->message_id, ResponseBOOTSEL{})); send_bytes(encode_response(msg->message_id, ResponsePICOBOOT{}));
sleep_ms(100); sleep_ms(100);
reset_usb_boot(0, 0); reset_usb_boot(0, 1);
break; break;
} }
} }