RP2040: USB CDC output drops characters with `-scheduler=cores` on TinyGo 0.41.1
## Summary
On Raspberry Pi Pico / RP2040, USB CDC output appears to drop characters when using `-scheduler=cores`.
The same program prints correctly with TinyGo 0.40.1, but the output becomes corrupted with TinyGo 0.41.1.
## Environment
- Board: Raspberry Pi Pico / RP2040
- Host OS: Windows 11
- CPU: AMD Ryzen 5 5600G
- Shell: Git Bash / MINGW64
- Install method: Scoop
- USB connection: onboard USB CDC
- Serial monitor: `tinygo flash -monitor`
- TinyGo 0.40.1:
- `tinygo version 0.40.1 windows/amd64 (using go version go1.24.13 and LLVM version 20.1.1)`
- TinyGo 0.41.1:
- `tinygo version 0.41.1 windows/amd64 (using go version go1.24.13 and LLVM version 20.1.1)`
## Reproducer
```go
package main
import "time"
func main() {
time.Sleep(2 * time.Second)
println("start usb only")
for i := 0; i < 100; i++ {
if i == 0 || i%10 == 0 {
println("rounds ok:", i, "/ 100")
}
time.Sleep(10 * time.Millisecond)
}
println("test finished")
}
```
## Commands
TinyGo 0.40.1:
```bash
scoop reset tinygo@0.40.1
C:/Users/user/scoop/shims/tinygo.exe flash -target=pico -scheduler=cores -monitor main_usb_only.go
```
TinyGo 0.41.1:
```bash
scoop reset tinygo@0.41.1
C:/Users/user/scoop/shims/tinygo.exe flash -target=pico -scheduler=cores -monitor main_usb_only.go
```
I also checked `-scheduler=tasks` with TinyGo 0.41.1:
```bash
C:/Users/user/scoop/shims/tinygo.exe flash -target=pico -scheduler=tasks -monitor main_usb_only.go
```
## Observed behavior
With TinyGo 0.40.1 and `-scheduler=cores`, the output appears correct:
```text
Connected to COM3. Press Ctrl-C to exit.
start usb only
rounds ok: 0 / 100
rounds ok: 10 / 100
rounds ok: 20 / 100
rounds ok: 30 / 100
rounds ok: 40 / 100
rounds ok: 50 / 100
rounds ok: 60 / 100
rounds ok: 70 / 100
rounds ok: 80 / 100
rounds ok: 90 / 100
test finished
```
With TinyGo 0.41.1 and `-scheduler=cores`, the output drops characters:
```text
Connected to COM3. Press Ctrl-C to exit.
ds ok: 100y
rounds ok: 10 / 100
rounds ok: 20 / 100
rounds ok: 30 / 100
rk: 40 / 100
rou 100
rnds ok: 60
rounds ok: 70 / 100
rounds ok: 80 / 100
r100
test finished
```
With TinyGo 0.41.1 and `-scheduler=tasks`, the same program prints correctly:
```text
Connected to COM3. Press Ctrl-C to exit.
start usb only
rounds ok: 0 / 100
rounds ok: 10 / 100
rounds ok: 20 / 100
rounds ok: 30 / 100
rounds ok: 40 / 100
rounds ok: 50 / 100
rounds ok: 60 / 100
rounds ok: 70 / 100
rounds ok: 80 / 100
rounds ok: 90 / 100
test finished
```
## Expected behavior
USB CDC output should not drop characters when using `-scheduler=cores`.
The output should be consistent with the behavior of TinyGo 0.40.1 and with `-scheduler=tasks`.
关闭于 2026-06-08 0 条评论