Skip to content

Conversation

@mike-scott
Copy link
Contributor

Ethernet on K64F is connected via Logical Bus Master 3.
Section 19.3.8 of K64F reference manual establishes bits 20-18
(M3UM) on page 427 as "Bus Master 3 User Mode Access Control".

To fix RW via Bus Master 3 when MPU is enabled, we need to add
these bits to the MPU region descriptors.

This fixes ETH0 on K64F when MPU is enabled.

Fix recommended by Maureen Helm [email protected]

Signed-off-by: Michael Scott [email protected]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh > 80 chars. Fixing. (same below)

@nashif nashif requested review from MaureenHelm and fvincenzo May 19, 2017 22:39
@nashif nashif assigned nashif and MaureenHelm and unassigned nashif May 19, 2017
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should clean up the magic # here.

Seems like you are setting M3UM field, if so should probably be 0x7 << 18, also why is execute (X) needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execute isn't needed. Mike misunderstood my fix a little bit, my fault for not being completely clear. I suggested that he add bits 20,19,18 to the rwx macros, but I should have said respectively. In other words, add bit 20 to the read macro, bit 19 to the write macro, and bit 18 to the exec macro.

Regarding the magic numbers, there are additional helper macros in MK64F12.h for the sysmpu register fields. You can use SYSMPU_WORD_M3UM(x)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaureenHelm Thank you for the clarification. I'll fix this up along with @galak comments.

galak
galak previously requested changes May 22, 2017
Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since M3UM is a field, we should shift the whole field value at once.

Also would be nice to add some #defines for:

NXP_MPU_UX
NXP_MPU_UR
NXP_MPU_UW

@majava3000
Copy link
Contributor

Hi all, also reported this issue on IRC previously (czrweb) and @mike-scott asked to test this fix, and reporting that it works (web-server example runs now).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execute isn't needed. Mike misunderstood my fix a little bit, my fault for not being completely clear. I suggested that he add bits 20,19,18 to the rwx macros, but I should have said respectively. In other words, add bit 20 to the read macro, bit 19 to the write macro, and bit 18 to the exec macro.

Regarding the magic numbers, there are additional helper macros in MK64F12.h for the sysmpu register fields. You can use SYSMPU_WORD_M3UM(x)

@pfalcon
Copy link
Contributor

pfalcon commented May 22, 2017

Also tested using ping to echo_server sample.

Michael Scott added 2 commits May 23, 2017 16:32
Let's clarify what bits are being set by removing magic numbers in the
MPU READ/WRITE/EXECUTE User Mode and Supervisor Mode defines.

Signed-off-by: Michael Scott <[email protected]>
Ethernet on K64F is connected via Logical Bus Master 3.
Section 19.3.8 of K64F reference manual establishes bits 20-18
(M3UM) on page 427 as "Bus Master 3 User Mode Access Control".

To fix RWX user mode access via Bus Master 3 when MPU is enabled,
we need to add these bits to the MPU region descriptors.

This fixes ETH0 on K64F when MPU is enabled.

Fix recommended by Maureen Helm <[email protected]>

Signed-off-by: Michael Scott <[email protected]>
@mike-scott
Copy link
Contributor Author

Updated this patch into 2 patches:

  • First to clean up the existing magic #'s for user mode access / supervisor mode access
  • Second to add bus master 3 to the READ/WRITE/EXEC macros

Copy link
Contributor

@pfalcon pfalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants