R1 register reading

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

R1 register reading

1,386件の閲覧回数
abdelrhman
Contributor III

Hi all,

How to read or access a general register R1 in MPC5744P micro-controller?
Thanks 

0 件の賞賛
返信
10 返答(返信)

1,377件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm not sure what you mean, but R1 is general purpose register and can be normally used as any other register in assembly code. 

Can you please share more details? 

0 件の賞賛
返信

1,369件の閲覧回数
abdelrhman
Contributor III

yes I meant that
but the question
Is there a memory mapped address for register R1 instead of using assembly code for accessing it?

0 件の賞賛
返信

1,356件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Um, I'm not sure which compiler do you use. This is working only with gcc, not with diab or GHS. 

0 件の賞賛
返信

1,365件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

I see. Yes, you can assign register to a variable like this: 

register int My_C_r1 asm ("r1");

 

 

0 件の賞賛
返信

1,362件の閲覧回数
abdelrhman
Contributor III

I defined a variable like this but it raises the following error 
expected '=', ',', ';', 'asm' or '__attribute__' before 'asm' 

 

0 件の賞賛
返信

1,354件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

For reference - here is my test project. 

0 件の賞賛
返信

1,358件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Can you please share the code snippet with variable definition? For me it is working normally (tested with MPC5744P). 

0 件の賞賛
返信

1,353件の閲覧回数
abdelrhman
Contributor III

This is my project 
it is just an example 

 

0 件の賞賛
返信

1,346件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

this construction can be used with the S32DS default C standard, not with C99. 

Anyway, this technique is almost unusable and deprecated because of optimization. Can you describe in more details what is your goal? 

0 件の賞賛
返信

1,344件の閲覧回数
abdelrhman
Contributor III

My goal is to implement a function to monitor the value of R1 register in run time, then import this function to be used in a simulink model. 

0 件の賞賛
返信