Skip to content

-monitor flag is confused with -port flag #3637

Open
@scottfeldman

Description

@scottfeldman

I have two identical raspberry pi picos, /dev/ttypACM0 and /dev/ttyACM1.

When I flash using both -monitor and -port together, the right port is flashed but monitor connects to the wrong port:

sfeldma@nuc:~/work/tinygo$ ls /dev/ttyACM*
/dev/ttyACM0  /dev/ttyACM1

sfeldma@nuc:~/work/tinygo$ tinygo flash -monitor -target pico -size short -port /dev/ttyACM0 src/examples/echo/echo.go 
   code    data     bss |   flash     ram
   8548     108    3288 |    8656    3396
Connected to /dev/ttyACM1. Press Ctrl-C to exit.       <-- monitor connected to /dev/ttyACM1

sfeldma@nuc:~/work/tinygo$ tinygo flash -monitor -target pico -size short -port /dev/ttyACM1 src/examples/echo/echo.go 
   code    data     bss |   flash     ram
   8548     108    3288 |    8656    3396
Connected to /dev/ttyACM0. Press Ctrl-C to exit.       <-- monitor connected to /dev/ttyACM0

If I get real crazy and add a third pico, nothing works:

sfeldma@nuc:~/work/tinygo$ ls /dev/ttyACM*
/dev/ttyACM0  /dev/ttyACM1  /dev/ttyACM2
sfeldma@nuc:~/work/tinygo$ tinygo flash -monitor -target pico -size short -port /dev/ttyACM1 src/examples/echo/echo.go 
   code    data     bss |   flash     ram
   8548     108    3288 |    8656    3396
error: unable to search for a default USB device - use -port flag, available ports are /dev/ttyACM0, /dev/ttyACM1, /dev/ttyACM2

sfeldma@nuc:~/work/tinygo$ tinygo flash -monitor -target pico -size short src/examples/echo/echo.go 
   code    data     bss |   flash     ram
   8548     108    3288 |    8656    3396
error: failed to flash /tmp/tinygo1733382844/main.uf2: unable to locate device: RPI-RP2

I'm on dev branch of tinygo:

sfeldma@nuc:~/work/tinygo$ tinygo version
tinygo version 0.28.0-dev-2c0f61ca linux/amd64 (using go version go1.19.3 and LLVM version 15.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions