Feb 2, 2011 #1 P panther58 Newbie level 3 Joined Jan 25, 2011 Messages 3 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,298 i m getting error in following code ; error is -> expected a ";" on line denoted by -> -> static inline unsigned __get_cpsr(void) { unsigned long retval; asm volatile (" mrs %0, cpsr" : "=r" (retval) : /* no inputs */ ); return retval; } -> static inline void __set_cpsr(unsigned val) { asm volatile (" msr cpsr, %0" : /* no outputs */ : "r" (val) ); } how to use inline assembly in keil compiler ,, plz send me some references.
i m getting error in following code ; error is -> expected a ";" on line denoted by -> -> static inline unsigned __get_cpsr(void) { unsigned long retval; asm volatile (" mrs %0, cpsr" : "=r" (retval) : /* no inputs */ ); return retval; } -> static inline void __set_cpsr(unsigned val) { asm volatile (" msr cpsr, %0" : /* no outputs */ : "r" (val) ); } how to use inline assembly in keil compiler ,, plz send me some references.
Feb 2, 2011 #2 alexan_e Administrator Joined Mar 16, 2008 Messages 11,888 Helped 2,021 Reputation 4,158 Reaction score 2,031 Trophy points 1,393 Location Greece Activity points 64,371 It has to be used as __inline I think Alex ---------- Post added at 19:33 ---------- Previous post was at 19:30 ---------- And asm as __asm {} Alex ---------- Post added at 19:37 ---------- Previous post was at 19:33 ---------- This in an example Code: void my_strcpy (char *dst, const char *src) { int ch; __asm { loop: LDRB ch, [src], #1 STRB ch, [dst], #1 CMP ch, #0 BNE loop } } Alex
It has to be used as __inline I think Alex ---------- Post added at 19:33 ---------- Previous post was at 19:30 ---------- And asm as __asm {} Alex ---------- Post added at 19:37 ---------- Previous post was at 19:33 ---------- This in an example Code: void my_strcpy (char *dst, const char *src) { int ch; __asm { loop: LDRB ch, [src], #1 STRB ch, [dst], #1 CMP ch, #0 BNE loop } } Alex