嗨,我試圖從 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
uj5u.com熱心網友回復:
你使用了錯誤的指令。LDR - 使用立即偏移量、預索引立即偏移量或后索引立即偏移量加載
您需要使用mov說明
uj5u.com熱心網友回復:
最終解決方案
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
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/369165.html
