In Crossstudio 1.7 this functions works correctly:
static inline cpu_t get_cpsr(void)
{
cpu_t val;
asm volatile ("mrs %[val], cpsr\n":[val]"=r"(val):);
return val;
}
static inline void set_cpsr(cpu_t val)
{
asm volatile ("msr cpsr, %[val]\n" ::[val]"r"(val) );
}
In Crossstudio 2.0 I have error:
'asm' undeclared (first use in this function)
when I remove volatile keyword, I have error
asm ("mrs %[val], cpsr\n":[val]"=r"(val):);
^ expected ')' before
':' token
What is wrong in this functons ?
Crossstudio and asm functions
Started by ●September 10, 2009
Reply by ●September 10, 20092009-09-10
> In Crossstudio 1.7 this functions works correctly:
> static inline cpu_t get_cpsr(void)
> {
> cpu_t val;
> asm volatile ("mrs %[val], cpsr\n":[val]"=r"(val):);
> return val;
> }
>
> static inline void set_cpsr(cpu_t val)
> {
> asm volatile ("msr cpsr, %[val]\n" ::[val]"r"(val) );
> }
>
> In Crossstudio 2.0 I have error:
> 'asm' undeclared (first use in this function)
> when I remove volatile keyword, I have error
> asm ("mrs %[val], cpsr\n":[val]"=r"(val):);
> ^ expected ')' before ':' token
> What is wrong in this functons ?
Either switch off the "force ANSI compliance" compiler option, or replace
asm with __asm.
Regards,
Richard.
+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.
+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.
> static inline cpu_t get_cpsr(void)
> {
> cpu_t val;
> asm volatile ("mrs %[val], cpsr\n":[val]"=r"(val):);
> return val;
> }
>
> static inline void set_cpsr(cpu_t val)
> {
> asm volatile ("msr cpsr, %[val]\n" ::[val]"r"(val) );
> }
>
> In Crossstudio 2.0 I have error:
> 'asm' undeclared (first use in this function)
> when I remove volatile keyword, I have error
> asm ("mrs %[val], cpsr\n":[val]"=r"(val):);
> ^ expected ')' before ':' token
> What is wrong in this functons ?
Either switch off the "force ANSI compliance" compiler option, or replace
asm with __asm.
Regards,
Richard.
+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.
+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.
Reply by ●September 10, 20092009-09-10
I had the same problem I used __asm which worked. I also found a define for
__asm__, but I have not tried it.
_____
From: tomi [mailto:f...@gmail.com]
Sent: Thursday, September 10, 2009 3:16 PM
To: l...
Subject: [lpc2000] Crossstudio and asm functions
In Crossstudio 1.7 this functions works correctly:
static inline cpu_t get_cpsr(void)
{
cpu_t val;
asm volatile ("mrs %[val], cpsr\n":[val]"=r"(val):);
return val;
}
static inline void set_cpsr(cpu_t val)
{
asm volatile ("msr cpsr, %[val]\n" ::[val]"r"(val) );
}
In Crossstudio 2.0 I have error:
'asm' undeclared (first use in this function)
when I remove volatile keyword, I have error
asm ("mrs %[val], cpsr\n":[val]"=r"(val):);
^ expected ')' before ':' token
What is wrong in this functons ?
__asm__, but I have not tried it.
_____
From: tomi [mailto:f...@gmail.com]
Sent: Thursday, September 10, 2009 3:16 PM
To: l...
Subject: [lpc2000] Crossstudio and asm functions
In Crossstudio 1.7 this functions works correctly:
static inline cpu_t get_cpsr(void)
{
cpu_t val;
asm volatile ("mrs %[val], cpsr\n":[val]"=r"(val):);
return val;
}
static inline void set_cpsr(cpu_t val)
{
asm volatile ("msr cpsr, %[val]\n" ::[val]"r"(val) );
}
In Crossstudio 2.0 I have error:
'asm' undeclared (first use in this function)
when I remove volatile keyword, I have error
asm ("mrs %[val], cpsr\n":[val]"=r"(val):);
^ expected ')' before ':' token
What is wrong in this functons ?
Reply by ●September 11, 20092009-09-11