"A1114E: Expected register relative expression" 是什么意思?
What does "A1114E: Expected register relative expression" mean?
您好,我正在尝试从 c 调用汇编程序子例程并遇到此错误。在 Arm 网站上,只是说存在这个错误。
C代码
#include <stdint.h>
extern void out_word(uint32_t out_address, uint32_t out_value);
extern uint32_t in_word(uint32_t in_address);
int main(void){
uint32_t value = in_word(0x60000200);
uint32_t address = 0x60000100;
out_word(address,value);
return (0);
}
汇编代码
PRESERVE8
AREA myCode, CODE, READONLY
EXPORT in_word
EXPORT out_word
in_word PUSH {R1-R7}
LDR R1, R0 ; line which produces the problem
LDR R0, [R1]
POP {R1-R7}
BX LR
out_word STR R1, [R0]
BX LR
END
您使用了错误的指令。 LDR - 加载立即偏移量、预索引立即偏移量或 post-索引立即偏移量
您需要使用mov
指令
最终有效的解决方案
PRESERVE8
AREA myCode, CODE, READONLY
EXPORT in_word
EXPORT out_word
in_word LDR R0, [R0]
BX LR
out_word STR R1, [R0]
BX LR
END
您好,我正在尝试从 c 调用汇编程序子例程并遇到此错误。在 Arm 网站上,只是说存在这个错误。 C代码
#include <stdint.h>
extern void out_word(uint32_t out_address, uint32_t out_value);
extern uint32_t in_word(uint32_t in_address);
int main(void){
uint32_t value = in_word(0x60000200);
uint32_t address = 0x60000100;
out_word(address,value);
return (0);
}
汇编代码
PRESERVE8
AREA myCode, CODE, READONLY
EXPORT in_word
EXPORT out_word
in_word PUSH {R1-R7}
LDR R1, R0 ; line which produces the problem
LDR R0, [R1]
POP {R1-R7}
BX LR
out_word STR R1, [R0]
BX LR
END
您使用了错误的指令。 LDR - 加载立即偏移量、预索引立即偏移量或 post-索引立即偏移量
您需要使用mov
指令
最终有效的解决方案
PRESERVE8
AREA myCode, CODE, READONLY
EXPORT in_word
EXPORT out_word
in_word LDR R0, [R0]
BX LR
out_word STR R1, [R0]
BX LR
END