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
}
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)
}

View File

@@ -4,13 +4,13 @@
#include <tuple>
#include <vector>
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(); }

View File

@@ -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

View File

@@ -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))
}

View File

@@ -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;
}
}