Accessing Control Registers with inline assembly

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

Accessing Control Registers with inline assembly

ソリューションへジャンプ
2,119件の閲覧回数
MiataTexan
Contributor II

I am trying to port an existing 68K program to Coldfire using CodeWarrior.  The existing program was developed using a different tool years ago.  (The tool is obsolete and will not run with Windows 7)  The existing program used inline assembly to display the contents, and in some cases set the contents of the control registers. As an example,

 

asm(

movec VBR, D0

move D0,reg_value

);

where reg_value is a global C variable.

 

This works on the old tool but not with CodeWarrior and results in "illegal use of asm inline function" errors.  How can I access the control registers within C/C++?

Thanks for any help you can provide.

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,805件の閲覧回数
CrasyCat
Specialist III

Hello

 

 I checked the ColdFire® Family Programmer’s Reference Manual.

 

Description of instruction MOVEC tells that it

"Moves the contents of the general-purpose register to the specified control

register."

 

So

asm{

    move regValue, d0

    movec d0, VBR

}

 

is valid code for Coldfire corem but

 

asm{

    movec VBR, do

    move  d0, regValue

}

 

Is not valid code.

 

CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,805件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hello,

the error you see might have been a problem with the context you are in.

I just quickly tried

int reg_value;void foo(void) {  asm(    move D0,reg_value  );}

and this works for me (MCU10.2, ColdFire V2 52259).

Of course if you are using the VBR, the compiler/assembler needs to have a declaration for it.

 

Hope this helps,

BK

0 件の賞賛
返信
1,806件の閲覧回数
CrasyCat
Specialist III

Hello

 

 I checked the ColdFire® Family Programmer’s Reference Manual.

 

Description of instruction MOVEC tells that it

"Moves the contents of the general-purpose register to the specified control

register."

 

So

asm{

    move regValue, d0

    movec d0, VBR

}

 

is valid code for Coldfire corem but

 

asm{

    movec VBR, do

    move  d0, regValue

}

 

Is not valid code.

 

CrasyCat

0 件の賞賛
返信
1,805件の閲覧回数
MiataTexan
Contributor II

Thanks.  It appears Coldfire cannot report the current value in the control registers whereas the 68K can.  The original application relied on that feature for error reporting.  Looks like I'll have to set up a structure to keep the last written values to those registers and filter those through the error routines.

 

You saved me a lot of experimentation.  I appreciate it.

0 件の賞賛
返信