I am attempting to port Martin's at91sam7_chanfat demo to run under IAR in order that I might debug some hardware. The problem is that SWI.H is not syntactically correct for the IAR compiler. The compiler gives up trying to process function do_SWI, giving up on the lines starting with : asm ( "mov r0, %2 \n\t" \ "mov r1, %3 \n\t" \ "mov r2, %4 \n\t" \ "mov r3, %5 \n\t" \ "swi %a1 \n\t" \ "mov %0, r0 \n\t" \ : "=r" (ret_val) : "I" ((const int)swi_num), "r" (par0), "r" (par1), "r" (par2), "r" (par3) : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" ); I was wondering if anybody has successfully ported either SWI.H to IAR, or perhaps the project. Thanks. Andy
I gave up on the port, per se. Instead, I used the latest CHaN package (0.06) and his sample code, integrating the FF.*, MMC.C and DISKIO.H files into the IAR BASIC package. That gave me the ability to debug the low-level operations successfully on my hardware. Turned out I had a third-party SPI device that didn't de-assert MISO when it was not selected :( Andy
Andy Kunz wrote: > asm ( > "mov r0, %2 \n\t" \ > "mov r1, %3 \n\t" \ > "mov r2, %4 \n\t" \ > "mov r3, %5 \n\t" \ > "swi %a1 \n\t" \ > "mov %0, r0 \n\t" \ > : "=r" (ret_val) > : "I" ((const int)swi_num), > "r" (par0), "r" (par1), "r" (par2), "r" (par3) > : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" > ); > It seems perhaps that you have solved/worked around this already, however for future reference it may be worth noting that inline assembler syntax is not standardised amongst C compilers and that GCC's syntax is particularly arcane (albeit very powerful). You will probably need to understand the inline asm syntax of both compilers to perform a successful port. Information on GCC syntax is minimal; I have used http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html in the past - the examples are all in x86 assembler, but it is the syntax not the instruction set that you are interested in. Looking at the IAR manual ( http://www.iar.com/website1/1.0.1.0/78/1/index.php ) the syntax looks broadly similar, however it does not appear to have the syntax to define the interface between the asm and the C code that GCC has, or for allowing the compiler to select registers rather than specifying them specifically. Basically IAR is not as flexible or powerful in this respect. I suspect that to port this it would be safer to use the full IAR assembler and code it as a C callable function rather than inlining it. Clifford
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.