From 21ea6c9332fb8d032d2174f616716182d0a4f015 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Fri, 3 Apr 2026 17:44:32 +0900 Subject: [PATCH] Rename BOOTSEL to PICOBOOT, disable mass storage in bootsel mode --- cmd/load/main.go | 8 ++++---- include/protocol.h | 4 ++-- lib/client/client.go | 6 +++--- lib/client/types.go | 8 ++++---- picomap.cpp | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cmd/load/main.go b/cmd/load/main.go index 78269d1..f0b7274 100644 --- a/cmd/load/main.go +++ b/cmd/load/main.go @@ -40,18 +40,18 @@ func run(buildDir string) error { return err } 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) if err != nil { return err } c := client.New(t, 2*time.Second) - err = c.BOOTSEL() + err = c.PICOBOOT() c.Close() 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 { - fmt.Println("Device confirmed reboot into BOOTSEL mode.") + fmt.Println("Device confirmed reboot into PICOBOOT mode.") } time.Sleep(2 * time.Second) } diff --git a/include/protocol.h b/include/protocol.h index 5cf4d19..e9629ce 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -4,13 +4,13 @@ #include #include -struct ResponseBOOTSEL { +struct ResponsePICOBOOT { static constexpr int8_t ext_id = 1; auto as_tuple() const { return std::tie(); } auto as_tuple() { return std::tie(); } }; -struct RequestBOOTSEL { +struct RequestPICOBOOT { static constexpr int8_t ext_id = 2; auto as_tuple() const { return std::tie(); } auto as_tuple() { return std::tie(); } diff --git a/lib/client/client.go b/lib/client/client.go index 9b7cb6b..0859c96 100644 --- a/lib/client/client.go +++ b/lib/client/client.go @@ -78,12 +78,12 @@ func (c *Client) roundTrip(req any) (any, error) { return c.receive(id) } -func (c *Client) BOOTSEL() error { - resp, err := c.roundTrip(&RequestBOOTSEL{}) +func (c *Client) PICOBOOT() error { + resp, err := c.roundTrip(&RequestPICOBOOT{}) if err != nil { return err } - if _, ok := resp.(*ResponseBOOTSEL); !ok { + if _, ok := resp.(*ResponsePICOBOOT); !ok { return fmt.Errorf("unexpected response: %T", resp) } return nil diff --git a/lib/client/types.go b/lib/client/types.go index 5a7b347..e48ff7d 100644 --- a/lib/client/types.go +++ b/lib/client/types.go @@ -2,8 +2,8 @@ package client import "github.com/theater/picomap/lib/msgpack" -type ResponseBOOTSEL struct{} -type RequestBOOTSEL struct{} +type ResponsePICOBOOT struct{} +type RequestPICOBOOT struct{} type DeviceError struct { Code uint32 @@ -22,7 +22,7 @@ type Envelope struct { func init() { msgpack.RegisterExt(0, (*Envelope)(nil)) - msgpack.RegisterExt(1, (*ResponseBOOTSEL)(nil)) - msgpack.RegisterExt(2, (*RequestBOOTSEL)(nil)) + msgpack.RegisterExt(1, (*ResponsePICOBOOT)(nil)) + msgpack.RegisterExt(2, (*RequestPICOBOOT)(nil)) msgpack.RegisterExt(3, (*DeviceError)(nil)) } diff --git a/picomap.cpp b/picomap.cpp index 8204897..a11958b 100644 --- a/picomap.cpp +++ b/picomap.cpp @@ -30,10 +30,10 @@ int main() { rx_buf.clear(); switch (msg->type_id) { - case RequestBOOTSEL::ext_id: - send_bytes(encode_response(msg->message_id, ResponseBOOTSEL{})); + case RequestPICOBOOT::ext_id: + send_bytes(encode_response(msg->message_id, ResponsePICOBOOT{})); sleep_ms(100); - reset_usb_boot(0, 0); + reset_usb_boot(0, 1); break; } }