iar 内嵌汇编问题

260658   2009-8-11 09:56 楼主
由gcc的内嵌汇编程序个跟iar内嵌汇编语言差别好大啊,怎么修改才能从gcc的语法到iar的语法啊,iar是for msp430的
在 gcc 中的 __asm volatile ("eint");再 iar中编译不通,貌似不能直接asm与volatile搭配,该如何改啊?
还有,gcc中的语法__asm("in %0, %1" : "=r" (value) : "I" (PORTD) : );有还几个冒号隔开的语法在iar 中也编译不过啊???请各位大侠帮忙。。。小弟不胜感激!!!

回复评论 (4)

没人顶啊,
自己顶一下
点赞  2009-8-13 08:41
给LZ找找,

你先看看,英文的

The MSP430 IAR C/C++ Compiler provides several ways to mix C or C++ and
assembler:
● Modules written entirely in assembler
● Intrinsic functions (the C alternative)
● Inline assembler.
点赞  2009-8-13 12:49
When an application is written partly in assembler language and partly in C or C++, you
are faced with a number of questions:
● How should the assembler code be written so that it can be called from C?
● Where does the assembler code find its parameters, and how is the return value
passed back to the caller?
● How should assembler code call functions written in C?
● How are global C variables accessed from code written in assembler language?
● Why does not the debugger display the call stack when assembler code is being
debugged?
点赞  2009-8-13 13:00

  1. bool flag;
  2. void foo()
  3. {
  4.     while (!flag)
  5.     {
  6.         asm("MOV.B &P1IN,&flag");
  7.     }
  8. }


点赞  2009-8-13 13:05
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复