/* Declare the stack that will be used by the task. The stack alignment must
match its size and be a power of 2, so if 128 words are reserved for the stack
then it must be aligned to ( 128 * 4 ) bytes. This example used GCC syntax. */
static portSTACK_TYPE xTaskStack[ 128 ] __attribute__((aligned(128*4)));
/* Declare an array that will be accessed by the task. The task should only
be able to read from the array, and not write to it. */
char cReadOnlyArray[ 512 ] __attribute__((aligned(512)));
/* Fill in a TaskParameters_t structure to define the task - this is the
structure passed to the xTaskCreateRestricted() function. */
static const TaskParameters_t xTaskDefinition =
{
vTaskFunction, /* pvTaskCode */
"A task", /* pcName */
128, /* usStackDepth - defined in words, not bytes. */
NULL, /* pvParameters */
1, /* uxPriority - priority 1, start in User mode. */
xTaskStack, /* puxStackBuffer - the array to use as the task stack. */
/* xRegions - In this case only one of the three user definable regions is
actually used. The parameters are used to set the region to read only. */
{
/* Base address Length Parameters */
{ cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY },
{ 0, 0, 0 },
{ 0, 0, 0 },
}
};
void main( void )
{
/* Create the task defined by xTaskDefinition. NULL is used as the second
parameter as a task handle is not required. */
xTaskCreateRestricted( &xTaskDefinition, NULL );
/* Start the RTOS scheduler. */
vTaskStartScheduler();
/* Should not reach here! */
}
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.