R1 register reading

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

R1 register reading

1,657 次查看
abdelrhman
Contributor III

Hi all,

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

0 项奖励
回复
10 回复数

1,648 次查看
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,640 次查看
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,627 次查看
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,636 次查看
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,633 次查看
abdelrhman
Contributor III

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

 

0 项奖励
回复

1,625 次查看
jiri_kral
NXP Employee
NXP Employee

For reference - here is my test project. 

0 项奖励
回复

1,629 次查看
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,624 次查看
abdelrhman
Contributor III

This is my project 
it is just an example 

 

0 项奖励
回复

1,617 次查看
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,615 次查看
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 项奖励
回复