Increase the test coverage of the GCC MPU demo that runs in the Keil simulator.

Add an MPU demo that uses the Keil simulator that also uses the Keil compiler.
Correct a few version numbers for files recently added to the repository.
This commit is contained in:
Richard Barry 2016-05-18 19:51:14 +00:00
parent ee9cd40b6d
commit e10647f9c0
22 changed files with 2296 additions and 496 deletions

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -201,7 +201,7 @@
<Group>
<GroupName>System</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

View File

@ -191,14 +191,27 @@ standard names. */
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
#define configASSERT( x ) if( ( x ) == 0UL ) { taskENTER_CRITICAL(); for( ;; ); }
#define configASSERT( x ) if( ( x ) == 0UL ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
/* LED not used at present, so just increment a variable to keep a count of the
number of times the LED would otherwise have been toggled. */
#define configTOGGLE_LED() ulLED++
/* Definitions for the messages that can be sent to the check task. */
#define configREG_TEST_1_STILL_EXECUTING ( 0 )
#define configREG_TEST_2_STILL_EXECUTING ( 1 )
#define configTIMER_STILL_EXECUTING ( 2 )
#define configPRINT_SYSTEM_STATUS ( 3 )
/* Parameters that are passed into the third and fourth register check tasks
solely for the purpose of ensuring parameters are passed into tasks correctly. */
#define configREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x11112222 )
#define configREG_TEST_TASK_3_PARAMETER ( ( void * ) 0x12345678 )
#define configREG_TEST_TASK_4_PARAMETER ( ( void * ) 0x87654321 )
#ifdef __cplusplus
}
#endif
#endif /* FREERTOS_CONFIG_H */

View File

@ -145,24 +145,7 @@
<Name>-UV1115SAE -O2983 -S0 -C0 -P00 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO11 -FN1 -FC1000 -FD20000000 -FF0NEW_DEVICE -FL080000 -FS00 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>1169</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>38532</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_MPU_Simulator_Keil_GCC\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\RTOSDemo\../main.c\1169</Expression>
</Bp>
</Breakpoint>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
@ -172,7 +155,7 @@
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>ulExpireCount</ItemText>
<ItemText>ulCycleCount</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
@ -229,7 +212,7 @@
<Group>
<GroupName>System</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -248,8 +231,8 @@
</Group>
<Group>
<GroupName>main_and_config</GroupName>
<tvExp>0</tvExp>
<GroupName>application_and_config</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -277,17 +260,29 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RegTest.c</PathWithFileName>
<FilenameWithoutPath>RegTest.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>FreeRTOS_Source</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>4</FileNumber>
<FileNumber>5</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -299,7 +294,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>5</FileNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -311,7 +306,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>6</FileNumber>
<FileNumber>7</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -323,7 +318,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>7</FileNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -335,7 +330,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>8</FileNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -347,7 +342,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>9</FileNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -357,18 +352,6 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\portable\GCC\ARM_CM3_MPU\port.c</PathWithFileName>
<FilenameWithoutPath>port.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>11</FileNumber>
@ -381,6 +364,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\portable\GCC\ARM_CM4_MPU\port.c</PathWithFileName>
<FilenameWithoutPath>port.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

View File

@ -241,7 +241,7 @@
<MiscControls>-mfloat-abi=softfp -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -O0 -g</MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..;..\..\..\Source\include;..\..\..\Source\portable\GCC\ARM_CM3_MPU;..\..\Common\include;..\peripheral_library;..\CMSIS;..\main_full;..\peripheral_library\interrupt</IncludePath>
<IncludePath>..;..\..\..\Source\include;..\..\..\Source\portable\GCC\ARM_CM4_MPU;..\..\Common\include;..\peripheral_library;..\CMSIS;..\main_full;..\peripheral_library\interrupt</IncludePath>
</VariousControls>
</Carm>
<Aarm>
@ -282,7 +282,7 @@
</Files>
</Group>
<Group>
<GroupName>main_and_config</GroupName>
<GroupName>application_and_config</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
@ -294,6 +294,11 @@
<FileType>5</FileType>
<FilePath>..\FreeRTOSConfig.h</FilePath>
</File>
<File>
<FileName>RegTest.c</FileName>
<FileType>1</FileType>
<FilePath>.\RegTest.c</FilePath>
</File>
</Files>
</Group>
<Group>
@ -329,16 +334,16 @@
<FileType>1</FileType>
<FilePath>..\..\..\Source\portable\MemMang\heap_4.c</FilePath>
</File>
<File>
<FileName>port.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\portable\GCC\ARM_CM3_MPU\port.c</FilePath>
</File>
<File>
<FileName>mpu_wrappers.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\portable\Common\mpu_wrappers.c</FilePath>
</File>
<File>
<FileName>port.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\portable\GCC\ARM_CM4_MPU\port.c</FilePath>
</File>
</Files>
</Group>
</Groups>

View File

@ -1,5 +1,5 @@
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
@ -67,6 +67,10 @@
1 tab == 4 spaces!
*/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "queue.h"
/*
* "Reg test" tasks - These fill the registers with known values, then check
* that each register maintains its expected value for the lifetime of the
@ -76,14 +80,178 @@
* switching mechanism.
*/
void vRegTest1Implementation( void ) __attribute__ ((naked));
void vRegTest2Implementation( void ) __attribute__ ((naked));
void vRegTest1Implementation( void *pvParameters );
void vRegTest2Implementation( void *pvParameters );
void vRegTest3Implementation( void ) __attribute__ ((naked));
void vRegTest4Implementation( void ) __attribute__ ((naked));
void vRegTest1Implementation( void )
/*
* Used as an easy way of deleting a task from inline assembly.
*/
extern void vMainDeleteMe( void ) __attribute__((noinline));
/*
* Used by the first two reg test tasks and a software timer callback function
* to send messages to the check task. The message just lets the check task
* know that the tasks and timer are still functioning correctly. If a reg test
* task detects an error it will delete itself, and in so doing prevent itself
* from sending any more 'I'm Alive' messages to the check task.
*/
extern void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );
/* The queue used to send a message to the check task. */
extern QueueHandle_t xGlobalScopeCheckQueue;
/*-----------------------------------------------------------*/
void vRegTest1Implementation( void *pvParameters )
{
/* This task is created in privileged mode so can access the file scope
queue variable. Take a stack copy of this before the task is set into user
mode. Once this task is in user mode the file scope queue variable will no
longer be accessible but the stack copy will. */
QueueHandle_t xQueue = xGlobalScopeCheckQueue;
/* 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();
/* First check that the parameter value is as expected. */
if( pvParameters != ( void * ) configREG_TEST_TASK_1_PARAMETER )
{
/* Error detected. Delete the task so it stops communicating with
the check task. */
vMainDeleteMe();
}
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
(
" 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"
" MOV R8, #108 \n"
" MOV R9, #109 \n"
" MOV R10, #110 \n"
" MOV R11, #111 \n"
"reg1loop: \n"
" MOV R0, #100 \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */
" MOV R1, #101 \n"
" MOV R2, #102 \n"
" MOV R3, #103 \n"
" MOV R12, #112 \n"
" SVC #1 \n" /* Yield just to increase test coverage. */
" CMP R0, #100 \n" /* Check all the registers still contain their expected values. */
" BNE vMainDeleteMe \n" /* Value was not as expected, delete the task so it stops communicating with the check task. */
" CMP R1, #101 \n"
" BNE vMainDeleteMe \n"
" CMP R2, #102 \n"
" BNE vMainDeleteMe \n"
" CMP R3, #103 \n"
" BNE vMainDeleteMe \n"
" CMP R4, #104 \n"
" BNE vMainDeleteMe \n"
" CMP R5, #105 \n"
" BNE vMainDeleteMe \n"
" CMP R6, #106 \n"
" BNE vMainDeleteMe \n"
" CMP R8, #108 \n"
" BNE vMainDeleteMe \n"
" CMP R9, #109 \n"
" BNE vMainDeleteMe \n"
" CMP R10, #110 \n"
" BNE vMainDeleteMe \n"
" CMP R11, #111 \n"
" BNE vMainDeleteMe \n"
" CMP R12, #112 \n"
" BNE vMainDeleteMe \n"
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
);
/* Send configREG_TEST_1_STILL_EXECUTING to the check task to indicate that this
task is still functioning. */
vMainSendImAlive( xQueue, configREG_TEST_1_STILL_EXECUTING );
/* Go back to check all the register values again. */
__asm volatile( " B reg1loop " );
}
}
/*-----------------------------------------------------------*/
void vRegTest2Implementation( 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
method. */
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
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
(
" 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"
"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"
" MOV R2, #2 \n"
" MOV R3, #3 \n"
" MOV R12, #12 \n"
" CMP R0, #13 \n" /* Check all the registers still contain their expected values. */
" BNE vMainDeleteMe \n" /* Value was not as expected, delete the task so it stops communicating with the check task */
" CMP R1, #1 \n"
" BNE vMainDeleteMe \n"
" CMP R2, #2 \n"
" BNE vMainDeleteMe \n"
" CMP R3, #3 \n"
" BNE vMainDeleteMe \n"
" CMP R4, #4 \n"
" BNE vMainDeleteMe \n"
" CMP R5, #5 \n"
" BNE vMainDeleteMe \n"
" CMP R6, #6 \n"
" BNE vMainDeleteMe \n"
" CMP R8, #8 \n"
" BNE vMainDeleteMe \n"
" CMP R9, #9 \n"
" BNE vMainDeleteMe \n"
" CMP R10, #10 \n"
" BNE vMainDeleteMe \n"
" CMP R11, #11 \n"
" BNE vMainDeleteMe \n"
" CMP R12, #12 \n"
" BNE vMainDeleteMe \n"
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
);
/* Send configREG_TEST_2_STILL_EXECUTING to the check task to indicate that this
task is still functioning. */
vMainSendImAlive( xQueue, configREG_TEST_2_STILL_EXECUTING );
/* Go back to check all the register values again. */
__asm volatile( " B reg2loop " );
}
}
/*-----------------------------------------------------------*/
void vRegTest3Implementation( void )
{
__asm volatile
(
".extern ulRegTest1LoopCounter \n"
".extern pulRegTest3LoopCounter \n"
"/* Fill the core registers with known values. */ \n"
"mov r0, #100 \n"
"mov r1, #101 \n"
@ -244,7 +412,8 @@ void vRegTest1Implementation( void )
"/* Everything passed, increment the loop counter. */ \n"
"push { r0-r1 } \n"
"ldr r0, =ulRegTest1LoopCounter \n"
"ldr r0, =pulRegTest3LoopCounter \n"
"ldr r0, [r0] \n"
"ldr r1, [r0] \n"
"adds r1, r1, #1 \n"
"str r1, [r0] \n"
@ -262,11 +431,11 @@ void vRegTest1Implementation( void )
}
/*-----------------------------------------------------------*/
void vRegTest2Implementation( void )
void vRegTest4Implementation( void )
{
__asm volatile
(
".extern ulRegTest2LoopCounter \n"
".extern pulRegTest4LoopCounter \n"
"/* Set all the core registers to known values. */ \n"
"mov r0, #-1 \n"
"mov r1, #1 \n"
@ -427,22 +596,18 @@ void vRegTest2Implementation( void )
"cmp r12, #12 \n"
"bne reg2_error_loop \n"
"/* Increment the loop counter to indicate this test is still functioning \n"
"correctly. */ \n"
"/* Increment the loop counter so the check task knows this task is \n"
"still running. */ \n"
"push { r0-r1 } \n"
"ldr r0, =ulRegTest2LoopCounter \n"
"ldr r0, =pulRegTest4LoopCounter \n"
"ldr r0, [r0] \n"
"ldr r1, [r0] \n"
"adds r1, r1, #1 \n"
"str r1, [r0] \n"
"pop { r0-r1 } \n"
"/* Yield to increase test coverage. */ \n"
"movs r0, #0x01 \n"
"ldr r1, =0xe000ed04 /*NVIC_INT_CTRL */ \n"
"lsl r0, r0, #28 /* Shift to PendSV bit */ \n"
"str r0, [r1] \n"
"dsb \n"
"pop { r0-r1 } \n"
"SVC #1 \n"
"/* Start again. */ \n"
"b reg2_loop \n"
@ -455,3 +620,73 @@ void vRegTest2Implementation( void )
}
/*-----------------------------------------------------------*/
/* Fault handlers are here for convenience as they use compiler specific syntax
and this file is specific to the GCC compiler. */
void hard_fault_handler( uint32_t * hardfault_args )
{
volatile uint32_t stacked_r0;
volatile uint32_t stacked_r1;
volatile uint32_t stacked_r2;
volatile uint32_t stacked_r3;
volatile uint32_t stacked_r12;
volatile uint32_t stacked_lr;
volatile uint32_t stacked_pc;
volatile uint32_t stacked_psr;
stacked_r0 = ((uint32_t) hardfault_args[ 0 ]);
stacked_r1 = ((uint32_t) hardfault_args[ 1 ]);
stacked_r2 = ((uint32_t) hardfault_args[ 2 ]);
stacked_r3 = ((uint32_t) hardfault_args[ 3 ]);
stacked_r12 = ((uint32_t) hardfault_args[ 4 ]);
stacked_lr = ((uint32_t) hardfault_args[ 5 ]);
stacked_pc = ((uint32_t) hardfault_args[ 6 ]);
stacked_psr = ((uint32_t) hardfault_args[ 7 ]);
/* 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;
}
/*-----------------------------------------------------------*/
void HardFault_Handler( void ) __attribute__((naked));
void HardFault_Handler( void )
{
__asm volatile
(
" tst lr, #4 \n"
" ite eq \n"
" mrseq r0, msp \n"
" mrsne r0, psp \n"
" ldr r1, [r0, #24] \n"
" ldr r2, handler_address_const \n"
" bx r2 \n"
" handler_address_const: .word hard_fault_handler \n"
);
}
/*-----------------------------------------------------------*/
void MemManage_Handler( void ) __attribute__((naked));
void MemManage_Handler( void )
{
__asm volatile
(
" tst lr, #4 \n"
" ite eq \n"
" mrseq r0, msp \n"
" mrsne r0, psp \n"
" ldr r1, [r0, #24] \n"
" ldr r2, handler2_address_const \n"
" bx r2 \n"
" handler2_address_const: .word hard_fault_handler \n"
);
}/*-----------------------------------------------------------*/

View File

@ -6,8 +6,8 @@ MEMORY
}
/* Variables used by FreeRTOS-MPU. */
_Privileged_Functions_Region_Size = 16K;
_Privileged_Data_Region_Size = 256;
_Privileged_Functions_Region_Size = 32K;
_Privileged_Data_Region_Size = 512;
__FLASH_segment_start__ = ORIGIN( ROM );
__FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( ROM );
@ -25,11 +25,7 @@ __privileged_data_end__ = ORIGIN( RAM ) + _Privileged_Data_Region_Size;
/*
* The '__stack' definition is required by crt0, do not remove it.
*/
/* Place top of stack immediate before ROM Log
*__stack = ORIGIN(RAM) + LENGTH(RAM);
*/
__stack = ORIGIN(RAM) + LENGTH(RAM);
_estack = __stack;
/*
@ -51,7 +47,7 @@ PROVIDE ( _Main_Stack_Limit = __Main_Stack_Limit ) ;
* There will be a link error if there is not this amount of
* RAM free at the end.
*/
_Minimum_Stack_Size = 256 ;
_Minimum_Stack_Size = 1024 ;
/*
* Default heap definitions.
@ -82,15 +78,16 @@ SECTIONS
KEEP(*(.isr_vector))
*(privileged_functions)
. = ALIGN(4);
/* Non privileged code is after _Privileged_Functions_Region_Size. */
__privileged_functions_actual_end__ = .;
. = _Privileged_Functions_Region_Size;
} > ROM
.text :
{
/* Non privileged code kept out of the first 16K or flash. */
. = __privileged_functions_start__ + _Privileged_Functions_Region_Size;
. = ALIGN(4);
@ -222,11 +219,12 @@ SECTIONS
privileged_data :
{
*(privileged_data)
/* Non kernel data is kept out of the first 256 bytes of SRAM. */
/* Non kernel data is kept out of the first _Privileged_Data_Region_Size
bytes of SRAM. */
__privileged_data_actual_end__ = .;
. = _Privileged_Data_Region_Size;
} > RAM
. = ORIGIN( RAM ) + _Privileged_Data_Region_Size;
/*
* The initialised data section.
* The program executes knowing that the data is in the RAM
@ -308,81 +306,6 @@ SECTIONS
. = ALIGN(4);
} >RAM
._check_rom_log :
{
. = ALIGN(4);
/* . = . + __ROM_Log_Size ; */
. = ALIGN(4);
} >RAM
/*
.bss_CCMRAM : ALIGN(4)
{
*(.bss.CCMRAM .bss.CCMRAM.*)
} > CCMRAM
*/
/*
* The ROM Bank1.
* The C or assembly source must explicitly place the code
* or data there using the "section" attribute.
*/
/* remaining code */
/* read-only data (constants) */
/*
.b1text :
{
*(.b1text)
*(.b1rodata)
*(.b1rodata.*)
} >ROMB1
*/
/*
* The EXTMEM.
* The C or assembly source must explicitly place the code or data there
* using the "section" attribute.
*/
/* EXTMEM Bank0 */
/*
.eb0text :
{
*(.eb0text)
*(.eb0rodata)
*(.eb0rodata.*)
} >EXTMEMB0
*/
/* EXTMEM Bank1 */
/*
.eb1text :
{
*(.eb1text)
*(.eb1rodata)
*(.eb1rodata.*)
} >EXTMEMB1
*/
/* EXTMEM Bank2 */
/*
.eb2text :
{
*(.eb2text)
*(.eb2rodata)
*(.eb2rodata.*)
} >EXTMEMB2
*/
/* EXTMEM Bank0 */
/*
.eb3text :
{
*(.eb3text)
*(.eb3rodata)
*(.eb3rodata.*)
} >EXTMEMB3
*/
/* After that there are only debugging sections. */
/* This can remove the debugging information from the standard libraries */

View File

@ -0,0 +1,23 @@
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x00000000 { ; load region size_region
ER_IROM1 0x00000000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
*( privileged_functions )
}
ER_IROM2 0x8000 FIXED {
.ANY (+RO)
}
RW_IRAM1 0x20000000 { ; RW data
*( privileged_data )
}
RW_IRAM2 0x20000200 { ; RW data
.ANY (+RW +ZI)
}
}

View File

@ -0,0 +1,380 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>RTOSDemo</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
<CLKADS>48000000</CLKADS>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>0</RunSim>
<RunTarget>1</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>1</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>79</PageWidth>
<PageLength>66</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\Listings\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
<uSim>1</uSim>
<uTrg>0</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<nTsel>0</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon>BIN\UL2CM3.DLL</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGDARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name>(105=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key>
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=1231,224,1641,767,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=1199,245,1664,545,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name>-T0</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>-UV1115SAE -O3047 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC48000000 -TP21 -TDS8028 -TDT0 -TDC1F -TIE1 -TIP8 -FO11 -FD118000 -FC8000 -FN1 -FF0NEW_DEVICE.FLM -FS0E0000 -FL038000 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>xTickCount</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>ulCycleCount</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>*(unsigned long *)0x200005E4</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>2</SubType>
<ItemText>0xe000e284</ItemText>
<AccSizeX>4</AccSizeX>
</Mm>
</MemoryWindow1>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<Lin2Executable></Lin2Executable>
<Lin2ConfigFile></Lin2ConfigFile>
<bLin2Auto>0</bLin2Auto>
</TargetOption>
</Target>
<Group>
<GroupName>System</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\startup_MPS_CM4.S</PathWithFileName>
<FilenameWithoutPath>startup_MPS_CM4.S</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>main_and_config</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\FreeRTOSConfig.h</PathWithFileName>
<FilenameWithoutPath>FreeRTOSConfig.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RegTest.c</PathWithFileName>
<FilenameWithoutPath>RegTest.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>FreeRTOS_Source</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\event_groups.c</PathWithFileName>
<FilenameWithoutPath>event_groups.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\list.c</PathWithFileName>
<FilenameWithoutPath>list.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>7</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\queue.c</PathWithFileName>
<FilenameWithoutPath>queue.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\tasks.c</PathWithFileName>
<FilenameWithoutPath>tasks.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\timers.c</PathWithFileName>
<FilenameWithoutPath>timers.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\portable\MemMang\heap_4.c</PathWithFileName>
<FilenameWithoutPath>heap_4.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\portable\RVDS\ARM_CM4_MPU\port.c</PathWithFileName>
<FilenameWithoutPath>port.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\Source\portable\Common\mpu_wrappers.c</PathWithFileName>
<FilenameWithoutPath>mpu_wrappers.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

View File

@ -0,0 +1,454 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>RTOSDemo</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060061::V5.06 update 1 (build 61)::ARMCC</pCCUsed>
<TargetOption>
<TargetCommonOption>
<Device>ARMCM4_FP</Device>
<Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.4.5.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IROM(0x00000000,0x80000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0NEW_DEVICE -FS00 -FL080000 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM))</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:ARMCM4_FP$Device\ARM\ARMCM4\Include\ARMCM4_FP.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:ARMCM4_FP$Device\ARM\SVD\ARMCM4.svd</SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>RTOSDemo</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> -MPU</SimDllArguments>
<SimDlgDll>DCM.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments> -MPU</TargetDllArguments>
<TargetDlgDll>TCM.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4096</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>1</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M4"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<useUlib>1</useUlib>
<EndSel>1</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>3</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>1</Ir1Chk>
<Ir2Chk>0</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</Im1Chk>
<Im2Chk>0</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocm4>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm4>
<Ocm5>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm5>
<Ocm6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm6>
<IRAM>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x20000</Size>
</IRAM>
<IROM>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x80000</Size>
</IROM>
<XRAM>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRAM>
<OCR_RVCT1>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT1>
<OCR_RVCT2>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT2>
<OCR_RVCT3>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x80000</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT5>
<OCR_RVCT6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x8000</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>1</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
<Strict>0</Strict>
<EnumInt>0</EnumInt>
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>2</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>0</uC99>
<useXO>0</useXO>
<v6Lang>0</v6Lang>
<v6LangP>0</v6LangP>
<vShortEn>0</vShortEn>
<vShortWch>0</vShortWch>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..;..\..\..\Source\include;..\..\..\Source\portable\RVDS\ARM_CM4_MPU;..\..\Common\include;..\CMSIS;..\main_full</IncludePath>
</VariousControls>
</Cads>
<Aads>
<interw>1</interw>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<thumb>0</thumb>
<SplitLS>0</SplitLS>
<SwStkChk>0</SwStkChk>
<NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc>
<useXO>0</useXO>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Aads>
<LDads>
<umfTarg>0</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
<RepFail>1</RepFail>
<useFile>0</useFile>
<TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile>RTOSDemo.sct</ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
<GroupName>System</GroupName>
<Files>
<File>
<FileName>startup_MPS_CM4.S</FileName>
<FileType>2</FileType>
<FilePath>.\startup_MPS_CM4.S</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>main_and_config</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\main.c</FilePath>
</File>
<File>
<FileName>FreeRTOSConfig.h</FileName>
<FileType>5</FileType>
<FilePath>..\FreeRTOSConfig.h</FilePath>
</File>
<File>
<FileName>RegTest.c</FileName>
<FileType>1</FileType>
<FilePath>.\RegTest.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>FreeRTOS_Source</GroupName>
<Files>
<File>
<FileName>event_groups.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\event_groups.c</FilePath>
</File>
<File>
<FileName>list.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\list.c</FilePath>
</File>
<File>
<FileName>queue.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\queue.c</FilePath>
</File>
<File>
<FileName>tasks.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\tasks.c</FilePath>
</File>
<File>
<FileName>timers.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\timers.c</FilePath>
</File>
<File>
<FileName>heap_4.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\portable\MemMang\heap_4.c</FilePath>
</File>
<File>
<FileName>port.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\portable\RVDS\ARM_CM4_MPU\port.c</FilePath>
</File>
<File>
<FileName>mpu_wrappers.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\Source\portable\Common\mpu_wrappers.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>

View File

@ -0,0 +1,703 @@
/*
FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
/*
* "Reg test" tasks - These fill the registers with known values, then check
* that each register maintains its expected value for the lifetime of the
* task. Each task uses a different set of values. The reg test tasks execute
* with a very low priority, so get preempted very frequently. A register
* containing an unexpected value is indicative of an error in the context
* switching mechanism.
*/
void vRegTest1Implementation( void *pvParameters );
void vRegTest2Implementation( void *pvParameters );
void vRegTest3Implementation( void );
void vRegTest4Implementation( void );
/*
* Used as an easy way of deleting a task from inline assembly.
*/
extern void vMainDeleteMe( void ) __attribute__((noinline));
/*
* Used by the first two reg test tasks and a software timer callback function
* to send messages to the check task. The message just lets the check task
* know that the tasks and timer are still functioning correctly. If a reg test
* task detects an error it will delete itself, and in so doing prevent itself
* from sending any more 'I'm Alive' messages to the check task.
*/
extern void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );
/* The queue used to send a message to the check task. */
extern QueueHandle_t xGlobalScopeCheckQueue;
/*-----------------------------------------------------------*/
void vRegTest1Implementation( void *pvParameters )
{
/* This task is created in privileged mode so can access the file scope
queue variable. Take a stack copy of this before the task is set into user
mode. Once this task is in user mode the file scope queue variable will no
longer be accessible but the stack copy will. */
QueueHandle_t xQueue = xGlobalScopeCheckQueue;
const TickType_t xDelayTime = pdMS_TO_TICKS( 100UL );
/* 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();
/* First check that the parameter value is as expected. */
if( pvParameters != ( void * ) configREG_TEST_TASK_1_PARAMETER )
{
/* Error detected. Delete the task so it stops communicating with
the check task. */
vMainDeleteMe();
}
for( ;; )
{
#if defined ( __GNUC__ )
{
/* 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
(
" 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"
" MOV R8, #108 \n"
" MOV R9, #109 \n"
" MOV R10, #110 \n"
" MOV R11, #111 \n"
"reg1loop: \n"
" MOV R0, #100 \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */
" MOV R1, #101 \n"
" MOV R2, #102 \n"
" MOV R3, #103 \n"
" MOV R12, #112 \n"
" SVC #1 \n" /* Yield just to increase test coverage. */
" CMP R0, #100 \n" /* Check all the registers still contain their expected values. */
" BNE vMainDeleteMe \n" /* Value was not as expected, delete the task so it stops communicating with the check task. */
" CMP R1, #101 \n"
" BNE vMainDeleteMe \n"
" CMP R2, #102 \n"
" BNE vMainDeleteMe \n"
" CMP R3, #103 \n"
" BNE vMainDeleteMe \n"
" CMP R4, #104 \n"
" BNE vMainDeleteMe \n"
" CMP R5, #105 \n"
" BNE vMainDeleteMe \n"
" CMP R6, #106 \n"
" BNE vMainDeleteMe \n"
" CMP R8, #108 \n"
" BNE vMainDeleteMe \n"
" CMP R9, #109 \n"
" BNE vMainDeleteMe \n"
" CMP R10, #110 \n"
" BNE vMainDeleteMe \n"
" CMP R11, #111 \n"
" BNE vMainDeleteMe \n"
" CMP R12, #112 \n"
" BNE vMainDeleteMe \n"
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
);
}
#endif /* __GNUC__ */
/* Send configREG_TEST_1_STILL_EXECUTING to the check task to indicate that this
task is still functioning. */
vMainSendImAlive( xQueue, configREG_TEST_1_STILL_EXECUTING );
vTaskDelay( xDelayTime );
#if defined ( __GNUC__ )
{
/* Go back to check all the register values again. */
__asm volatile( " B reg1loop " );
}
#endif /* __GNUC__ */
}
}
/*-----------------------------------------------------------*/
void vRegTest2Implementation( 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
method. */
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
const TickType_t xDelayTime = pdMS_TO_TICKS( 100UL );
for( ;; )
{
#if defined ( __GNUC__ )
{
/* 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
(
" 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"
"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"
" MOV R2, #2 \n"
" MOV R3, #3 \n"
" MOV R12, #12 \n"
" CMP R0, #13 \n" /* Check all the registers still contain their expected values. */
" BNE vMainDeleteMe \n" /* Value was not as expected, delete the task so it stops communicating with the check task */
" CMP R1, #1 \n"
" BNE vMainDeleteMe \n"
" CMP R2, #2 \n"
" BNE vMainDeleteMe \n"
" CMP R3, #3 \n"
" BNE vMainDeleteMe \n"
" CMP R4, #4 \n"
" BNE vMainDeleteMe \n"
" CMP R5, #5 \n"
" BNE vMainDeleteMe \n"
" CMP R6, #6 \n"
" BNE vMainDeleteMe \n"
" CMP R8, #8 \n"
" BNE vMainDeleteMe \n"
" CMP R9, #9 \n"
" BNE vMainDeleteMe \n"
" CMP R10, #10 \n"
" BNE vMainDeleteMe \n"
" CMP R11, #11 \n"
" BNE vMainDeleteMe \n"
" CMP R12, #12 \n"
" BNE vMainDeleteMe \n"
:::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"
);
}
#endif /* __GNUC__ */
/* Send configREG_TEST_2_STILL_EXECUTING to the check task to indicate
that this task is still functioning. */
vMainSendImAlive( xQueue, configREG_TEST_2_STILL_EXECUTING );
vTaskDelay( xDelayTime );
#if defined ( __GNUC__ )
{
/* Go back to check all the register values again. */
__asm volatile( " B reg2loop " );
}
#endif /* __GNUC__ */
}
}
/*-----------------------------------------------------------*/
__asm void vRegTest3Implementation( void )
{
extern pulRegTest3LoopCounter
PRESERVE8
/* Fill the core registers with known values. */
mov r0, #100
mov r1, #101
mov r2, #102
mov r3, #103
mov r4, #104
mov r5, #105
mov r6, #106
mov r7, #107
mov r8, #108
mov r9, #109
mov r10, #110
mov r11, #111
mov r12, #112
/* Fill the VFP registers with known values. */
vmov d0, r0, r1
vmov d1, r2, r3
vmov d2, r4, r5
vmov d3, r6, r7
vmov d4, r8, r9
vmov d5, r10, r11
vmov d6, r0, r1
vmov d7, r2, r3
vmov d8, r4, r5
vmov d9, r6, r7
vmov d10, r8, r9
vmov d11, r10, r11
vmov d12, r0, r1
vmov d13, r2, r3
vmov d14, r4, r5
vmov d15, r6, r7
reg1_loop
/* Check all the VFP registers still contain the values set above.
First save registers that are clobbered by the test. */
push { r0-r1 }
vmov r0, r1, d0
cmp r0, #100
bne reg1_error_loopf
cmp r1, #101
bne reg1_error_loopf
vmov r0, r1, d1
cmp r0, #102
bne reg1_error_loopf
cmp r1, #103
bne reg1_error_loopf
vmov r0, r1, d2
cmp r0, #104
bne reg1_error_loopf
cmp r1, #105
bne reg1_error_loopf
vmov r0, r1, d3
cmp r0, #106
bne reg1_error_loopf
cmp r1, #107
bne reg1_error_loopf
vmov r0, r1, d4
cmp r0, #108
bne reg1_error_loopf
cmp r1, #109
bne reg1_error_loopf
vmov r0, r1, d5
cmp r0, #110
bne reg1_error_loopf
cmp r1, #111
bne reg1_error_loopf
vmov r0, r1, d6
cmp r0, #100
bne reg1_error_loopf
cmp r1, #101
bne reg1_error_loopf
vmov r0, r1, d7
cmp r0, #102
bne reg1_error_loopf
cmp r1, #103
bne reg1_error_loopf
vmov r0, r1, d8
cmp r0, #104
bne reg1_error_loopf
cmp r1, #105
bne reg1_error_loopf
vmov r0, r1, d9
cmp r0, #106
bne reg1_error_loopf
cmp r1, #107
bne reg1_error_loopf
vmov r0, r1, d10
cmp r0, #108
bne reg1_error_loopf
cmp r1, #109
bne reg1_error_loopf
vmov r0, r1, d11
cmp r0, #110
bne reg1_error_loopf
cmp r1, #111
bne reg1_error_loopf
vmov r0, r1, d12
cmp r0, #100
bne reg1_error_loopf
cmp r1, #101
bne reg1_error_loopf
vmov r0, r1, d13
cmp r0, #102
bne reg1_error_loopf
cmp r1, #103
bne reg1_error_loopf
vmov r0, r1, d14
cmp r0, #104
bne reg1_error_loopf
cmp r1, #105
bne reg1_error_loopf
vmov r0, r1, d15
cmp r0, #106
bne reg1_error_loopf
cmp r1, #107
bne reg1_error_loopf
/* Restore the registers that were clobbered by the test. */
pop {r0-r1}
/* VFP register test passed. Jump to the core register test. */
b reg1_loopf_pass
reg1_error_loopf
/* If this line is hit then a VFP register value was found to be incorrect. */
b reg1_error_loopf
reg1_loopf_pass
cmp r0, #100
bne reg1_error_loop
cmp r1, #101
bne reg1_error_loop
cmp r2, #102
bne reg1_error_loop
cmp r3, #103
bne reg1_error_loop
cmp r4, #104
bne reg1_error_loop
cmp r5, #105
bne reg1_error_loop
cmp r6, #106
bne reg1_error_loop
cmp r7, #107
bne reg1_error_loop
cmp r8, #108
bne reg1_error_loop
cmp r9, #109
bne reg1_error_loop
cmp r10, #110
bne reg1_error_loop
cmp r11, #111
bne reg1_error_loop
cmp r12, #112
bne reg1_error_loop
/* Everything passed, increment the loop counter. */
push { r0-r1 }
ldr r0, =pulRegTest3LoopCounter
ldr r0, [r0]
ldr r1, [r0]
adds r1, r1, #1
str r1, [r0]
pop { r0-r1 }
/* Start again. */
b reg1_loop
reg1_error_loop
/* If this line is hit then there was an error in a core register value.
The loop ensures the loop counter stops incrementing. */
b reg1_error_loop
nop
nop
}
/*-----------------------------------------------------------*/
__asm void vRegTest4Implementation( void )
{
extern pulRegTest4LoopCounter;
PRESERVE8
/* Set all the core registers to known values. */
mov r0, #-1
mov r1, #1
mov r2, #2
mov r3, #3
mov r4, #4
mov r5, #5
mov r6, #6
mov r7, #7
mov r8, #8
mov r9, #9
mov r10, #10
mov r11, #11
mov r12, #12
/* Set all the VFP to known values. */
vmov d0, r0, r1
vmov d1, r2, r3
vmov d2, r4, r5
vmov d3, r6, r7
vmov d4, r8, r9
vmov d5, r10, r11
vmov d6, r0, r1
vmov d7, r2, r3
vmov d8, r4, r5
vmov d9, r6, r7
vmov d10, r8, r9
vmov d11, r10, r11
vmov d12, r0, r1
vmov d13, r2, r3
vmov d14, r4, r5
vmov d15, r6, r7
reg2_loop
/* Check all the VFP registers still contain the values set above.
First save registers that are clobbered by the test. */
push { r0-r1 }
vmov r0, r1, d0
cmp r0, #-1
bne reg2_error_loopf
cmp r1, #1
bne reg2_error_loopf
vmov r0, r1, d1
cmp r0, #2
bne reg2_error_loopf
cmp r1, #3
bne reg2_error_loopf
vmov r0, r1, d2
cmp r0, #4
bne reg2_error_loopf
cmp r1, #5
bne reg2_error_loopf
vmov r0, r1, d3
cmp r0, #6
bne reg2_error_loopf
cmp r1, #7
bne reg2_error_loopf
vmov r0, r1, d4
cmp r0, #8
bne reg2_error_loopf
cmp r1, #9
bne reg2_error_loopf
vmov r0, r1, d5
cmp r0, #10
bne reg2_error_loopf
cmp r1, #11
bne reg2_error_loopf
vmov r0, r1, d6
cmp r0, #-1
bne reg2_error_loopf
cmp r1, #1
bne reg2_error_loopf
vmov r0, r1, d7
cmp r0, #2
bne reg2_error_loopf
cmp r1, #3
bne reg2_error_loopf
vmov r0, r1, d8
cmp r0, #4
bne reg2_error_loopf
cmp r1, #5
bne reg2_error_loopf
vmov r0, r1, d9
cmp r0, #6
bne reg2_error_loopf
cmp r1, #7
bne reg2_error_loopf
vmov r0, r1, d10
cmp r0, #8
bne reg2_error_loopf
cmp r1, #9
bne reg2_error_loopf
vmov r0, r1, d11
cmp r0, #10
bne reg2_error_loopf
cmp r1, #11
bne reg2_error_loopf
vmov r0, r1, d12
cmp r0, #-1
bne reg2_error_loopf
cmp r1, #1
bne reg2_error_loopf
vmov r0, r1, d13
cmp r0, #2
bne reg2_error_loopf
cmp r1, #3
bne reg2_error_loopf
vmov r0, r1, d14
cmp r0, #4
bne reg2_error_loopf
cmp r1, #5
bne reg2_error_loopf
vmov r0, r1, d15
cmp r0, #6
bne reg2_error_loopf
cmp r1, #7
bne reg2_error_loopf
/* Restore the registers that were clobbered by the test. */
pop {r0-r1}
/* VFP register test passed. Jump to the core register test. */
b reg2_loopf_pass
reg2_error_loopf
/* If this line is hit then a VFP register value was found to be
incorrect. */
b reg2_error_loopf
reg2_loopf_pass
cmp r0, #-1
bne reg2_error_loop
cmp r1, #1
bne reg2_error_loop
cmp r2, #2
bne reg2_error_loop
cmp r3, #3
bne reg2_error_loop
cmp r4, #4
bne reg2_error_loop
cmp r5, #5
bne reg2_error_loop
cmp r6, #6
bne reg2_error_loop
cmp r7, #7
bne reg2_error_loop
cmp r8, #8
bne reg2_error_loop
cmp r9, #9
bne reg2_error_loop
cmp r10, #10
bne reg2_error_loop
cmp r11, #11
bne reg2_error_loop
cmp r12, #12
bne reg2_error_loop
/* Increment the loop counter so the check task knows this task is
still running. */
push { r0-r1 }
ldr r0, =pulRegTest4LoopCounter
ldr r0, [r0]
ldr r1, [r0]
adds r1, r1, #1
str r1, [r0]
pop { r0-r1 }
/* Yield to increase test coverage. */
SVC #1
/* Start again. */
b reg2_loop
reg2_error_loop
/* If this line is hit then there was an error in a core register value.
This loop ensures the loop counter variable stops incrementing. */
b reg2_error_loop
nop
}
/*-----------------------------------------------------------*/
/* Fault handlers are here for convenience as they use compiler specific syntax
and this file is specific to the Keil compiler. */
void hard_fault_handler( uint32_t * hardfault_args )
{
volatile uint32_t stacked_r0;
volatile uint32_t stacked_r1;
volatile uint32_t stacked_r2;
volatile uint32_t stacked_r3;
volatile uint32_t stacked_r12;
volatile uint32_t stacked_lr;
volatile uint32_t stacked_pc;
volatile uint32_t stacked_psr;
stacked_r0 = ((uint32_t) hardfault_args[ 0 ]);
stacked_r1 = ((uint32_t) hardfault_args[ 1 ]);
stacked_r2 = ((uint32_t) hardfault_args[ 2 ]);
stacked_r3 = ((uint32_t) hardfault_args[ 3 ]);
stacked_r12 = ((uint32_t) hardfault_args[ 4 ]);
stacked_lr = ((uint32_t) hardfault_args[ 5 ]);
stacked_pc = ((uint32_t) hardfault_args[ 6 ]);
stacked_psr = ((uint32_t) hardfault_args[ 7 ]);
/* Inspect stacked_pc to locate the offending instruction. */
for( ;; );
}
/*-----------------------------------------------------------*/
void HardFault_Handler( void );
__asm void HardFault_Handler( void )
{
extern hard_fault_handler
tst lr, #4
ite eq
mrseq r0, msp
mrsne r0, psp
ldr r1, [r0, #24]
ldr r2, hard_fault_handler
bx r2
}
/*-----------------------------------------------------------*/
void MemManage_Handler( void );
__asm void MemManage_Handler( void )
{
extern hard_fault_handler
tst lr, #4
ite eq
mrseq r0, msp
mrsne r0, psp
ldr r1, [r0, #24]
ldr r2, hard_fault_handler
bx r2
}
/*-----------------------------------------------------------*/

View File

@ -0,0 +1,172 @@
;/*****************************************************************************
; * @file: startup_MPS_CM4.s
; * @purpose: CMSIS Cortex-M4 Core Device Startup File
; * for the ARM 'Microcontroller Prototyping System'
; * @version: V1.00
; * @date: 1. Jun. 2010
; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
; *
; * Copyright (C) 2008-2010 ARM Limited. All rights reserved.
; * ARM Limited (ARM) is supplying this software for use with Cortex-M4
; * processor based microcontrollers. This file can be freely distributed
; * within development tools that are supporting such ARM based processors.
; *
; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
; *
; ****************************************************************************/
; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x00000800
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
; <h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x00000000
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler
AREA |.text|, CODE, READONLY
; AREA RESET, CODE, READONLY
; Reset Handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT __main
; Remap vector table
LDR R0, =__Vectors
LDR R1, =0xE000ED08
STR R0, [r1]
NOP
IF {CPU} = "Cortex-M4.fp"
LDR R0, =0xE000ED88 ; Enable CP10,CP11
LDR R1,[R0]
ORR R1,R1,#(0xF << 20)
STR R1,[R0]
ENDIF
LDR R0, =__main
BX R0
ENDP
; Dummy Exception Handlers (infinite loops which can be modified)
NMI_Handler PROC
EXPORT NMI_Handler [WEAK]
B .
ENDP
HardFault_Handler\
PROC
EXPORT HardFault_Handler [WEAK]
B .
ENDP
MemManage_Handler\
PROC
EXPORT MemManage_Handler [WEAK]
B .
ENDP
BusFault_Handler\
PROC
EXPORT BusFault_Handler [WEAK]
B .
ENDP
UsageFault_Handler\
PROC
EXPORT UsageFault_Handler [WEAK]
B .
ENDP
SVC_Handler PROC
EXPORT SVC_Handler [WEAK]
B .
ENDP
DebugMon_Handler\
PROC
EXPORT DebugMon_Handler [WEAK]
B .
ENDP
PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK]
B .
ENDP
SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK]
B .
ENDP
ALIGN
; User Initial Stack & Heap
IF :DEF:__MICROLIB
EXPORT __initial_sp
EXPORT __heap_base
EXPORT __heap_limit
ELSE
IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap
__user_initial_stackheap
LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem
BX LR
ALIGN
ENDIF
END

View File

@ -70,15 +70,15 @@
/*
* This file demonstrates the use of FreeRTOS-MPU. It creates tasks in both
* 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
* task function itself.
* User mode and Privileged mode, and using both the xTaskCreate() and
* 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 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, and a software timer is used.
* a protected/restricted task. A software timer is also used.
*/
/* Standard includes. */
@ -97,43 +97,63 @@
/* Misc constants. */
#define mainDONT_BLOCK ( 0 )
/* Definitions for the messages that can be sent to the check task. */
#define mainREG_TEST_1_STILL_EXECUTING ( 0 )
#define mainREG_TEST_2_STILL_EXECUTING ( 1 )
#define mainPRINT_SYSTEM_STATUS ( 2 )
/* GCC specifics. */
#define mainALIGN_TO( x ) __attribute__((aligned(x)))
/* Hardware register addresses. */
#define mainVTOR ( * ( volatile uint32_t * ) 0xE000ED08 )
#define mainNVIC_AUX_ACTLR ( * ( volatile uint32_t * ) 0xE000E008 )
#define mainEC_INTERRUPT_CONTROL ( * ( volatile uint32_t * ) 0x4000FC18 )
#define mainVTOR ( * ( volatile uint32_t * ) 0xE000ED08 )
/* The period of the timer must be less than the rate at which
mainPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the
configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the
check task will think the timer has stopped. */
#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 )
#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 )
/* The name of the task that is deleted by the Idle task is used in a couple of
places, so is #defined. */
#define mainTASK_TO_DELETE_NAME "DeleteMe"
#define mainTASK_TO_DELETE_NAME "DeleteMe"
/*-----------------------------------------------------------*/
/* 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
* NOTE: The filling and checking of the registers in the following two tasks
* is only actually performed when the GCC compiler is used. Use of the
* queue to communicate with the check task is done with all compilers.
*
* Prototype for the first two register test tasks, which execute in User mode.
* Amongst other things, these fill the CPU registers (other than the FPU
* 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
* in the context switch mechanism can be caught. Both reg test tasks execute
* at the idle priority so will get preempted regularly. Each task repeatedly
* sends a message on a queue so long as it remains functioning correctly. If
* an error is detected within the task the task is simply deleted.
* in the context switch mechanism can be caught. Both tasks execute at the
* idle priority so will get preempted regularly. Each task repeatedly sends a
* message on a queue to a 'check' task so the check task knows the register
* check task is still executing and has not detected any errors. If an error
* is detected within the task the task is simply deleted so it no longer sends
* messages.
*
* For demonstration and test purposes, both tasks obtain access to the queue
* handle in different ways; vRegTest1Implementation() is created in Privileged
* mode and copies the queue handle to its local stack before setting itself to
* User mode, and vRegTest2Implementation() receives the task handle using its
* parameter.
*/
static void prvRegTest1Task( void *pvParameters );
static void prvRegTest2Task( void *pvParameters );
extern void vRegTest1Implementation( void *pvParameters );
extern void vRegTest2Implementation( void *pvParameters );
/*
* The second two register test tasks are similar to the first two, but do test
* the floating point registers, execute in Privileged mode, and signal their
* execution status to the 'check' task by incrementing a loop counter on each
* iteration instead of sending a message on a queue. The loop counters use a
* memory region to which the User mode 'check' task has read access.
*
* The functions ending 'Implementation' are called by the register check tasks.
*/
static void prvRegTest3Task( void *pvParameters );
extern void vRegTest3Implementation( void );
static void prvRegTest4Task( void *pvParameters );
extern void vRegTest4Implementation( void );
/*
* Prototype for the check task. The check task demonstrates various features
@ -142,13 +162,13 @@ static void prvRegTest2Task( void *pvParameters );
*
* Two types of messages can be processes:
*
* 1) "I'm Alive" messages sent from the reg test tasks, indicating that the
* task is still operational.
* 1) "I'm Alive" messages sent from the first two register test tasks and a
* software timer callback, as described above.
*
* 2) "Print Status commands" sent periodically by the tick hook function (and
* therefore from within an interrupt) which command the check task to write
* therefore from within an interrupt) which commands the check task to write
* either pass or fail to the terminal, depending on the status of the reg
* test tasks.
* test tasks (no write is performed in the simulator!).
*/
static void prvCheckTask( void *pvParameters );
@ -189,15 +209,16 @@ static void prvSetupHardware( void );
* is simpler to call from asm code than the normal vTaskDelete() API function.
* It has the noinline attribute because it is called from asm code.
*/
static void prvDeleteMe( void ) __attribute__((noinline));
void vMainDeleteMe( void ) __attribute__((noinline));
/*
* Used by both reg test tasks to send messages to the check task. The message
* just lets the check task know that the task is still functioning correctly.
* If a reg test task detects an error it will delete itself, and in so doing
* prevent itself from sending any more 'I'm Alive' messages to the check task.
* Used by the first two reg test tasks and a software timer callback function
* to send messages to the check task. The message just lets the check task
* know that the tasks and timer are still functioning correctly. If a reg test
* task detects an error it will delete itself, and in so doing prevent itself
* from sending any more 'I'm Alive' messages to the check task.
*/
static void prvSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );
void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );
/*
* The check task is created with access to three memory regions (plus its
@ -218,11 +239,11 @@ static void prvTimerCallback( TimerHandle_t xExpiredTimer );
/*-----------------------------------------------------------*/
/* 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
and interrupts. Note that this is a global 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
further information. */
static QueueHandle_t xFileScopeCheckQueue = NULL;
QueueHandle_t xGlobalScopeCheckQueue = NULL;
/* Holds the handle of a task that is deleted in the idle task hook - this is
done for code coverage test purposes only. */
@ -231,6 +252,27 @@ static TaskHandle_t xTaskToDelete = NULL;
/* The timer that periodically sends data to the check task on the queue. */
static TimerHandle_t xTimer = NULL;
#if defined ( __GNUC__ )
extern uint32_t __FLASH_segment_start__[];
extern uint32_t __FLASH_segment_end__[];
extern uint32_t __SRAM_segment_start__[];
extern uint32_t __SRAM_segment_end__[];
extern uint32_t __privileged_functions_start__[];
extern uint32_t __privileged_functions_end__[];
extern uint32_t __privileged_data_start__[];
extern uint32_t __privileged_data_end__[];
extern uint32_t __privileged_functions_actual_end__[];
extern uint32_t __privileged_data_actual_end__[];
#else
const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0x00UL;
const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x00080000UL;
const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x20000000UL;
const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x20008000UL;
const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0x00UL;
const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0x8000UL;
const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x20000000UL;
const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x20000200UL;
#endif
/*-----------------------------------------------------------*/
/* Data used by the 'check' task. ---------------------------*/
/*-----------------------------------------------------------*/
@ -267,13 +309,23 @@ char cReadOnlyArray[ mainREAD_ONLY_ARRAY_SIZE ] mainALIGN_TO( mainREAD_ONLY_ALIG
#define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128
char cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] mainALIGN_TO( mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE );
/* The following two variables are used to communicate the status of the second
two register check tasks (tasks 3 and 4) to the check task. If the variables
keep incrementing, then the register check tasks have not discovered any errors.
If a variable stops incrementing, then an error has been found. The variables
overlay the array that the check task has access to so they can be read by the
check task without causing a memory fault. The check task has the highest
priority so will have finished with the array before the register test tasks
start to access it. */
volatile uint32_t *pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] );
/* Fill in a TaskParameters_t structure to define the check task - this is the
structure passed to the xTaskCreateRestricted() function. */
static const TaskParameters_t xCheckTaskParameters =
{
prvCheckTask, /* pvTaskCode - the function that implements the task. */
"Check", /* pcName */
mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */
"Check", /* pcName */
mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */
( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */
xCheckTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */
@ -312,13 +364,13 @@ static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_
/* Fill in a TaskParameters_t structure per reg test task to define the tasks. */
static const TaskParameters_t xRegTest1Parameters =
{
prvRegTest1Task, /* pvTaskCode - the function that implements the task. */
"RegTest1", /* pcName */
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
( void * ) 0x12345678, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */
xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */
{ /* xRegions - this task does not use any non-stack data hence all members are zero. */
vRegTest1Implementation, /* pvTaskCode - the function that implements the task. */
"RegTest1", /* pcName */
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
( void * ) configREG_TEST_TASK_1_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */
tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */
xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */
{ /* xRegions - this task does not use any non-stack data hence all members are zero. */
/* Base address Length Parameters */
{ 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 },
@ -329,7 +381,7 @@ static const TaskParameters_t xRegTest1Parameters =
static TaskParameters_t xRegTest2Parameters =
{
prvRegTest2Task, /* pvTaskCode - the function that implements the task. */
vRegTest2Implementation, /* pvTaskCode - the function that implements the task. */
"RegTest2", /* pcName */
mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */
( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */
@ -343,8 +395,6 @@ static TaskParameters_t xRegTest2Parameters =
}
};
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
/* Configures the task that is deleted. ---------------------*/
/*-----------------------------------------------------------*/
@ -363,10 +413,10 @@ static portSTACK_TYPE xDeleteTaskStack[ mainDELETE_TASK_STACK_SIZE_WORDS ] mainA
static TaskParameters_t xTaskToDeleteParameters =
{
prvTaskToDelete, /* pvTaskCode - the function that implements the task. */
mainTASK_TO_DELETE_NAME, /* pcName */
mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */
( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */
tskIDLE_PRIORITY + 1, /* uxPriority */
mainTASK_TO_DELETE_NAME, /* pcName */
mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */
( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */
tskIDLE_PRIORITY + 1, /* uxPriority */
xDeleteTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */
{ /* xRegions - this task does not use any non-stack data hence all members are zero. */
/* Base address Length Parameters */
@ -378,28 +428,32 @@ static TaskParameters_t xTaskToDeleteParameters =
/*-----------------------------------------------------------*/
volatile uint32_t ul1 = 0x123, ul2 = 0;
int main( void )
{
configASSERT( ul1 == 0x123 );
configASSERT( ul2 == 0 );
prvSetupHardware();
/* Create the queue used to pass "I'm alive" messages to the check task. */
xFileScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) );
xGlobalScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) );
/* One check task uses the task parameter to receive the queue handle.
This allows the file scope variable to be accessed from within the task.
The pvParameters member of xRegTest2Parameters can only be set after the
queue has been created so is set here. */
xRegTest2Parameters.pvParameters = xFileScopeCheckQueue;
xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue;
/* Create the three test tasks. Handles to the created tasks are not
required, hence the second parameter is NULL. */
/* Create three test tasks. Handles to the created tasks are not required,
hence the second parameter is NULL. */
xTaskCreateRestricted( &xRegTest1Parameters, NULL );
xTaskCreateRestricted( &xRegTest2Parameters, NULL );
xTaskCreateRestricted( &xCheckTaskParameters, NULL );
/* Create a task that does nothing but ensure some of the MPU API functions
can be called correctly, then get deleted. This is done for code coverage
test purposes only. The task's handle is saved in xTaskToDelete so it can
test purposes only. The task's handle is saved in xTaskToDelete so it can
get deleted in the idle task hook. */
xTaskCreateRestricted( &xTaskToDeleteParameters, &xTaskToDelete );
@ -421,6 +475,11 @@ int main( void )
NULL /* Handle. */
);
/* Create the third and fourth register check tasks, as described at the top
of this file. */
xTaskCreate( prvRegTest3Task, "Reg3", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_3_PARAMETER, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegTest4Task, "Reg4", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_4_PARAMETER, tskIDLE_PRIORITY, NULL );
/* Create and start the software timer. */
xTimer = xTimerCreate( "Timer", /* Test name for the timer. */
mainTIMER_PERIOD, /* Period of the timer. */
@ -436,7 +495,6 @@ int main( void )
/* Will only get here if there was insufficient memory to create the idle
task. */
for( ;; );
return 0;
}
/*-----------------------------------------------------------*/
@ -446,12 +504,21 @@ static void prvCheckTask( void *pvParameters )
queue variable. Take a stack copy of this before the task is set into user
mode. Once that task is in user mode the file scope queue variable will no
longer be accessible but the stack copy will. */
QueueHandle_t xQueue = xFileScopeCheckQueue;
QueueHandle_t xQueue = xGlobalScopeCheckQueue;
int32_t lMessage;
uint32_t ulStillAliveCounts[ 2 ] = { 0 };
uint32_t ulStillAliveCounts[ 3 ] = { 0 };
const char *pcStatusMessage = "PASS\r\n";
volatile uint32_t ulStatus = pdPASS;
uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0;
/* The register test tasks that also test the floating point registers increment
a counter on each iteration of their loop. The counters are inside the array
that this task has access to. */
volatile uint32_t *pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] );
/* ulCycleCount is incremented on each cycle of the check task. It can be
viewed updating in the Keil watch window as the simulator does not print to
the ITM port. */
volatile uint32_t ulCycleCount = 0;
/* Just to remove compiler warning. */
( void ) pvParameters;
@ -460,8 +527,9 @@ volatile uint32_t ulStatus = pdPASS;
The task privilege level is set down to user mode within this function. */
prvTestMemoryRegions();
/* Tests are done so lower the privilege status. */
portSWITCH_TO_USER_MODE();
/* Clear overlaid reg test counters before entering the loop below. */
*pulOverlaidCounter3 = 0UL;
*pulOverlaidCounter4 = 0UL;
/* This loop performs the main function of the task, which is blocking
on a message queue then processing each message as it arrives. */
@ -472,42 +540,61 @@ volatile uint32_t ulStatus = pdPASS;
switch( lMessage )
{
case mainREG_TEST_1_STILL_EXECUTING :
/* Message from task 1, so task 1 must still be executing. */
( ulStillAliveCounts[ 0 ] )++;
case configREG_TEST_1_STILL_EXECUTING :
case configREG_TEST_2_STILL_EXECUTING :
case configTIMER_STILL_EXECUTING :
/* Message from the first or second register check task, or
the timer callback function. Increment the count of the
number of times the message source has sent the message as
the message source must still be executed. */
( ulStillAliveCounts[ lMessage ] )++;
break;
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 configPRINT_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 ) )
status. If messages have stopped arriving from either of
the first two reg test task or the timer callback then the
status must be set to fail. */
if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) )
{
/* One or both of the test tasks are no longer sending
'still alive' messages. */
pcStatusMessage = "FAIL\r\n";
/* ulStatus can be viewed (live) in the Keil watch window. */
ulStatus = pdFAIL;
( void ) ulStatus;
}
else
{
/* Reset the count of 'still alive' messages. */
memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) );
}
/**** print pcStatusMessage here. ****/
( void ) pcStatusMessage;
/* Check that the register test 3 task is still incrementing
its counter, and therefore still running. */
if( ulLastRegTest3CountValue == *pulOverlaidCounter3 )
{
pcStatusMessage = "FAIL\r\n";
}
ulLastRegTest3CountValue = *pulOverlaidCounter3;
/* Reset the count of 'still alive' messages. */
memset( ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) );
/* Check that the register test 4 task is still incrementing
its counter, and therefore still running. */
if( ulLastRegTest4Value == *pulOverlaidCounter4 )
{
pcStatusMessage = "FAIL\r\n";
}
ulLastRegTest4Value = *pulOverlaidCounter4;
/**** Print pcStatusMessage here. ****/
( void ) pcStatusMessage;
/* The cycle count can be viewed updating in the Keil watch
window if ITM printf is not being used. */
ulCycleCount++;
break;
default :
/* Something unexpected happened. Delete this task so the
error is apparent (no output will be displayed). */
prvDeleteMe();
vMainDeleteMe();
break;
}
}
@ -527,7 +614,7 @@ char cTemp;
{
/* Something unexpected happened. Delete this task so the error is
apparent (no output will be displayed). */
prvDeleteMe();
vMainDeleteMe();
}
/* Writing off the end of the RAM allocated to this task will *NOT* cause a
@ -550,7 +637,7 @@ char cTemp;
{
/* Something unexpected happened. Delete this task so the error is
apparent (no output will be displayed). */
prvDeleteMe();
vMainDeleteMe();
}
}
@ -585,150 +672,6 @@ char cTemp;
}
/*-----------------------------------------------------------*/
static void prvRegTest1Task( void *pvParameters )
{
/* This task is created in privileged mode so can access the file scope
queue variable. Take a stack copy of this before the task is set into user
mode. Once this task is in user mode the file scope queue variable will no
longer be accessible but the stack copy will. */
QueueHandle_t xQueue = xFileScopeCheckQueue;
/* 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();
/* First check that the parameter value is as expected. */
if( pvParameters != ( void * ) 0x12345678 )
{
/* Error detected. Delete the task so it stops communicating with
the check task. */
prvDeleteMe();
}
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
(
" 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"
" MOV R8, #108 \n"
" MOV R9, #109 \n"
" MOV R10, #110 \n"
" MOV R11, #111 \n"
"reg1loop: \n"
" MOV R0, #100 \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */
" MOV R1, #101 \n"
" MOV R2, #102 \n"
" MOV R3, #103 \n"
" MOV R12, #112 \n"
" SVC #1 \n" /* Yield just to increase test coverage. */
" CMP R0, #100 \n" /* Check all the registers still contain their expected values. */
" BNE prvDeleteMe \n" /* Value was not as expected, delete the task so it stops communicating with the check task. */
" CMP R1, #101 \n"
" BNE prvDeleteMe \n"
" CMP R2, #102 \n"
" BNE prvDeleteMe \n"
" CMP R3, #103 \n"
" BNE prvDeleteMe \n"
" CMP R4, #104 \n"
" BNE prvDeleteMe \n"
" CMP R5, #105 \n"
" BNE prvDeleteMe \n"
" CMP R6, #106 \n"
" BNE prvDeleteMe \n"
" CMP R8, #108 \n"
" BNE prvDeleteMe \n"
" CMP R9, #109 \n"
" BNE prvDeleteMe \n"
" CMP R10, #110 \n"
" BNE prvDeleteMe \n"
" CMP R11, #111 \n"
" BNE prvDeleteMe \n"
" CMP R12, #112 \n"
" BNE prvDeleteMe \n"
:::"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
task is still functioning. */
prvSendImAlive( xQueue, mainREG_TEST_1_STILL_EXECUTING );
/* Go back to check all the register values again. */
__asm volatile( " B reg1loop " );
}
}
/*-----------------------------------------------------------*/
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
method. */
QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;
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
(
" 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"
"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"
" MOV R2, #2 \n"
" MOV R3, #3 \n"
" MOV R12, #12 \n"
" CMP R0, #13 \n" /* Check all the registers still contain their expected values. */
" BNE prvDeleteMe \n" /* Value was not as expected, delete the task so it stops communicating with the check task */
" CMP R1, #1 \n"
" BNE prvDeleteMe \n"
" CMP R2, #2 \n"
" BNE prvDeleteMe \n"
" CMP R3, #3 \n"
" BNE prvDeleteMe \n"
" CMP R4, #4 \n"
" BNE prvDeleteMe \n"
" CMP R5, #5 \n"
" BNE prvDeleteMe \n"
" CMP R6, #6 \n"
" BNE prvDeleteMe \n"
" CMP R8, #8 \n"
" BNE prvDeleteMe \n"
" CMP R9, #9 \n"
" BNE prvDeleteMe \n"
" CMP R10, #10 \n"
" BNE prvDeleteMe \n"
" CMP R11, #11 \n"
" BNE prvDeleteMe \n"
" CMP R12, #12 \n"
" BNE prvDeleteMe \n"
:::"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
task is still functioning. */
prvSendImAlive( xQueue, mainREG_TEST_2_STILL_EXECUTING );
/* Go back to check all the register values again. */
__asm volatile( " B reg2loop " );
}
}
/*-----------------------------------------------------------*/
static void prvExerciseEventGroupAPI( void )
{
EventGroupHandle_t xEventGroup;
@ -864,12 +807,7 @@ static void prvTaskToDelete( void *pvParameters )
void vApplicationIdleHook( void )
{
extern uint32_t __SRAM_segment_end__[];
extern uint32_t __privileged_data_start__[];
extern uint32_t __privileged_data_end__[];
extern uint32_t __FLASH_segment_start__[];
extern uint32_t __FLASH_segment_end__[];
volatile uint32_t *pul;
volatile const uint32_t *pul;
volatile uint32_t ulReadData;
/* The idle task, and therefore this function, run in Supervisor mode and
@ -916,20 +854,14 @@ volatile uint32_t ulReadData;
static void prvOldStyleUserModeTask( void *pvParameters )
{
extern uint32_t __privileged_data_start__[];
extern uint32_t __privileged_data_end__[];
extern uint32_t __SRAM_segment_end__[];
extern uint32_t __privileged_functions_end__[];
extern uint32_t __FLASH_segment_start__[];
extern uint32_t __FLASH_segment_end__[];
/*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/
volatile uint32_t *pul;
volatile const uint32_t *pul;
volatile uint32_t ulReadData;
/* 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 uint32_t __privileged_functions_start__[];
const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014;*/
/* extern uint32_t __privileged_functions_start__[]; */
/* const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; */
( void ) pvParameters;
@ -987,14 +919,7 @@ const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0
static void prvOldStylePrivilegedModeTask( void *pvParameters )
{
extern uint32_t __privileged_data_start__[];
extern uint32_t __privileged_data_end__[];
extern uint32_t __SRAM_segment_end__[];
extern uint32_t __privileged_functions_start__[];
extern uint32_t __privileged_functions_end__[];
extern uint32_t __FLASH_segment_start__[];
extern uint32_t __FLASH_segment_end__[];
volatile uint32_t *pul;
volatile const uint32_t *pul;
volatile uint32_t ulReadData;
const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */
/*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/
@ -1044,13 +969,13 @@ const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0
}
/*-----------------------------------------------------------*/
static void prvDeleteMe( void )
void vMainDeleteMe( void )
{
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
static void prvSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber )
void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber )
{
if( xHandle != NULL )
{
@ -1066,9 +991,9 @@ static void prvSetupHardware( void )
void vApplicationTickHook( void )
{
static uint32_t ulCallCount;
const uint32_t ulCallsBetweenSends = 5000UL / configTICK_RATE_HZ;
const uint32_t ulMessage = mainPRINT_SYSTEM_STATUS;
static uint32_t ulCallCount = 0;
const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 1000 );
const uint32_t ulMessage = configPRINT_SYSTEM_STATUS;
portBASE_TYPE xDummy;
/* If configUSE_TICK_HOOK is set to 1 then this function will get called
@ -1087,8 +1012,8 @@ portBASE_TYPE xDummy;
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. */
xQueueSendFromISR( xFileScopeCheckQueue, &ulMessage, &xDummy );
so can access xGlobalScopeCheckQueue directly. */
xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy );
}
}
/*-----------------------------------------------------------*/
@ -1112,75 +1037,6 @@ void vApplicationMallocFailedHook( void )
}
/*-----------------------------------------------------------*/
void hard_fault_handler( uint32_t * hardfault_args )
{
volatile uint32_t stacked_r0;
volatile uint32_t stacked_r1;
volatile uint32_t stacked_r2;
volatile uint32_t stacked_r3;
volatile uint32_t stacked_r12;
volatile uint32_t stacked_lr;
volatile uint32_t stacked_pc;
volatile uint32_t stacked_psr;
stacked_r0 = ((uint32_t) hardfault_args[ 0 ]);
stacked_r1 = ((uint32_t) hardfault_args[ 1 ]);
stacked_r2 = ((uint32_t) hardfault_args[ 2 ]);
stacked_r3 = ((uint32_t) hardfault_args[ 3 ]);
stacked_r12 = ((uint32_t) hardfault_args[ 4 ]);
stacked_lr = ((uint32_t) hardfault_args[ 5 ]);
stacked_pc = ((uint32_t) hardfault_args[ 6 ]);
stacked_psr = ((uint32_t) hardfault_args[ 7 ]);
/* 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;
}
/*-----------------------------------------------------------*/
void HardFault_Handler( void ) __attribute__((naked));
void HardFault_Handler( void )
{
__asm volatile
(
" tst lr, #4 \n"
" ite eq \n"
" mrseq r0, msp \n"
" mrsne r0, psp \n"
" ldr r1, [r0, #24] \n"
" ldr r2, handler_address_const \n"
" bx r2 \n"
" handler_address_const: .word hard_fault_handler \n"
);
}
/*-----------------------------------------------------------*/
void MemManage_Handler( void ) __attribute__((naked));
void MemManage_Handler( void )
{
__asm volatile
(
" tst lr, #4 \n"
" ite eq \n"
" mrseq r0, msp \n"
" mrsne r0, psp \n"
" ldr r1, [r0, #24] \n"
" ldr r2, handler2_address_const \n"
" bx r2 \n"
" handler2_address_const: .word hard_fault_handler \n"
);
}
/*-----------------------------------------------------------*/
static void prvTimerCallback( TaskHandle_t xExpiredTimer )
{
uint32_t ulCount;
@ -1192,6 +1048,9 @@ uint32_t ulCount;
/* Increment the count, and save it back into the timer's ID. */
ulCount++;
vTimerSetTimerID( xTimer, ( void * ) ulCount );
/* Let the check task know the timer is still running. */
vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING );
}
/*-----------------------------------------------------------*/
@ -1243,3 +1102,41 @@ static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
}
/*-----------------------------------------------------------*/
static void prvRegTest3Task( void *pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
written in C for convenience of checking the task parameter is being passed
in correctly. */
if( pvParameters == configREG_TEST_TASK_3_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest3Implementation();
}
/* The following line will only execute if the task parameter is found to
be incorrect. The check task will detect that the regtest loop counter is
not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
static void prvRegTest4Task( void *pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
written in C for convenience of checking the task parameter is being passed
in correctly. */
if( pvParameters == configREG_TEST_TASK_4_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest4Implementation();
}
/* The following line will only execute if the task parameter is found to
be incorrect. The check task will detect that the regtest loop counter is
not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/

View File

@ -348,7 +348,7 @@ BaseType_t xRunningPrivileged = xPortRaisePrivilege();
#endif
/*-----------------------------------------------------------*/
#if ( configGENERATE_RUN_TIME_STATS == 1 )
#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )
void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer )
{
BaseType_t xRunningPrivileged = xPortRaisePrivilege();