cancel
Showing results for 
Search instead for 
Did you mean: 

Possible timing issue in STM32F429 Discovery FreeRTOS MPU Demo?

TS1
Associate

Hi There,

I've made some tests with the FreeRTOS MPU demo project using the STM32F429 Discovery Board.

While most of the code snippets, that should be uncommented to test, resulted in an exception as expected, the test after portSWITCH_TO_USER_MODE didn't raise an exception.

I've made some tests and modifications and finally realized, that after the call to portSWITCH_TO_USER_MODE a little bit of time is required until the restriction will work.

Following code snippet from the TestMemoryRegions function:

  /* Now set the task into user mode. */
  portSWITCH_TO_USER_MODE();
 
  /* The following loop is only for wasting time. Without this part of code the access to the
   * privileged array is possible without an exception
   */
  for( x = 0; x < 1; x++ )
  {
      ReadWriteArray[ x ] = 'a';
      if( ReadWriteArray[ x ] != 'a' )
      {
            /* Something unexpected happened.  Delete this task so the error is
            apparent (no output will be displayed). */
            vTaskDelete( NULL );
      }
  }
 
  /* Accessing the privileged only array will now cause a fault.  Uncomment
  the following line to test. */
  /* PrivilegedOnlyAccessArray[ 0 ] = 'a'; */
 

Can someone please explain this behavior?

Thanks

0 REPLIES 0