I use some codes with
#define LDW(dst, mem, ind) asm("ldw %0, %1[%2]" : "=r"(dst) : "r"(mem), "r"(ind))
#define STW(src, mem, ind) asm("stw %0, %1[%2]" : "=r"(src) : "r"(mem), "r"(ind))
but optimizer removes it from code if =r is not used after macro usage.
I read assembler guide and use recommended volatile
#define STW(src, mem, ind) asm volatile("stw %0, %1[%2]" : "=r"(src) : "r"(mem), "r"(ind))
this is compiled but XDE shows SYNTAX ERROR in lines with macro.
How is functional 100% code for pointer type memory array read and write back?
For me only real C code works 100%. But in XC i need very frustrated calls to C code in other source file.
Syntax error asm volatile
-
- Experienced Member
- Posts: 125
- Joined: Fri Jul 05, 2013 5:55 pm
-
Verified
- XCore Expert
- Posts: 985
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
Missing semi-colon when calling the macro? Looks like valid syntax otherwise.
-
- Experienced Member
- Posts: 125
- Joined: Fri Jul 05, 2013 5:55 pm
On screenshot is syntax error.
But no build error.
This error exist only when define have volatile clause.
#define LDW(dst, mem, ind) asm volatile("ldw %0, %1[%2]" : "=r"(dst) : "r"(mem), "r"(ind))
But no build error.
This error exist only when define have volatile clause.
#define LDW(dst, mem, ind) asm volatile("ldw %0, %1[%2]" : "=r"(dst) : "r"(mem), "r"(ind))
You do not have the required permissions to view the files attached to this post.
-
Verified
- XCore Expert
- Posts: 985
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
Ah, I thought you have a build error. Looks like an issue in the IDE.
-
- XCore Expert
- Posts: 589
- Joined: Wed Feb 29, 2012 10:03 am
Which version of the tool are you using? In 13.0.0 version of the tools, this issue is fixed. I presume you are using the older version of the tool.
Sethu.
Sethu.