Hi,
In my P2020 project i'm using assembly code the same way I was using it on a P5020 board.
The problem is that i'm getting these kind of errors.
"expected a inline assembler directive"
for this exemple in a .c file:
__asm__ __volatile__( "instruction ;"
: [outputs]
: [inputs]
: [clobered list] };
and
"Instructions must occur within code section"
for this exemple in a .asm file :
.global myFunction
myFunction:
lis 3, 0x0001
ori 3, 3, 0x0001
mtspr 1010, 3
blr
If any one can help resolving these errors, it would be very nice.
Thanks.
Went for a solution with both macro's and functions.
Not exactly what I expected to do but it's acceptable.
Thanks for those who tried to help.
Problem solved.
Could you show the actual asm statement? I'm assuming it doesn't literally say [outputs] etc., and can't tell whether closing brace rather than parentheses is in your actual source code or not. Also clarify what sort of compiler you're using.
As for the asm file, what section are you trying to place that in? Are there any section directives earlier in the file?
The code shown is for example.
it would be like this (example that works for gcc on p5020):
__asm__ __volatile__(
"lis 3, 0x0001;"
"ori 3, 3, 0x0001;"
"mtspr 1010, 3;"
:
:
: "3" };
I'm using the default tool chain for P2020. (in CW in doesn't indicate what kind of compiler it uses so I was a litle bit lost)
As i'm porting some code from a P5020 I'd prefer use a GCC compiler.
I guess changing the tool chain for a gcc version should be good ?
I used the asm{} format instead of the asm( "instruction;" : outputs : inputs : clobered list);
C variables can be called directly with there names
And in .asm files I need to specify
.section . text
which wasn't needed for the P5020 compiler
The PA\PA_Support\Templates\Sources\P2020\Common examples where helpfull
Thanks to Marius.
Other problem :
With this compiler includes seem not to work...
I mean for example: #include "test.h"
I get Link Failed
And some Undefined functions (that are in test.h)
Is there a documentation for this compiler ?
You should include the folder with your headers in User Recursive Path (take a look in the below picture) from -> right click on your project -> Properties -> C/C++ build -> PowerPC Compiler -> Input -> User recursive path
I still have the same errors.
I have a directory where all my .c .h .asm files are included in user path.
Is it possible to set the equivalent default P5020's compiler (PowerPC AEABI e5500 C Compiler) to the P2020 ?
If yes, how can I do it ?
Can you share the project or show us a more detailed log?
About the compiler, the answer is a negative one. The aeabi gcc compiler for e5500 core cannot be used for e500v2 (P2020). Officially, we don't have "gcc" support for P2020 processor, but if you want to use a "gcc toolchain" instead, you can make a P1021RDB selecting 'GCC EABI e500v2' and just copy/replace your P2020 files into the project. This trick should work without issues.
Regards,
Marius
Sorry, but i'm can't show the code.
The main problem was the compiler not accepting my code.
I used the syntax given in the examples linked. (using "inline" for some functions was causing that problem)
I have a last question :
I'm my inline assembly function how can I call an assembler macro located in a .asm file.
i'm using #include "myMacroFile.asm"
but I get this error : "expected inline assembler directive" for "myMacroName:" ".macro" ".endm"
Hi,
I guess that you're using CodeWarrior for PA? In positive case, please pay attention that P5020 is gcc based and P2020 is MW FSL based (a different compiler). You can take a look in this folder
PA\PA_Support\Templates\Sources\P2020\Common for eppc_exception.asm and interrupt.c to see some asm routins for P2020.
Regards,
Marius
Hmm? You certainly can use GCC and Linux with P2020.