How can I write inline ARM Assembly functions or pure Assembly in Keil for STM32F429 microcontroller?
I have some unsuccessful attempts:
For pure Assembly:
AREA ARMex, CODE, READONLY ; Name this block of code ARMex ENTRY ; Mark first instruction to execute start MOV r0, #0x10 ; Set up parameters MOV r1, #3 ADD r0, r0, r1 ; r0 = r0 + r1 stop MOV r0, #0x18 ; angel_SWIreason_ReportException LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit SVC #0x12 ; ARM semihosting (formerly SWI) END ; Mark end of file
I get error message for every each line in which I use # to write constant. I tried #10 #0x10 Error message: "new.s(9): error: A1859E: Flag preserving form of this instruction not available" If I don't write # then thas is problem, too.
For inline Assembly: I get error message when I use registers. It revognises the reigsters as a normal variable.
I found in Keil: Use GCC (Project->Manage->Components,Environment,Books->Folders/Extensions) I choose Use GCC, I give a right path and a right prefix but it does not work, I get error message: "Failed to execute arm-none-eabias' I tryed this, because I use EmBmocks too with GCC compiler and the inline arm assembly works well there. But I need to know how I should use it in Keil. The inline Assembly in Emblocks with GCC compiler:
asm( "eor r2, r2 ;" "mov r3, #2 ;" );
Use MOVS
Thank you for your help! :-) It was the right soluton!