avr: inline assembly with lo8()/hi8() cuts symbols longer than 16 characters
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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).
- 主要语言
- C
- 星标
- 1
- 派生
- 2
- 平均合并
- 20 小时 55 分钟
- 30 天内合并 PR
- 73
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
EmbLinkOs/EmbCC 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 50/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area: test kind: bug preview-effort: small priority: low
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
libsdl-org/SDL#16684 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
-
Issue-Bug Needs-Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复