R1 register reading

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

R1 register reading

1,227 Views
abdelrhman
Contributor III

Hi all,

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

0 Kudos
10 Replies

1,218 Views
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 Kudos

1,210 Views
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 Kudos

1,197 Views
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 Kudos

1,206 Views
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 Kudos

1,203 Views
abdelrhman
Contributor III

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

 

0 Kudos

1,195 Views
jiri_kral
NXP Employee
NXP Employee

For reference - here is my test project. 

0 Kudos

1,199 Views
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 Kudos

1,194 Views
abdelrhman
Contributor III

This is my project 
it is just an example 

 

0 Kudos

1,187 Views
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 Kudos

1,185 Views
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 Kudos