Hi Friends,
I'm trying to read cpsr and set cpsr with these function. however these functions works fine in eclipse but i have problem using them in keil uvision 4.
static inline unsigned __get_cpsr(void) { unsigned long retval; asm volatile (" mrs %0, cpsr" : "=r" (retval) : ); return retval; }
static inline void __set_cpsr(unsigned val) { asm volatile (" msr cpsr, %0": :"r" (val)); } and i get this error:
error: #65: expected a ";" error: #20: identifier "asm" is undefined so i used __inline and __asm and now i get this error:
source\main.c(94): error: #18: expected a ")" source\main.c(94): error: #18: expected a ")" Any idea on how to fix it? or what is the steps to move these functions in a separate asm file which seems to be a solution.
Thanks robo
1) Why are you posting your original code a second time? Wouldn't it be much, much, much (!) better if you instead posted the modified code? Or are people expected to guess what your code looked like after you tried to rewrite it?
2) Haven't you already noticed that your code end up with rather bad formatting while the answer you got earlier did show code differently formatted? So didn't you then look for the information on how to post source code clearly described directly above the message input box?
3) If you want to go all the way to use an assembler file - have you considered looking at Keil's documentation? Or look at all the startup files that are written in assembler?