mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Update MPU projects to build with V7.1.0 - NOTE - these now build but do not necessarily execute correct from the Rowley IDE.
This commit is contained in:
parent
7b340a1f9c
commit
73287e108b
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
|
@ -79,6 +79,7 @@
|
|||
#define configIDLE_SHOULD_YIELD 0
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_MUTEXES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE CrossStudio_Project_File>
|
||||
<solution Name="RTOSDemo" version="2">
|
||||
<solution Name="RTOSDemo" target="8" version="2">
|
||||
<project Name="RTOSDemo">
|
||||
<configuration Name="Common" Target="LM3S8962" arm_architecture="v7M" arm_core_type="Cortex-M3" arm_linker_fiq_stack_size="0" arm_linker_heap_size="0" arm_linker_irq_stack_size="0" arm_linker_process_stack_size="0" arm_linker_stack_size="400" arm_simulator_memory_simulation_filename="$(PackagesDir)/targets/Luminary_LM3S/LM3SSimulatorMemory.dll" arm_simulator_memory_simulation_parameter="0x40000;0x10000" arm_target_debug_interface_type="ADIv5" arm_target_flash_loader_type="LIBMEM RPC Loader" build_remove_unused_symbols="No" c_only_additional_options="-Wall;-Wextra" c_preprocessor_definitions="sprintf=usprintf;snprintf=usnprintf;printf=uipprintf" c_user_include_directories="..\\..\\Source\\include;..\\..\\Source\\portable\\GCC\\ARM_CM3_MPU;..\\Common\\include;..\\Common\\drivers\\LuminaryMicro;.;$(SamplesDir)/Luminary_Stellaris_Driver_Library" gcc_optimization_level="None" linker_additional_files="" linker_memory_map_file="$(PackagesDir)/targets/Luminary_LM3S/LM3S8962_MemoryMap.xml" linker_output_format="None" linker_printf_fmt_level="int" linker_printf_width_precision_supported="No" linker_scanf_fmt_level="int" project_directory="" project_type="Executable" property_groups_file_path="$(PackagesDir)/targets/Luminary_LM3S/propertyGroups.xml"/>
|
||||
<configuration Name="Common" Target="LM3S8962" arm_architecture="v7M" arm_core_type="Cortex-M3" arm_linker_fiq_stack_size="0" arm_linker_heap_size="0" arm_linker_irq_stack_size="0" arm_linker_process_stack_size="0" arm_linker_stack_size="400" arm_simulator_memory_simulation_filename="$(PackagesDir)/targets/Luminary_LM3S/LM3SSimulatorMemory.dll" arm_simulator_memory_simulation_parameter="0x40000;0x10000" arm_target_debug_interface_type="ADIv5" arm_target_flash_loader_type="LIBMEM RPC Loader" arm_use_gcc_libraries="No" build_remove_unused_symbols="No" c_only_additional_options="-Wall;-Wextra" c_preprocessor_definitions="sprintf=usprintf;snprintf=usnprintf;printf=uipprintf" c_user_include_directories="..\\..\\Source\\include;..\\..\\Source\\portable\\GCC\\ARM_CM3_MPU;..\\Common\\include;..\\Common\\drivers\\LuminaryMicro;.;$(SamplesDir)/Luminary_Stellaris_Driver_Library" gcc_optimization_level="None" link_IOLibraryName="none" linker_additional_files="" linker_memory_map_file="$(PackagesDir)/targets/Luminary_LM3S/LM3S8962_MemoryMap.xml" linker_output_format="None" linker_printf_fmt_level="int" linker_printf_width_precision_supported="No" linker_scanf_fmt_level="int" project_directory="" project_type="Executable" property_groups_file_path="$(PackagesDir)/targets/Luminary_LM3S/propertyGroups.xml"/>
|
||||
<configuration Name="Flash" Placement="Flash" arm_target_flash_loader_file_path="$(PackagesDir)/targets/Luminary_LM3S/Release/Loader.elf" linker_section_placement_file="$(ProjectDir)/flash_placement.xml" target_reset_script="FLASHReset()"/>
|
||||
<configuration Name="RAM" Placement="RAM" linker_section_placement_file="$(PackagesDir)/targets/Luminary_LM3S/ram_placement.xml" target_reset_script="RAMReset()"/>
|
||||
<folder Name="Source Files">
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
<session>
|
||||
<Bookmarks/>
|
||||
<Breakpoints/>
|
||||
<ETMWindow>
|
||||
<ETMRegister number="0" value="800" />
|
||||
<ETMRegister number="8" value="6f" />
|
||||
<ETMRegister number="9" value="1000000" />
|
||||
</ETMWindow>
|
||||
<ExecutionCountWindow/>
|
||||
<Memory1>
|
||||
<MemoryWindow autoEvaluate="0" addressText="0x200002d0" numColumns="8" sizeText="120" dataSize="1" radix="16" addressSpace="" />
|
||||
|
@ -19,18 +24,20 @@
|
|||
<ProjectSessionItem path="RTOSDemo" name="unnamed" />
|
||||
<ProjectSessionItem path="RTOSDemo;RTOSDemo" name="unnamed" />
|
||||
<ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files" name="unnamed" />
|
||||
<ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;FreeRTOS MPU" name="unnamed" />
|
||||
<ProjectSessionItem path="RTOSDemo;RTOSDemo;Source Files;include" name="unnamed" />
|
||||
</Project>
|
||||
<Register1>
|
||||
<RegisterWindow openNodes="CPU;CPU/xPSR;CPU/CFBP;CPU/CFBP/CONTROL[0];CPU/CFBP/CONTROL[1];Interrupt_Type" binaryNodes="" unsignedNodes="" visibleGroups="CPU;Interrupt_Type" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
<RegisterWindow openNodes="CPU;CPU/xPSR;CPU/CFBP;CPU/CFBP/CONTROL[0];CPU/CFBP/CONTROL[1];Interrupt_Type" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU;Interrupt_Type" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register1>
|
||||
<Register2>
|
||||
<RegisterWindow openNodes="MPU;MPU/MPU_Control;MPU/MPU_Region_Number;MPU/MPU_Region_Base_Address;MPU/MPU_Attribute_and_Size" binaryNodes="MPU/MPU_Attribute_and_Size/SIZE" unsignedNodes="" visibleGroups="MPU" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
<RegisterWindow openNodes="MPU;MPU/MPU_Control;MPU/MPU_Region_Number;MPU/MPU_Region_Base_Address;MPU/MPU_Attribute_and_Size" binaryNodes="MPU/MPU_Attribute_and_Size/SIZE" hiddenNodes="" unsignedNodes="" visibleGroups="MPU" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register2>
|
||||
<Register3>
|
||||
<RegisterWindow openNodes="System_Control_Block;System_Control_Block/System_Handlers_8_11_Priority;System_Control_Block/System_Handler_Control_and_State" binaryNodes="" unsignedNodes="" visibleGroups="System_Control_Block" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
<RegisterWindow openNodes="System_Control_Block;System_Control_Block/System_Handlers_8_11_Priority;System_Control_Block/System_Handler_Control_and_State" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="System_Control_Block" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register3>
|
||||
<Register4>
|
||||
<RegisterWindow openNodes="" binaryNodes="" unsignedNodes="" visibleGroups="" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
<RegisterWindow openNodes="" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register4>
|
||||
<TargetWindow programAction="" uploadFileType="" programLoadAddress="" programSize="" uploadFileName="" uploadMemoryInterface="" programFileName="" uploadStartAddress="" programFileType="" uploadSize="" programMemoryInterface="" />
|
||||
<TraceWindow>
|
||||
|
@ -49,7 +56,9 @@
|
|||
<Watches active="0" update="Never" />
|
||||
</Watch4>
|
||||
<Files>
|
||||
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\Demo\CORTEX_MPU_LM3Sxxxx_Rowley\main.c" y="5" path="C:\E\Dev\FreeRTOS\WorkingCopy\Demo\CORTEX_MPU_LM3Sxxxx_Rowley\main.c" left="0" selected="1" name="unnamed" top="0" />
|
||||
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\Demo\CORTEX_MPU_LM3Sxxxx_Rowley\main.c" y="320" path="C:\E\Dev\FreeRTOS\WorkingCopy\Demo\CORTEX_MPU_LM3Sxxxx_Rowley\main.c" left="0" selected="0" name="unnamed" top="302" />
|
||||
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\Source\tasks.c" y="1090" path="C:\E\Dev\FreeRTOS\WorkingCopy\Source\tasks.c" left="0" selected="0" name="unnamed" top="1054" />
|
||||
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\E\Dev\FreeRTOS\WorkingCopy\Source\portable\GCC\ARM_CM3_MPU\port.c" y="288" path="C:\E\Dev\FreeRTOS\WorkingCopy\Source\portable\GCC\ARM_CM3_MPU\port.c" left="0" selected="1" name="unnamed" top="252" />
|
||||
</Files>
|
||||
<ARMCrossStudioWindow activeProject="RTOSDemo" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:\E\Dev\FreeRTOS\WorkingCopy\Source\portable\GCC\ARM_CM3_MPU" fileDialogDefaultFilter="*.*" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
|
||||
</session>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
|
@ -57,7 +57,7 @@
|
|||
* User mode and Privileged mode, and using both the original xTaskCreate() and
|
||||
* the new xTaskCreateRestricted() API functions. The purpose of each created
|
||||
* task is documented in the comments above the task function prototype (in
|
||||
* this file), with the task behaviour demonstrated and documented within the
|
||||
* this file), with the task behaviour demonstrated and documented within the
|
||||
* task function itself. In addition a queue is used to demonstrate passing
|
||||
* data between protected/restricted tasks as well as passing data between an
|
||||
* interrupt and a protected/restricted task.
|
||||
|
@ -98,7 +98,7 @@
|
|||
/* Prototypes for functions that implement tasks. -----------*/
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Prototype for the reg test tasks. Amongst other things, these fill the CPU
|
||||
* registers with known values before checking that the registers still contain
|
||||
* the expected values. Each of the two tasks use different values so an error
|
||||
|
@ -128,15 +128,15 @@ static void prvRegTest2Task( void *pvParameters );
|
|||
static void prvCheckTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Prototype for a task created in User mode using the original vTaskCreate()
|
||||
* Prototype for a task created in User mode using the original vTaskCreate()
|
||||
* API function. The task demonstrates the characteristics of such a task,
|
||||
* before simply deleting itself.
|
||||
*/
|
||||
static void prvOldStyleUserModeTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Prototype for a task created in Privileged mode using the original
|
||||
* vTaskCreate() API function. The task demonstrates the characteristics of
|
||||
* Prototype for a task created in Privileged mode using the original
|
||||
* vTaskCreate() API function. The task demonstrates the characteristics of
|
||||
* such a task, before simply deleting itself.
|
||||
*/
|
||||
static void prvOldStylePrivilegedModeTask( void *pvParameters );
|
||||
|
@ -181,7 +181,7 @@ static void prvTestMemoryRegions( void );
|
|||
/* The handle of the queue used to communicate between tasks and between tasks
|
||||
and interrupts. Note that this is a file scope variable that falls outside of
|
||||
any MPU region. As such other techniques have to be used to allow the tasks
|
||||
to gain access to the queue. See the comments in the tasks themselves for
|
||||
to gain access to the queue. See the comments in the tasks themselves for
|
||||
further information. */
|
||||
static xQueueHandle xFileScopeCheckQueue = NULL;
|
||||
|
||||
|
@ -196,8 +196,8 @@ stack size is defined in words, not bytes. */
|
|||
#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )
|
||||
|
||||
/* Declare the stack that will be used by the check task. The kernel will
|
||||
automatically create an MPU region for the stack. The stack alignment must
|
||||
match its size, so if 128 words are reserved for the stack then it must be
|
||||
automatically create an MPU region for the stack. The stack alignment must
|
||||
match its size, so if 128 words are reserved for the stack then it must be
|
||||
aligned to ( 128 * 4 ) bytes. */
|
||||
static portSTACK_TYPE xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainCHECK_TASK_STACK_ALIGNMENT );
|
||||
|
||||
|
@ -206,9 +206,9 @@ using the xTaskParameters structure below. THIS IS JUST TO DEMONSTRATE THE
|
|||
MPU FUNCTIONALITY, the data is not used by the check tasks primary function
|
||||
of monitoring the reg test tasks and printing out status information.
|
||||
|
||||
Note that the arrays allocate slightly more RAM than is actually assigned to
|
||||
the MPU region. This is to permit writes off the end of the array to be
|
||||
detected even when the arrays are placed in adjacent memory locations (with no
|
||||
Note that the arrays allocate slightly more RAM than is actually assigned to
|
||||
the MPU region. This is to permit writes off the end of the array to be
|
||||
detected even when the arrays are placed in adjacent memory locations (with no
|
||||
gaps between them). The align size must be a power of two. */
|
||||
#define mainREAD_WRITE_ARRAY_SIZE 130
|
||||
#define mainREAD_WRITE_ALIGN_SIZE 128
|
||||
|
@ -238,7 +238,7 @@ static const xTaskParameters xCheckTaskParameters =
|
|||
created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE
|
||||
MPU FUNCTIONALITY, the data is not used by the check tasks primary function
|
||||
of monitoring the reg test tasks and printing out status information.*/
|
||||
{
|
||||
{
|
||||
/* Base address Length Parameters */
|
||||
{ cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE },
|
||||
{ cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY },
|
||||
|
@ -246,17 +246,17 @@ static const xTaskParameters xCheckTaskParameters =
|
|||
}
|
||||
};
|
||||
|
||||
/* Three MPU regions are defined for use by the 'check' task when the task is
|
||||
/* Three MPU regions are defined for use by the 'check' task when the task is
|
||||
created. These are only used to demonstrate the MPU features and are not
|
||||
actually necessary for the check task to fulfill its primary purpose. Instead
|
||||
the MPU regions are replaced with those defined by xAltRegions prior to the
|
||||
the MPU regions are replaced with those defined by xAltRegions prior to the
|
||||
check task receiving any data on the queue or printing any messages to the
|
||||
debug console. The region configured by xAltRegions just gives the check task
|
||||
access to the debug variables that form part of the Rowley library, and are
|
||||
accessed within the debug_printf() function. */
|
||||
extern unsigned long dbgCntrlWord_mempoll;
|
||||
static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
|
||||
{
|
||||
{
|
||||
/* Base address Length Parameters */
|
||||
{ ( void * ) &dbgCntrlWord_mempoll, 32, portMPU_REGION_READ_WRITE },
|
||||
{ 0, 0, 0 },
|
||||
|
@ -275,8 +275,8 @@ that stack size is defined in words, not bytes. */
|
|||
#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )
|
||||
|
||||
/* Declare the stacks that will be used by the reg test tasks. The kernel will
|
||||
automatically create an MPU region for the stack. The stack alignment must
|
||||
match its size, so if 128 words are reserved for the stack then it must be
|
||||
automatically create an MPU region for the stack. The stack alignment must
|
||||
match its size, so if 128 words are reserved for the stack then it must be
|
||||
aligned to ( 128 * 4 ) bytes. */
|
||||
static portSTACK_TYPE xRegTest1Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );
|
||||
static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );
|
||||
|
@ -380,11 +380,11 @@ const char *pcStatusMessage = "PASS\r\n";
|
|||
|
||||
/* Print out the amount of free heap space so configTOTAL_HEAP_SIZE can be
|
||||
tuned. The heap size is set to be very small in this example and will need
|
||||
to be increased before many more tasks, queues or semaphores can be
|
||||
to be increased before many more tasks, queues or semaphores can be
|
||||
created. */
|
||||
debug_printf( "There are %d bytes of unused heap space.\r\n", xPortGetFreeHeapSize() );
|
||||
|
||||
/* Demonstrate how the various memory regions can and can't be accessed.
|
||||
/* Demonstrate how the various memory regions can and can't be accessed.
|
||||
The task privilege level is set down to user mode within this function. */
|
||||
prvTestMemoryRegions();
|
||||
|
||||
|
@ -398,26 +398,26 @@ const char *pcStatusMessage = "PASS\r\n";
|
|||
{
|
||||
/* Wait for the next message to arrive. */
|
||||
xQueueReceive( xQueue, &lMessage, portMAX_DELAY );
|
||||
|
||||
|
||||
switch( lMessage )
|
||||
{
|
||||
case mainREG_TEST_1_STILL_EXECUTING :
|
||||
case mainREG_TEST_1_STILL_EXECUTING :
|
||||
/* Message from task 1, so task 1 must still be executing. */
|
||||
( ulStillAliveCounts[ 0 ] )++;
|
||||
break;
|
||||
|
||||
case mainREG_TEST_2_STILL_EXECUTING :
|
||||
case mainREG_TEST_2_STILL_EXECUTING :
|
||||
/* Message from task 2, so task 2 must still be executing. */
|
||||
( ulStillAliveCounts[ 1 ] )++;
|
||||
break;
|
||||
|
||||
case mainPRINT_SYSTEM_STATUS :
|
||||
case mainPRINT_SYSTEM_STATUS :
|
||||
/* Message from tick hook, time to print out the system
|
||||
status. If messages has stopped arriving from either reg
|
||||
test task then the status must be set to fail. */
|
||||
if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) )
|
||||
{
|
||||
/* One or both of the test tasks are no longer sending
|
||||
/* One or both of the test tasks are no longer sending
|
||||
'still alive' messages. */
|
||||
pcStatusMessage = "FAIL\r\n";
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ const char *pcStatusMessage = "PASS\r\n";
|
|||
break;
|
||||
|
||||
default :
|
||||
/* Something unexpected happened. Delete this task so the
|
||||
/* Something unexpected happened. Delete this task so the
|
||||
error is apparent (no output will be displayed). */
|
||||
prvDeleteMe();
|
||||
break;
|
||||
|
@ -445,8 +445,8 @@ static void prvTestMemoryRegions( void )
|
|||
long l;
|
||||
char cTemp;
|
||||
|
||||
/* The check task (from which this function is called) is created in the
|
||||
Privileged mode. The privileged array can be both read from and written
|
||||
/* The check task (from which this function is called) is created in the
|
||||
Privileged mode. The privileged array can be both read from and written
|
||||
to while this task is privileged. */
|
||||
cPrivilegedOnlyAccessArray[ 0 ] = 'a';
|
||||
if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' )
|
||||
|
@ -457,15 +457,15 @@ char cTemp;
|
|||
}
|
||||
|
||||
/* Writing off the end of the RAM allocated to this task will *NOT* cause a
|
||||
protection fault because the task is still executing in a privileged mode.
|
||||
protection fault because the task is still executing in a privileged mode.
|
||||
Uncomment the following to test. */
|
||||
/*cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a';*/
|
||||
|
||||
/* Now set the task into user mode. */
|
||||
portSWITCH_TO_USER_MODE();
|
||||
|
||||
/* Accessing the privileged only array will now cause a fault. Uncomment
|
||||
the following line to test. */
|
||||
|
||||
/* Accessing the privileged only array will now cause a fault. Uncomment
|
||||
the following line to test. */
|
||||
/*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/
|
||||
|
||||
/* The read/write array can still be successfully read and written. */
|
||||
|
@ -481,7 +481,7 @@ char cTemp;
|
|||
}
|
||||
|
||||
/* But attempting to read or write off the end of the RAM allocated to this
|
||||
task will cause a fault. Uncomment either of the following two lines to
|
||||
task will cause a fault. Uncomment either of the following two lines to
|
||||
test. */
|
||||
/* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */
|
||||
/* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */
|
||||
|
@ -495,17 +495,19 @@ char cTemp;
|
|||
/* ...but cannot be written. Uncomment the following line to test. */
|
||||
/* cReadOnlyArray[ 0 ] = 'a'; */
|
||||
|
||||
/* Writing to the first and last locations in the stack array should not
|
||||
/* Writing to the first and last locations in the stack array should not
|
||||
cause a protection fault. Note that doing this will cause the kernel to
|
||||
detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than
|
||||
detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than
|
||||
1. */
|
||||
xCheckTaskStack[ 0 ] = 0;
|
||||
xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0;
|
||||
|
||||
/* Writing off either end of the stack array should cause a protection
|
||||
/* Writing off either end of the stack array should cause a protection
|
||||
fault, uncomment either of the following two lines to test. */
|
||||
/* xCheckTaskStack[ -1 ] = 0; */
|
||||
/* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */
|
||||
|
||||
( void ) cTemp;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -517,7 +519,7 @@ mode. Once this task is in user mode the file scope queue variable will no
|
|||
longer be accessible but the stack copy will. */
|
||||
xQueueHandle xQueue = xFileScopeCheckQueue;
|
||||
|
||||
/* Now the queue handle has been obtained the task can switch to user
|
||||
/* Now the queue handle has been obtained the task can switch to user
|
||||
mode. This is just one method of passing a handle into a protected
|
||||
task, the other reg test task uses the task parameter instead. */
|
||||
portSWITCH_TO_USER_MODE();
|
||||
|
@ -532,12 +534,12 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
|||
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
{
|
||||
/* This task tests the kernel context switch mechanism by reading and
|
||||
writing directly to registers - which requires the test to be written
|
||||
in assembly code. */
|
||||
__asm volatile
|
||||
(
|
||||
__asm volatile
|
||||
(
|
||||
" MOV R4, #104 \n" /* Set registers to a known value. R0 to R1 are done in the loop below. */
|
||||
" MOV R5, #105 \n"
|
||||
" MOV R6, #106 \n"
|
||||
|
@ -560,8 +562,8 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
|||
" BNE prvDeleteMe \n"
|
||||
" CMP R3, #103 \n"
|
||||
" BNE prvDeleteMe \n"
|
||||
" CMP R4, #104 \n"
|
||||
" BNE prvDeleteMe \n"
|
||||
" CMP R4, #104 \n"
|
||||
" BNE prvDeleteMe \n"
|
||||
" CMP R5, #105 \n"
|
||||
" BNE prvDeleteMe \n"
|
||||
" CMP R6, #106 \n"
|
||||
|
@ -579,7 +581,7 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
|||
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
|
||||
);
|
||||
|
||||
/* Send mainREG_TEST_1_STILL_EXECUTING to the check task to indicate that this
|
||||
/* Send mainREG_TEST_1_STILL_EXECUTING to the check task to indicate that this
|
||||
task is still functioning. */
|
||||
prvSendImAlive( xQueue, mainREG_TEST_1_STILL_EXECUTING );
|
||||
|
||||
|
@ -592,7 +594,7 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
|
|||
static void prvRegTest2Task( void *pvParameters )
|
||||
{
|
||||
/* The queue handle is passed in as the task parameter. This is one method of
|
||||
passing data into a protected task, the other reg test task uses a different
|
||||
passing data into a protected task, the other reg test task uses a different
|
||||
method. */
|
||||
xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
||||
|
||||
|
@ -601,15 +603,15 @@ xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
|||
/* This task tests the kernel context switch mechanism by reading and
|
||||
writing directly to registers - which requires the test to be written
|
||||
in assembly code. */
|
||||
__asm volatile
|
||||
(
|
||||
__asm volatile
|
||||
(
|
||||
" MOV R4, #4 \n" /* Set registers to a known value. R0 to R1 are done in the loop below. */
|
||||
" MOV R5, #5 \n"
|
||||
" MOV R6, #6 \n"
|
||||
" MOV R8, #8 \n" /* Frame pointer is omitted as it must not be changed. */
|
||||
" MOV R9, #9 \n"
|
||||
" MOV R10, 10 \n"
|
||||
" MOV R11, #11 \n"
|
||||
" MOV R11, #11 \n"
|
||||
"reg2loop: \n"
|
||||
" MOV R0, #13 \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */
|
||||
" MOV R1, #1 \n"
|
||||
|
@ -643,7 +645,7 @@ xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
|
|||
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
|
||||
);
|
||||
|
||||
/* Send mainREG_TEST_2_STILL_EXECUTING to the check task to indicate that this
|
||||
/* Send mainREG_TEST_2_STILL_EXECUTING to the check task to indicate that this
|
||||
task is still functioning. */
|
||||
prvSendImAlive( xQueue, mainREG_TEST_2_STILL_EXECUTING );
|
||||
|
||||
|
@ -665,8 +667,8 @@ volatile unsigned long ulReadData;
|
|||
|
||||
/* The idle task, and therefore this function, run in Supervisor mode and
|
||||
can therefore access all memory. Try reading from corners of flash and
|
||||
RAM to ensure a memory fault does not occur.
|
||||
|
||||
RAM to ensure a memory fault does not occur.
|
||||
|
||||
Start with the edges of the privileged data area. */
|
||||
pul = __privileged_data_start__;
|
||||
ulReadData = *pul;
|
||||
|
@ -684,14 +686,16 @@ volatile unsigned long ulReadData;
|
|||
pul = __FLASH_segment_end__ - 1;
|
||||
ulReadData = *pul;
|
||||
|
||||
/* Reading off the end of Flash or SRAM space should cause a fault.
|
||||
/* Reading off the end of Flash or SRAM space should cause a fault.
|
||||
Uncomment one of the following two pairs of lines to test. */
|
||||
|
||||
|
||||
/* pul = __FLASH_segment_end__ + 4;
|
||||
ulReadData = *pul; */
|
||||
|
||||
/* pul = __SRAM_segment_end__ + 1;
|
||||
ulReadData = *pul; */
|
||||
|
||||
( void ) ulReadData;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -707,7 +711,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
|||
volatile unsigned long *pul;
|
||||
volatile unsigned long ulReadData;
|
||||
|
||||
/* The following lines are commented out to prevent the unused variable
|
||||
/* The following lines are commented out to prevent the unused variable
|
||||
compiler warnings when the tests that use the variable are also commented out.
|
||||
extern unsigned long __privileged_functions_start__[];
|
||||
const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned long * ) 0xe000e014; */
|
||||
|
@ -747,20 +751,22 @@ const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned
|
|||
|
||||
/* pul = __privileged_functions_start__;
|
||||
ulReadData = *pul; */
|
||||
|
||||
|
||||
/* pul = __privileged_functions_end__ - 1;
|
||||
ulReadData = *pul; */
|
||||
|
||||
/* pul = __privileged_data_start__;
|
||||
ulReadData = *pul; */
|
||||
|
||||
|
||||
/* pul = __privileged_data_end__ - 1;
|
||||
ulReadData = *pul; */
|
||||
|
||||
/* Must not just run off the end of a task function, so delete this task.
|
||||
/* Must not just run off the end of a task function, so delete this task.
|
||||
Note that because this task was created using xTaskCreate() the stack was
|
||||
allocated dynamically and I have not included any code to free it again. */
|
||||
vTaskDelete( NULL );
|
||||
|
||||
( void ) ulReadData;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -780,10 +786,10 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
|||
|
||||
( void ) pvParameters;
|
||||
|
||||
/* This task is created in Privileged mode using the original xTaskCreate()
|
||||
API function. It should have access to all Flash and RAM including that
|
||||
marked as Privileged access only. So reading from the start and end of the
|
||||
non-privileged RAM should not cause a problem (the privileged RAM is the
|
||||
/* This task is created in Privileged mode using the original xTaskCreate()
|
||||
API function. It should have access to all Flash and RAM including that
|
||||
marked as Privileged access only. So reading from the start and end of the
|
||||
non-privileged RAM should not cause a problem (the privileged RAM is the
|
||||
first block at the bottom of the RAM memory). */
|
||||
pul = __privileged_data_end__ + 1;
|
||||
ulReadData = *pul;
|
||||
|
@ -805,7 +811,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
|||
pul = __privileged_functions_end__ - 1;
|
||||
ulReadData = *pul;
|
||||
pul = __privileged_data_start__;
|
||||
ulReadData = *pul;
|
||||
ulReadData = *pul;
|
||||
pul = __privileged_data_end__ - 1;
|
||||
ulReadData = *pul;
|
||||
|
||||
|
@ -814,10 +820,12 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
|
|||
ulReadData = *pulSystemPeripheralRegister;
|
||||
ulReadData = *pulStandardPeripheralRegister;
|
||||
|
||||
/* Must not just run off the end of a task function, so delete this task.
|
||||
/* Must not just run off the end of a task function, so delete this task.
|
||||
Note that because this task was created using xTaskCreate() the stack was
|
||||
allocated dynamically and I have not included any code to free it again. */
|
||||
vTaskDelete( NULL );
|
||||
|
||||
( void ) ulReadData;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -869,8 +877,8 @@ portBASE_TYPE xDummy;
|
|||
ulCallCount = 0;
|
||||
|
||||
/* Send a message to the check task to command it to check that all
|
||||
the tasks are still running then print out the status.
|
||||
|
||||
the tasks are still running then print out the status.
|
||||
|
||||
This is running in an ISR so has to use the "FromISR" version of
|
||||
xQueueSend(). Because it is in an ISR it is running with privileges
|
||||
so can access xFileScopeCheckQueue directly. */
|
||||
|
@ -881,7 +889,7 @@ portBASE_TYPE xDummy;
|
|||
|
||||
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
|
||||
{
|
||||
/* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this
|
||||
/* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this
|
||||
function will automatically get called if a task overflows its stack. */
|
||||
( void ) pxTask;
|
||||
( void ) pcTaskName;
|
||||
|
@ -938,6 +946,15 @@ volatile unsigned int stacked_psr;
|
|||
|
||||
/* Inspect stacked_pc to locate the offending instruction. */
|
||||
for( ;; );
|
||||
|
||||
( void ) stacked_psr;
|
||||
( void ) stacked_pc;
|
||||
( void ) stacked_lr;
|
||||
( void ) stacked_r12;
|
||||
( void ) stacked_r0;
|
||||
( void ) stacked_r1;
|
||||
( void ) stacked_r2;
|
||||
( void ) stacked_r3;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue