/* Define an array that the task will both read from and write to. Make sure
the size and alignment are appropriate for an MPU region (note this uses GCC
syntax). */
static unsigned char ucOneKByte[ 1024 ] __attribute__((align( 1024 )));
/* Define an array of MemoryRegion_t structures that configures an MPU region
allowing read/write access for 1024 bytes starting at the beginning of the
ucOneKByte array. The other two of the maximum 3 definable regions are
unused so set to zero. */
static const MemoryRegion_t xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
{
/* Base address Length Parameters */
{ ucOneKByte, 1024, portMPU_REGION_READ_WRITE },
{ 0, 0, 0 },
{ 0, 0, 0 }
};
void vATask( void *pvParameters )
{
/* This task was created such that it has access to certain regions of
memory as defined by the MPU configuration. At some point it is
desired that these MPU regions are replaced with that defined in the
xAltRegions const struct above. Use a call to vTaskAllocateMPURegions()
for this purpose. NULL is used as the task handle to indicate that this
function should modify the MPU regions of the calling task. */
vTaskAllocateMPURegions( NULL, xAltRegions );
/* Now the task can continue its function, but from this point on can only
access its stack and the ucOneKByte array (unless any other statically
defined or shared regions have been declared elsewhere). */
}
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.