CodeWarrior Development Studio for Freescale MPC55xx version 2.0 unknown error

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

CodeWarrior Development Studio for Freescale MPC55xx version 2.0 unknown error

3,668件の閲覧回数
alediano
Contributor I
I wrote this macro:

#define watch_dog() {register int lz; asm(" mfspr lz, TSR " ) ; asm(" oris  lz, lz, 0x8000 " ) ; asm(" mtspr TSR, lz " ) ;}

Then, when I use it, compiler says:
 Error   : lz was not assigned to a GPR register (try using register qualifier)


I'm using CodeWarrior Development Studio for Freescale MPC55xx version 2.0.
Could you help me please?

Thanks



Message Edited by alediano on 2007-06-06 10:01 AM
ラベル(1)
タグ(1)
0 件の賞賛
返信
7 返答(返信)

1,037件の閲覧回数
Voxan
Contributor III
Hi there,

cause the scope of a local variable, in this compiler, is the function, not a block.
in other words if you implement a function, instead of your macro, you'll be good

void watch_dog() { \
   register int lz; \
   asm(" mfspr lz, TSR " ); \
   asm(" oris  lz, lz, 0x8000 " ); \
   asm(" mtspr TSR, lz " ); \
}

Hope this helps...
0 件の賞賛
返信

1,037件の閲覧回数
alediano
Contributor I
Oh yes, thanks, I knew it, but it's very strange, isn't it?
Is it a compiler bug or should we define the macro in another way?
In the previous CodeWarrior MPC55xx version 1.5 that macro worked!

Regards

0 件の賞賛
返信

1,037件の閲覧回数
Voxan
Contributor III
hmmm, looks like a compiler inline asm regression...

I'll get confirmation from engineering, in the meantime, you may want to log an SR in our tracking system at
http://www.freescale.com/webapp/sps/site/homepage.jsp?nodeId=054670

pls stay tunned

Cheers

0 件の賞賛
返信

1,037件の閲覧回数
Voxan
Contributor III
this workaround seems to work for me...

#define watch_dog() {register int lz; asm { mfspr lz, TSR; oris  lz, lz, 0x8000; mtspr TSR, lz; } }

defining an asm instruction block instead individuals...

Hope this helps...
0 件の賞賛
返信

1,037件の閲覧回数
Voxan
Contributor III
General inofrmation:

Freescale compilers based on the 4.x front end are now using the GCC-style inline asm syntaxe.

The original syntaxe was not following that GCC-style.

Hope this helps...
0 件の賞賛
返信

1,037件の閲覧回数
Voxan
Contributor III
to make is clear, if it was not :smileywink:

asm volatile ( "mfmsr _cpulevel;");

becomes (in GCC-Style syntax):

asm volatile ( "mfmsr %0" : "=r" (_cpulevel));

becomes (in CW-Style syntax):

asm volatile ( mfmsr _cpulevel:smileywink:;

You can find more information about GCC-Style syntax at http://gcc.gnu.org/onlinedocs/gcc-3.4.0/gcc/Extended-Asm.html#Extended%20Asm

Hope this helps...
0 件の賞賛
返信

1,037件の閲覧回数
alediano
Contributor I
Thank you very much.
0 件の賞賛
返信