Skip to content

Commit 8e664fc

Browse files
authored
Add check for if the scheduler is running to ARMv8M MPU ports (#960)
* Allow access to any buffer in xPortIsAuthorizedToAccessBuffer if xSchedulerRunning is set to pdFALSE * Allow access to any buffer in xPortIsAuthorizedToAccessBuffer if xSchedulerRunning is set to pdFALSE in the copied ARMv8M Port Files
1 parent 72c7d86 commit 8e664fc

File tree

21 files changed

+189
-21
lines changed

21 files changed

+189
-21
lines changed

portable/ARMv8M/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM23/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM23_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM33/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM33_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM35P/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM35P_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM55/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM55_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM85/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/GCC/ARM_CM85_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM23/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM23_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM33/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM33_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM35P/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM35P_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM55/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM55_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM85/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

portable/IAR/ARM_CM85_NTZ/non_secure/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,15 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
19061906
BaseType_t xAccessGranted = pdFALSE;
19071907
const xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings( NULL ); /* Calling task's MPU settings. */
19081908

1909-
if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1909+
if( xSchedulerRunning == pdFALSE )
1910+
{
1911+
/* Grant access to all the kernel objects before the scheduler
1912+
* is started. It is necessary because there is no task running
1913+
* yet and therefore, we cannot use the permissions of any
1914+
* task. */
1915+
xAccessGranted = pdTRUE;
1916+
}
1917+
else if( ( xTaskMpuSettings->ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
19101918
{
19111919
xAccessGranted = pdTRUE;
19121920
}

0 commit comments

Comments
 (0)