2012-06-25 67 views
1

我有一個Windows Mobile 6 TI OMAP 3430平臺的Visual Studio 2008 C++ 03項目,我想使用ARM Cortex A8 NEON指令優化一些功能。 Visual Studio 2008中包括微軟ARM彙編v15.00.20720(armasm.exe)使用visual studio arm彙編程序

我已經聲明瞭一個函數在test.h

extern "C" unsigned __int32 Test(); 

和TEST.ASM實現了它作爲

ALIGN 
Test FUNCTION 
    EXPORT Test 
    ldr r0, [r15] ; load the PC value in to r0 
    mov pc, lr  ; return the value of r0 
ENDFUNC 

我在預鏈接事件執行ARM彙編爲:

armasm.exe -32 -CPU ARM8 test.asm test.obj 

但,我得到這些錯誤的工具

test.asm(4) : error A0064: code inside data section 
1> ldr r0, [r14] ; load the PC value in to r0 
test.asm(5) : error A0064: code inside data section 
1> mov pc, lr  ; return the value of r0 
test.asm(7) warning : A0063: missing END directive 
1>ENDFUNC 

什麼是使用Visual Studio ARM彙編正確的語法回來?

回答

2

ARMASM使用非常簡單,因爲許多選項默認爲合理的值。這是你的代碼的版本,將工作:

AREA my_test, CODE, READONLY ; name this block of code 
    EXPORT test 

test proc  ; start of a procedure 
    ldr r0,[r15] 
    mov pc,lr 
    endp  ; end of a procedure 

    end  ; end of the file 

更新:忘了,包括「區域」

+0

這仍然給我錯誤的「數據部的內部代碼」爲'ldr'和'MOV '線。雖然它確實修復了(現在很明顯的)「缺失結束指令」警告 – PaulH

+0

抱歉 - 我忘記了包含區域指令。現在它彙編沒有錯誤。 – BitBank

+0

就是這樣,謝謝! – PaulH