I am trying to compile the following two pieces of code with ARM Compiler 5 for a Cortex A microprocessor:
Part 1:
static inline void cp15_write_sctlr(uint32_t value)
{
asm("mcr p15, 0, %0, c1, c0, 0" :: "r"(value));
}
static inline uint32_t cp15_read_actlr(void)
{
uint32_t actlr;
asm("mrc p15, 0, %0, c1, c0, 1" : "=r"(actlr));
return actlr;
}
Part 2:
static inline void dmb(void)
{
asm("dmb" ::: "memory");
}
static inline void dsb(void)
{
asm("dsb" ::: "memory");
}
static inline void isb(void)
{
asm("isb" ::: "memory");
}
In both cases I get compile errors. See below, as an example.
line 64: Error: #18: expected a ")"
asm("dsb" ::: "memory");
Are the error caused by the compiler version (ARM compiler 5), which does not support Extended Asm?
If I re-write the code in Part 1 as follows, I do not get any error. Is the following code equivalent to that in Part 1?
static inline void cp15_write_sctlr(uint32_t value)
{
__asm
{
MCR p15, 0, value, c1, c0, 0
}
}
static inline uint32_t cp15_read_actlr(void)
{
uint32_t actlr;
__asm
{
MRC p15, 0, actlr, c1, c0, 1
}
return actlr;
}
How could I rewrite the code in Part 2, if the compiler does not support extended Asm? I have in mind the following, but I am not sure it is the same.
static inline void dmb(void)
{
__schedule_barrier();
__asm("dmb");
__schedule_barrier();
}
static inline void dsb(void)
{
__schedule_barrier();
__asm("dsb");
__schedule_barrier();
}
static inline void isb(void)
{
__schedule_barrier();
__asm("isb");
__schedule_barrier();
}
Any help would be really appreciated.