On K82 MPU is always enabled and Region 0 provisioned with record what give access to whole memore space for all masters in user and privileged mode.
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.
/* Set the privilege level to user mode if xRunningPrivileged is false. */
portFORCE_INLINE static void vPortResetPrivilege( BaseType_t xRunningPrivileged )
if( xRunningPrivileged != pdTRUE )
__asm volatile ( " mrs r0, control \n" \
" orr r0, #1 \n" \
" msr control, r0 \n" \
:::"r0", "memory" );
BusFault is enabled and first call of this function cause BusFault even all memory areas accesable in User mode.
If all Tasks created as privileged, this function is not called and no any problems.
Current assumption that K82 require more complicate sequence and may be MPU should be disabled/enabled globally.
But in user mode may be not possible to reenable MPU.
Could you suggest if this sequence is OK for K82 with MPU ?