avr: inline assembly with lo8()/hi8() cuts symbols longer than 16 characters
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- c
- Área
- compilers, embedded-iot
Línea de trabajo
The issue provides a minimal C example using inline assembly and reproduces the symbol truncation with AVR target flags; start by reading that example and tracing how EmbCC parses or emits inline assembly containing lo8() or hi8(). Check the AVR port context in arch/avr/avr_context.c for the affected long symbols. Done means the example compiles with those symbols intact and the AVR RTOS library can build.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
On AVR, an inline-assembly template that uses lo8() or hi8() anywhere has every symbol longer than 16 characters cut to its first 16, and the assembler then refuses it. EmbCC 0.1.0 (macOS aarch64 release), --target=avr -mmcu=atmega328p -Os.
void abcdefghijklmnopqrst(void);
void g(void) { __asm__ __volatile__("ldi r18, lo8(2303)\n\tcall abcdefghijklmnopqrst" ::: "r18"); }
embcc: g.c:2: error: 'abcdefghijklmnop' is not a number, a register or an expression this assembler knows
What changes the result:
| Template | Result |
|---|---|
ldi r18, lo8(2303) then call abcdefghijklmnopqrst |
error |
ldi r18, hi8(2303) then call … |
error |
call … first, then ldi r18, lo8(2303) |
error |
ldi r18, lo8(2303), nop, then jmp … |
error |
ldi r18, 7 then call abcdefghijklmnopqrst |
compiles |
call abcdefghijklmnopqrst alone, with or without operands |
compiles |
a 16-character name after lo8() |
compiles |
So the cut follows the presence of lo8/hi8 in the block, not their position or the operands.
Where EmbLinkRTOS meets it: the AVR port's kernel start, arch/avr/avr_context.c, loads the stack pointer with lo8(%[top])/hi8(%[top]) and then calls emb_arch_switch_to and jumps to embk_thread_launch, both 18 characters. The port's library does not compile, so no Uno image links. Passing the two bytes as separate "i" operands avoids it; the RTOS keeps lo8/hi8, which avr-gcc and Clang accept.
Part of #184 (AVR).
- Lenguaje dominante
- C
- Estrellas
- 1
- Forks
- 2
- Merge medio
- 20 h 55 min
- PR fusionados (30 d)
- 73
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
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 EmbLinkOs/EmbCC
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 50/100
Los mantenedores suelen responder en 1 día
Todos los issues de EmbLinkOs/EmbCC
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area: test kind: bug preview-effort: small priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
libsdl-org/SDL#16684 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Issue-Bug Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días