USB: unexpected heap allocations at -opt=0
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- go
- Área
- embedded-iot
Línea de trabajo
Reproduce the failure with tinygo build -target=pico -scheduler=none -opt=0 -gc=none -o out.elf ., then inspect src/machine/machine_rp2_usb.go and src/machine/usb/cdc/usbcdc.go around the reported allocations. Check comparable USB implementations on other targets and review the escape-analysis and stack-usage discussion in related issues. Done means the Pico build no longer reports these heap allocations and the broader audit identifies any equivalent cases without excessive stack usage.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
When building for RP2 targets with -opt=0 -gc=none, heap allocations in the USB implementation cause build failures.
The clock initialization part of this was reported in #6613 and fixed by #6635, but the USB-related allocations remain.
Reproduce
package main
func main() {}
$ tinygo build -target=pico -scheduler=none -opt=0 -gc=none -o out.elf .
src/machine/machine_rp2_usb.go:108: object allocated on the heap with -gc=none
src/machine/usb/cdc/usbcdc.go:232: object allocated on the heap with -gc=none
Known allocations
src/machine/machine_rp2_usb.go:108:var b [cdcLineInfoSize]byteinReceiveUSBControlPacketsrc/machine/usb/cdc/usbcdc.go:232: the array returned bymachine.ReceiveUSBControlPacket()incdcSetup(SET_LINE_CODING)
Both allocations involve local arrays that are sliced (b[:]) and passed to functions. At -opt=0, these allocations are not eliminated because escape analysis is not performed.
For comparison, the GET_LINE_CODING path uses the package-level cdcSetupBuff and does not allocate.
Since similar allocation patterns may exist in USB implementations for other targets, I would like to investigate this separately.
Scope
- Identify unnecessary heap allocations in USB implementations at
-opt=0. - Check whether other targets have similar allocations in their USB implementations.
- Determine an appropriate solution without introducing excessive stack usage.
Relation to #6645
This is related to #6645, but it remains to be determined whether enabling escape analysis at -opt=0 is sufficient to resolve the USB-related issues.
As noted in #6645, enabling escape analysis may also increase stack usage on Cortex-M, so USB-specific changes may still be necessary.
Environment: TinyGo dev (after #6635), target pico
- Lenguaje dominante
- Go
- Estrellas
- 17.8k
- Forks
- 1.1k
- Merge medio
- 1 d 4 h
- PR fusionados (30 d)
- 380
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tinygo-org/tinygo
-
avr: SPI Mode2 runs as mode 1Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
tinygo-org/tinygo#6727 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
tinygo-org/tinygo#6711 ·
Los mantenedores suelen responder en 1 día
-
Builds are not reproducible: cgo snippet paths in debug infoPosiblemente ocupada @tridev-tej la tomó hace 1 día. Abiertoenhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
tinygo-org/tinygo#6619 ·
Los mantenedores suelen responder en 1 día
-
Fix the targets that tinygo build -target rejectsPosiblemente ocupada @narguis la tomó hace 2 días. Abiertobug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
tinygo-org/tinygo#6617 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
tinygo-org/tinygo#6312 ·
Los mantenedores suelen responder en 1 día
Todos los issues de tinygo-org/tinygo
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sresarehumantoo/cc-artex#456 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ollama/ollama#20021 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
factory:subtask
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
release
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
github/gh-aw-mcpg#17603 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
bboerst/stratum-work#351 ·
Los mantenedores suelen responder en 1 día