[MPC5777M] MPURE instruction usage

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

[MPC5777M] MPURE instruction usage

975 Views
paulodasilvapin
Contributor III

Hello,

I would like to use the mpure assembly instruction to read MAS0,MAS1,MAS2,MAS3 registers

To do such, I've written, as an example, the following code to read MAS0 register corresponding to the 3rd entry of mputable of kind Instruction:

 

# Form entry to read with INST=1, SHD=0, ESEL=3

LIS r3, 0x0103@ha

ADDI r3, 0x0000@l

# Write MAS0 register value

MTSPR 624, r3

MPURE

MSYNC

# Read MAS0 register value

MFSPR r3, 624

 

Q1 : Is this the correct way to do it ? If not could you please provide me with an assembly sampling of code ?

Q2 : When no entry exists in the MPU table corresponding to the (INST,SHD,ESEL) choice, what is the result of mpure operation ?

 

Thanks

Labels (1)
Tags (1)
0 Kudos
5 Replies

720 Views
paulodasilvapin
Contributor III

Thanks Lukas,

I've found why I didn't manage to perform the invalidation using the VALID bit. I didn't noticed that the Read-Only bit was set.

According to the reference manual : 

 - if I set the PROTECT bit then the invalidation process using the MPUFI bit or the VALID bit doesn't clear the corresponding entry

 - if I set the Read-Only bit then the invalidation process using the VALID bit doesn't clear the entry.

For me, all my previous questions are closed.

Regards,

Paulo

0 Kudos

720 Views
paulodasilvapin
Contributor III

Thanks Lukas,

I've reproduced your sequence and it works.

Then I've tried to use the VALID bit to invalidate 2 entries that are INST/SHARED and DATA/SHARED (with the same BOUND and UPPER addresses). It seems that they are not invalidated. If I use the MPUMFI bit then all entries are invalidated.

Question : is it normal that the writting of the VALID bit to 0 has no influence on the invalidation of MPU entries that have the SHD bit to 1 ?

0 Kudos

720 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

It works on my side also for shared entries. In first step, I initialized one shared entry. I could see that it is correct in debugger. Then I wrote exactly the same values to MAS registers, only the valid bit was changed to 0. I could see in debugger that the entry was invalidated.

Regards,

Lukas

0 Kudos

720 Views
paulodasilvapin
Contributor III

Q1:

I've found that I need to set also the SEL bits with value 0b10. So the correct value to put in r3 in my previous example shall be:

0x21030000

Then the reading of MAS0,MAS1, MAS2 and MAS3 registers is OK

Q2:

I've noticed that the reading of the mpu table is possible even if the entry is not valid.

Now, I have another question:

Q3 : When I set the bit MPUFI in register MPU0CSR0, the entries in mpu table are not invalidated : what I see is that the VALID bit of the corresponding entry in MAS0 is not set to 0. Shall I invalidate each entry by modifying each VALID bit in MAS0 ?

0 Kudos

720 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I did quick test on  my board and I can see that the MPUFI is working as expected. However, I used Lauterbach debugger and it seems it does not work as expected - the MMU.DUMP window is not refreshed appropriately. So, I kept the window closed for my test. What I did - I configured and enabled CMPU. Then I set MPUFI by debugger. If I try to step the code now, it will crash because the MPU is still enabled (MPUEN is 1) but all entries are invalidated. So, the sequence should be:

- configure and enable CMPU

- if you want to change the settings: disable CMPU by MPUEN and then write MPUFI. All entries should be invalidated. Now you can enter new configuration.

- if I open MMU.DUMP window now, I can see that all entries are invalidated as expected.

Regards,

Lukas

0 Kudos