<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis MicrocontrollersのトピックRe: Switch to user mode on K82 with MPU</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-user-mode-on-K82-with-MPU/m-p/784397#M47786</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Xiangjun Rong&amp;nbsp;&lt;/SPAN&gt;!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I completely disable MPU block , it is not problem at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I disable Master0 in region 0&lt;/P&gt;&lt;P&gt;/* Invalidate Region 0 for Master 0, remove background region with wide access right. */&lt;BR /&gt; master0 = prvComposeRegionRightMPU(kSYSMPU_SupervisorEqualToUsermode, kSYSMPU_UserNoAccessRights);&lt;BR /&gt; SYSMPU_SetRegionRwxMasterAccessRights(SYSMPU, 0, 0, &amp;amp;master0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nothing dosn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for remove wide access to everything, I have splitted accesses right for master0 for multiple&lt;/P&gt;&lt;P&gt;Regions, e.g Flash, SRAM, etc. separately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But Region 0 is still have full access right for Master1 ( Debug ) what can't be removed in principle.&lt;/P&gt;&lt;P&gt;Other Masters 2-4 I have disabled as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Eugene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2018 09:10:18 GMT</pubDate>
    <dc:creator>EugeneHiihtaja</dc:creator>
    <dc:date>2018-06-21T09:10:18Z</dc:date>
    <item>
      <title>Switch to user mode on K82 with MPU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-user-mode-on-K82-with-MPU/m-p/784395#M47784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On K82 MPU is always enabled&amp;nbsp; and Region 0 provisioned with record what give access to whole memore space for all masters in user and privileged mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have start to think how-to port freeRTOS-MPU for K82 is show busFault if task try to drop to user mode by using control register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Set the privilege level to user mode if xRunningPrivileged is false. */&lt;BR /&gt;portFORCE_INLINE static void vPortResetPrivilege( BaseType_t xRunningPrivileged )&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;if( xRunningPrivileged != pdTRUE )&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;__asm volatile ( " mrs r0, control \n" \&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;" orr r0, #1 \n" \&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;" msr control, r0 \n" \&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:::"r0", "memory" );&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BusFault is enabled and first call of this function cause BusFault even all memory areas accesable in User mode.&lt;/P&gt;&lt;P&gt;If all Tasks created as privileged, this function is not called and no any problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current assumption that K82 require more complicate sequence and may be MPU should be disabled/enabled globally.&lt;/P&gt;&lt;P&gt;But in user mode may be not possible to reenable MPU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you suggest if this sequence is OK for K82 with MPU ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Eugene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 16:51:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-user-mode-on-K82-with-MPU/m-p/784395#M47784</guid>
      <dc:creator>EugeneHiihtaja</dc:creator>
      <dc:date>2018-06-14T16:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Switch to user mode on K82 with MPU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-user-mode-on-K82-with-MPU/m-p/784396#M47785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Eugene,&lt;/P&gt;&lt;P&gt;If you disable MPU function, do you have issue when you configure to user mode?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2018 08:38:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-user-mode-on-K82-with-MPU/m-p/784396#M47785</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2018-06-21T08:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Switch to user mode on K82 with MPU</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-user-mode-on-K82-with-MPU/m-p/784397#M47786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Xiangjun Rong&amp;nbsp;&lt;/SPAN&gt;!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I completely disable MPU block , it is not problem at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I disable Master0 in region 0&lt;/P&gt;&lt;P&gt;/* Invalidate Region 0 for Master 0, remove background region with wide access right. */&lt;BR /&gt; master0 = prvComposeRegionRightMPU(kSYSMPU_SupervisorEqualToUsermode, kSYSMPU_UserNoAccessRights);&lt;BR /&gt; SYSMPU_SetRegionRwxMasterAccessRights(SYSMPU, 0, 0, &amp;amp;master0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nothing dosn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for remove wide access to everything, I have splitted accesses right for master0 for multiple&lt;/P&gt;&lt;P&gt;Regions, e.g Flash, SRAM, etc. separately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But Region 0 is still have full access right for Master1 ( Debug ) what can't be removed in principle.&lt;/P&gt;&lt;P&gt;Other Masters 2-4 I have disabled as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Eugene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2018 09:10:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-user-mode-on-K82-with-MPU/m-p/784397#M47786</guid>
      <dc:creator>EugeneHiihtaja</dc:creator>
      <dc:date>2018-06-21T09:10:18Z</dc:date>
    </item>
  </channel>
</rss>

