EmbeddedRelated.com
Forums

Crossstudio and asm functions

Started by tomi September 10, 2009
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 ?


An Engineer's Guide to the LPC2100 Series

> 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.

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 ?





2009/9/10 FreeRTOS Info

>
> Either switch off the "force ANSI compliance" compiler option, or replace
> asm with __asm.
>
Thank you, it working ;)