Add support for running FreeRTOS on Secure Side only in Cortex M33 port. Also, change spaces to tabs.

This commit is contained in:
Gaurav Aggarwal 2019-02-20 00:25:45 +00:00
parent c3c9c12ce2
commit 5849459c65
45 changed files with 6989 additions and 6739 deletions

View file

@ -76,48 +76,48 @@ static void prvROAccessTask( void * pvParameters )
{
uint8_t ucVal;
/* Unused parameters. */
( void ) pvParameters;
/* Unused parameters. */
( void ) pvParameters;
for( ; ; )
{
/* This task has RO access to ucSharedMemory and therefore it can read
* it but cannot modify it. */
ucVal = ucSharedMemory[ 0 ];
for( ; ; )
{
/* This task has RO access to ucSharedMemory and therefore it can read
* it but cannot modify it. */
ucVal = ucSharedMemory[ 0 ];
/* Silent compiler warnings about unused variables. */
( void ) ucVal;
/* Silent compiler warnings about unused variables. */
( void ) ucVal;
/* Since this task has Read Only access to the ucSharedMemory region,
* writing to it results in Memory Fault. Set ucROTaskFaultTracker[ 0 ]
* to 1 to tell the Memory Fault Handler that this is an expected fault.
* The handler will recover from this fault gracefully by jumping to the
* next instruction. */
ucROTaskFaultTracker[ 0 ] = 1;
/* Since this task has Read Only access to the ucSharedMemory region,
* writing to it results in Memory Fault. Set ucROTaskFaultTracker[ 0 ]
* to 1 to tell the Memory Fault Handler that this is an expected fault.
* The handler will recover from this fault gracefully by jumping to the
* next instruction. */
ucROTaskFaultTracker[ 0 ] = 1;
/* Illegal access to generate Memory Fault. */
ucSharedMemory[ 0 ] = 0;
/* Illegal access to generate Memory Fault. */
ucSharedMemory[ 0 ] = 0;
/* Wait for a second. */
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
/* Wait for a second. */
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
}
/*-----------------------------------------------------------*/
static void prvRWAccessTask( void * pvParameters )
{
/* Unused parameters. */
( void ) pvParameters;
/* Unused parameters. */
( void ) pvParameters;
for( ; ; )
{
/* This task has RW access to ucSharedMemory and therefore can write to
* it. */
ucSharedMemory[ 0 ] = 0;
for( ; ; )
{
/* This task has RW access to ucSharedMemory and therefore can write to
* it. */
ucSharedMemory[ 0 ] = 0;
/* Wait for a second. */
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
/* Wait for a second. */
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
}
/*-----------------------------------------------------------*/
@ -127,38 +127,38 @@ static StackType_t xROAccessTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__(
static StackType_t xRWAccessTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
TaskParameters_t xROAccessTaskParameters =
{
.pvTaskCode = prvROAccessTask,
.pcName = "ROAccess",
.usStackDepth = configMINIMAL_STACK_SIZE,
.pvParameters = NULL,
.uxPriority = tskIDLE_PRIORITY,
.puxStackBuffer = xROAccessTaskStack,
.xRegions = {
{ ucSharedMemory, 32, tskMPU_REGION_READ_ONLY | tskMPU_REGION_EXECUTE_NEVER },
{ ucROTaskFaultTracker, 32, tskMPU_REGION_READ_WRITE | tskMPU_REGION_EXECUTE_NEVER },
{ 0, 0, 0 },
}
.pvTaskCode = prvROAccessTask,
.pcName = "ROAccess",
.usStackDepth = configMINIMAL_STACK_SIZE,
.pvParameters = NULL,
.uxPriority = tskIDLE_PRIORITY,
.puxStackBuffer = xROAccessTaskStack,
.xRegions = {
{ ucSharedMemory, 32, tskMPU_REGION_READ_ONLY | tskMPU_REGION_EXECUTE_NEVER },
{ ucROTaskFaultTracker, 32, tskMPU_REGION_READ_WRITE | tskMPU_REGION_EXECUTE_NEVER },
{ 0, 0, 0 },
}
};
TaskParameters_t xRWAccessTaskParameters =
{
.pvTaskCode = prvRWAccessTask,
.pcName = "RWAccess",
.usStackDepth = configMINIMAL_STACK_SIZE,
.pvParameters = NULL,
.uxPriority = tskIDLE_PRIORITY,
.puxStackBuffer = xRWAccessTaskStack,
.xRegions = {
{ ucSharedMemory, 32, tskMPU_REGION_READ_WRITE | tskMPU_REGION_EXECUTE_NEVER },
{ 0, 0, 0 },
{ 0, 0, 0 },
}
.pvTaskCode = prvRWAccessTask,
.pcName = "RWAccess",
.usStackDepth = configMINIMAL_STACK_SIZE,
.pvParameters = NULL,
.uxPriority = tskIDLE_PRIORITY,
.puxStackBuffer = xRWAccessTaskStack,
.xRegions = {
{ ucSharedMemory, 32, tskMPU_REGION_READ_WRITE | tskMPU_REGION_EXECUTE_NEVER },
{ 0, 0, 0 },
{ 0, 0, 0 },
}
};
/* Create an unprivileged task with RO access to ucSharedMemory. */
xTaskCreateRestricted( &( xROAccessTaskParameters ), NULL );
/* Create an unprivileged task with RO access to ucSharedMemory. */
xTaskCreateRestricted( &( xROAccessTaskParameters ), NULL );
/* Create an unprivileged task with RW access to ucSharedMemory. */
xTaskCreateRestricted( &( xRWAccessTaskParameters ), NULL );
/* Create an unprivileged task with RW access to ucSharedMemory. */
xTaskCreateRestricted( &( xRWAccessTaskParameters ), NULL );
}
/*-----------------------------------------------------------*/
@ -166,27 +166,27 @@ void vHandleMemoryFault( uint32_t * pulFaultStackAddress )
{
uint32_t ulPC;
/* Is this an expected fault? */
if( ucROTaskFaultTracker[ 0 ] == 1 )
{
/* Read program counter. */
ulPC = pulFaultStackAddress[ 6 ];
/* Is this an expected fault? */
if( ucROTaskFaultTracker[ 0 ] == 1 )
{
/* Read program counter. */
ulPC = pulFaultStackAddress[ 6 ];
/* Increment the program counter by 2 to move to the next instruction. */
ulPC += 2;
/* Increment the program counter by 2 to move to the next instruction. */
ulPC += 2;
/* Save the new program counter on the stack. */
pulFaultStackAddress[ 6 ] = ulPC;
/* Save the new program counter on the stack. */
pulFaultStackAddress[ 6 ] = ulPC;
/* Mark the fault as handled. */
ucROTaskFaultTracker[ 0 ] = 0;
}
else
{
/* This is an unexpected fault - loop forever. */
for( ; ; )
{
}
}
/* Mark the fault as handled. */
ucROTaskFaultTracker[ 0 ] = 0;
}
else
{
/* This is an unexpected fault - loop forever. */
for( ; ; )
{
}
}
}
/*-----------------------------------------------------------*/