Arm 通用用户指南 (第172页)第3.10.4节给出了一个使用TBB的示例,但该示例使用Arm汇编程序。我想学习如何使用TBB与气体,但似乎不知道如何使用。如何修改指南中的示例,以实现用gas而不是armasm?的开关语句
ADR.W R0, BranchTable_Byte
TBB [R0, R1] ; R1 is the index, R0 is the base address of the
; branch table
Case1
; an instruction sequence follows
Case2
; an instruction sequence follows
Case3
; an instruction sequence follows
BranchTable_Byte
DCB 0 ; Case1 offset calculation
DCB ((Case2-Case1)/2) ; Case2 offset calculation
DCB ((Case3-Case1)/2) ; Case3 offset calculation我刚开始使用gas,不确定是否应该在汇编程序文件开始时在.data部分定义分支表,还是应该在.text部分中使用开关语句。
发布于 2018-10-03 00:39:29
.cpu cortex-m3
.thumb
.syntax unified
ADR.W R0, BranchTable_Byte
TBB [R0, R1] @; R1 is the index, R0 is the base address of the
@; branch table
Case1:
@; an instruction sequence follows
nop
Case2:
@; an instruction sequence follows
nop
nop
Case3:
@; an instruction sequence follows
nop
nop
nop
BranchTable_Byte:
.byte 0 @; Case1 offset calculation
.byte ((Case2-Case1)/2) @; Case2 offset calculation
.byte ((Case3-Case1)/2) @; Case3 offset calculation也许是这样的。标签上需要冒号。不幸的是,“is”已经不再是一句评论了,它在数学标签上很幸运。
https://stackoverflow.com/questions/52616464
复制相似问题