Hello How to write inline assembly code in c file and access cpu R0-R31 registers? I write something like: __asm{
STRB R0,[R2,0#02]
}
but i face errors: expected [ or ]. Thanks.
Thanks, is any flag needed for inline assembly activation?
I think not. Try using such code:
__asm{
MOV r2, #0 MOV r9, #0 STRB r2,[r9,#2]
Remember to set used register before calling STRB to avoid
error: #549: variable "R2" is used before its value is set
Thanks, when writing this code, it shows error red sign in edit environment but it compiles without errors. it seems to be a bug.
It's not a bug.
It occurs because of Dynamic Syntax checker which is set under: Configuration -> Text Completion
If you are using ARM compiler v5.xx, then these red signs in editor will keep on appearing.
Either use ARMCLANGv6.xx or disable Dynamic Syntax checker.
Thanks, how to enable ARMCLANGv6.xx option?
Hello I'm facing some new problem, when i write inline assembly code in my c code, the compiler removes it, and if i define volatile variables before assembly, compiler compiles again the assembly segment and generates more assembly code than i expect.
c code: volatile uint32_t r0; . . __asm { mov r0,#0x50000008 } . . .
assembles to (inline assembly segment): STR .. LDR .. STR ..
i didn't face this issue before. how should i fix this? Thanks.