CrossWorks AVR 1.4 - mixed code C/assembler
Hi
At the moment I try to make a project with mixed (C and assembler) code files. I found the following link in the knowledgebase for the ARM architecture:
http://rowley.zendesk.com/forums/56662/entries/46170
Is this example also usable for the AVR architecture or are there different things to keep in mind?
Thanks and regards
Franz
-
Yes, it works similarly. Here's how I did it:
Create a .asm file like this:
.code
.even
.opt
.export _LSBSwap
.export _AllIntsOn
.export _AllIntsOff
_LSBSwap PROC; Code goes here, any labels have a colon after them.
endprocPut that in your project and in your C file:
extern unsigned char LSBSwap(unsigned char);
And to use it in the code:
FramesUnits = LSBSwap(FrameIn[0]); // LSBSwap puts bits in correct order
IIRC one byte gets passed into r23 a word into r23/r22 etc. I might be wrong about that. Might want to play with it and see how it works.
Don't fotget to push and pull any registers you use! :~)
Cheers,
Rob
Please sign in to leave a comment.
Comments
2 comments