From: rtel Date: Wed, 20 Apr 2016 15:42:34 +0000 (+0000) Subject: Update the MPU port so it supports all the public functions found in V9.0.0rc2. X-Git-Tag: V9.0.0~17 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cd15475ad7b7db3b129c7cc664e493cd2f706bbc;p=freertos Update the MPU port so it supports all the public functions found in V9.0.0rc2. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2446 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/FreeRTOSConfig.h index d6dd1b712..f052d2e96 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/FreeRTOSConfig.h @@ -87,10 +87,14 @@ extern "C" { * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ +/* The MPU version of port.c includes and excludes functions depending on the +settings within this file. Therefore, to ensure all the functions in port.c +build, this configuration file has all options turned on. */ + #define configUSE_PREEMPTION 1 #define configTICK_RATE_HZ ( 1000 ) #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 -#define configUSE_QUEUE_SETS 0 +#define configUSE_QUEUE_SETS 1 #define configUSE_IDLE_HOOK 1 #define configUSE_TICK_HOOK 1 #define configCPU_CLOCK_HZ 48000000 @@ -98,23 +102,24 @@ extern "C" { #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 120 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 10 ) -#define configUSE_TRACE_FACILITY 0 +#define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 -#define configUSE_MUTEXES 0 -#define configQUEUE_REGISTRY_SIZE 0 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 5 #define configCHECK_FOR_STACK_OVERFLOW 2 -#define configUSE_RECURSIVE_MUTEXES 0 +#define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_MALLOC_FAILED_HOOK 1 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_COUNTING_SEMAPHORES 0 -#define configSUPPORT_STATIC_ALLOCATION 0 +#define configUSE_APPLICATION_TASK_TAG 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configSUPPORT_STATIC_ALLOCATION 1 #define configUSE_TICKLESS_IDLE 0 +#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 2 /* Run time stats gathering definitions. */ -#define configGENERATE_RUN_TIME_STATS 0 +#define configGENERATE_RUN_TIME_STATS 1 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() -#define portGET_RUN_TIME_COUNTER_VALUE() +#define portGET_RUN_TIME_COUNTER_VALUE() 0 /* This demo makes use of one or more example stats formatting functions. These format the raw data provided by the uxTaskGetSystemState() function in to human @@ -127,7 +132,7 @@ FreeRTOS/Source/tasks.c for limitations. */ #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Software timer definitions. */ -#define configUSE_TIMERS 0 +#define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY ( 2 ) #define configTIMER_QUEUE_LENGTH 5 #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE ) diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvguix.barryri b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvguix.barryri index 891772eef..72beed9a0 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvguix.barryri +++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvguix.barryri @@ -21,7 +21,7 @@ 204 Performance Analyzer - 1028 154 154 100 + 1028 154 154 278 @@ -30,25 +30,25 @@ 1506 Symbols - 70 70 70 + 80 80 80 1936 Watch 1 - 70 164 70 + 80 80 80 1937 Watch 2 - 70 70 70 + 80 80 80 1935 Call Stack + Locals - 70 70 70 + 80 80 80 2506 @@ -75,25 +75,25 @@ 2 3 - -1 - -1 + -32000 + -32000 -1 -1 - 104 - 399 - 1341 - 976 + 92 + 350 + 1292 + 964 0 - 921 - 01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000007000000000000000100000035433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C536F757263655C71756575652E63000000000771756575652E6300000000F7B88600FFFFFFFF5A433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C44656D6F5C434F525445585F4D50555F53696D756C61746F725F4B65696C5F4743435C4672656552544F53436F6E6669672E6800000000104672656552544F53436F6E6669672E6800000000BCA8E100FFFFFFFF67433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C44656D6F5C434F525445585F4D50555F53696D756C61746F725F4B65696C5F4743435C4743435F53706563696669635C737461727475705F41524D434D342E530000000010737461727475705F41524D434D342E5300000000FFDC7800FFFFFFFF50433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C44656D6F5C434F525445585F4D50555F53696D756C61746F725F4B65696C5F4743435C6D61696E2E6300000000066D61696E2E6300000000BCA8E100FFFFFFFF62433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C44656D6F5C434F525445585F4D50555F53696D756C61746F725F4B65696C5F4743435C4743435F53706563696669635C73656374696F6E732E6C64000000000B73656374696F6E732E6C6400000000BECEA100FFFFFFFF35433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C536F757263655C7461736B732E6300000000077461736B732E6300000000F0A0A100FFFFFFFF4D433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C536F757263655C706F727461626C655C4743435C41524D5F434D335F4D50555C706F72742E630000000006706F72742E63000000009CC1B600FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000110100005E000000800700006C030000 + 276 + 01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000001000000000000000100000050433A5C455C4465765C4672656552544F535C576F726B696E67436F70795C4672656552544F535C44656D6F5C434F525445585F4D50555F53696D756C61746F725F4B65696C5F4743435C6D61696E2E6300000000066D61696E2E6300000000FFDC7800FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000110100005E000000800700006C030000 @@ -1287,8 +1287,8 @@ 59392 File - 2391 - 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000000004000000000000000000000000000000000100000001000000018022E100000000000005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000004000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000000460000000000000000000000000000000001000000010000000180FE880000000000004500000000000000000000000000000000010000000100000001800B810000000000001300000000000000000000000000000000010000000100000001800C810000000000001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000000000000000000000000000000000000000001000000010000009600000002002050000000002274736B535441544943414C4C595F414C4C4F43415445445F535441434B5F4F4E4C59960000000000000014002274736B535441544943414C4C595F414C4C4F43415445445F535441434B5F4F4E4C59065354415449430005737461636B0352414D064D454D4F52590B504F53534942494C495459135F4D696E696D756D5F537461636B5F53697A650644414D4147450665787465726E0A5F5F537461636B546F7007766563746F727306756C4D61696E2574736B535441544943414C4C595F414C4C4F43415445445F535441434B5F414E445F54434206535441434B5F1F636F6E666967535550504F52545F5354415449435F414C4C4F434154494F4E157563537461746963616C6C79416C6C6F6361746564047563537408696E6469636174651D74736B5354415449435F414C4C4F434154494F4E5F504F535349424C450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C6572030000 + 2178 + 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000000000000000000000000000000000000000001000000010000009600000002002050000000000A5553455F54494D455253960000000000000007000A5553455F54494D455253001E636F6E6669675553455F4150504C49434154494F4E5F5441534B5F5441471D636F6E66696747454E45524154455F52554E5F54494D455F53544154531F636F6E666967535550504F52545F5354415449435F414C4C4F434154494F4E11707276537461727446697273745461736B0E73746172747363686564756C657200000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C6572030000 1423 @@ -2528,8 +2528,8 @@ 59392 File - 2391 - 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000000000000000000000000000000000000000001000000010000009600000002002050000000002274736B535441544943414C4C595F414C4C4F43415445445F535441434B5F4F4E4C59960000000000000014002274736B535441544943414C4C595F414C4C4F43415445445F535441434B5F4F4E4C59065354415449430005737461636B0352414D064D454D4F52590B504F53534942494C495459135F4D696E696D756D5F537461636B5F53697A650644414D4147450665787465726E0A5F5F537461636B546F7007766563746F727306756C4D61696E2574736B535441544943414C4C595F414C4C4F43415445445F535441434B5F414E445F54434206535441434B5F1F636F6E666967535550504F52545F5354415449435F414C4C4F434154494F4E157563537461746963616C6C79416C6C6F6361746564047563537408696E6469636174651D74736B5354415449435F414C4C4F434154494F4E5F504F535349424C450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020003001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C6572030000 + 2178 + 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000000000000000000000000000000000000000001000000010000009600000002002050000000000A5553455F54494D455253960000000000000007000A5553455F54494D455253001E636F6E6669675553455F4150504C49434154494F4E5F5441534B5F5441471D636F6E66696747454E45524154455F52554E5F54494D455F53544154531F636F6E666967535550504F52545F5354415449435F414C4C4F434154494F4E11707276537461727446697273745461736B0E73746172747363686564756C657200000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020001001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C6572030000 1423 @@ -2586,65 +2586,11 @@ 100 0 - - ..\..\..\Source\queue.c - 2 - 23 - 68 - 1 - - 0 - - - ..\FreeRTOSConfig.h - 0 - 148 - 192 - 1 - - 0 - - - .\startup_ARMCM4.S - 0 - 125 - 139 - 1 - - 0 - ..\main.c 0 - 273 - 316 - 1 - - 0 - - - C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_MPU_Simulator_Keil_GCC\GCC_Specific\sections.ld - 52 - 13 - 4 - 1 - - 0 - - - ..\..\..\Source\tasks.c - 0 - 3596 - 3608 - 1 - - 0 - - - ..\..\..\Source\portable\GCC\ARM_CM3_MPU\port.c - 0 - 390 - 402 + 70 + 358 1 0 diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvoptx b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvoptx index 0d97bc04e..b6413f9e0 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvoptx +++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvoptx @@ -145,30 +145,23 @@ -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) - - - 0 - 0 - 3619 - 1 -
8634
- 0 - 0 - 0 - 0 - 0 - 1 - C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Source\tasks.c - - \\RTOSDemo\../../../Source/tasks.c\3619 -
-
+ 0 1 xTickCount + + 1 + 1 + ulStillAliveCounts + + + 2 + 1 + ulStatus + @@ -224,7 +217,7 @@ System - 1 + 0 0 0 0 @@ -244,7 +237,7 @@ main_and_config - 1 + 0 0 0 0 @@ -276,7 +269,7 @@ FreeRTOS_Source - 1 + 0 0 0 0 diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c index 0c1e9465e..77b1237f3 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c @@ -153,6 +153,11 @@ static void prvOldStyleUserModeTask( void *pvParameters ); */ static void prvOldStylePrivilegedModeTask( void *pvParameters ); +/* + * A task that is deleted by the Idle task. This is just done for code + * coverage test purposes. + */ +static void prvTaskToDelete( void *pvParameters ); /*-----------------------------------------------------------*/ /* Prototypes for other misc functions. --------------------*/ @@ -176,7 +181,7 @@ static void prvDeleteMe( void ) __attribute__((noinline)); * 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, unsigned long ulTaskNumber ); +static void prvSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ); /* * The check task is created with access to three memory regions (plus its @@ -197,6 +202,10 @@ to gain access to the queue. See the comments in the tasks themselves for further information. */ static QueueHandle_t xFileScopeCheckQueue = NULL; +/* Holds the handle of a task that is deleted in the idle task hook - this is +done for code coverage test purposes only. */ +static TaskHandle_t xTaskToDelete = NULL; + /*-----------------------------------------------------------*/ /* Data used by the 'check' task. ---------------------------*/ @@ -312,12 +321,45 @@ static TaskParameters_t xRegTest2Parameters = /*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ +/* Configures the task that is deleted. ---------------------*/ +/*-----------------------------------------------------------*/ + +/* Define the constants used to allocate the stack of the task that is +deleted. Note that that stack size is defined in words, not bytes. */ +#define mainDELETE_TASK_STACK_SIZE_WORDS 128 +#define mainTASK_TO_DELETE_STACK_ALIGNMENT ( mainDELETE_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + +/* Declare the stack that will be used by the task that gets deleted. The +kernel will automatically create an MPU region for the stack. The stack +alignment must match its size, so if 128 words are reserved for the stack +then it must be aligned to ( 128 * 4 ) bytes. */ +static portSTACK_TYPE xDeleteTaskStack[ mainDELETE_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainTASK_TO_DELETE_STACK_ALIGNMENT ); + +static TaskParameters_t xTaskToDeleteParameters = +{ + prvTaskToDelete, /* pvTaskCode - the function that implements the task. */ + "DeleteMe", /* 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 */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } +}; + +/*-----------------------------------------------------------*/ + int main( void ) { prvSetupHardware(); /* Create the queue used to pass "I'm alive" messages to the check task. */ - xFileScopeCheckQueue = xQueueCreate( 1, sizeof( unsigned long ) ); + xFileScopeCheckQueue = 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. @@ -331,6 +373,11 @@ int main( void ) xTaskCreateRestricted( &xRegTest2Parameters, NULL ); xTaskCreateRestricted( &xCheckTaskParameters, NULL ); + /* Create a task that does nothing but get deleted. This is done for code + coverage test purposes only. The task's handle is saved in xTaskToDelete + so it can get deleted in the idle task hook. */ + xTaskCreateRestricted( &xTaskToDeleteParameters, &xTaskToDelete ); + /* Create the tasks that are created using the original xTaskCreate() API function. */ xTaskCreate( prvOldStyleUserModeTask, /* The function that implements the task. */ @@ -366,9 +413,10 @@ 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; -long lMessage; -unsigned long ulStillAliveCounts[ 2 ] = { 0 }; +int32_t lMessage; +uint32_t ulStillAliveCounts[ 2 ] = { 0 }; const char *pcStatusMessage = "PASS\r\n"; +volatile uint32_t ulStatus = pdPASS; /* Just to remove compiler warning. */ @@ -409,12 +457,14 @@ const char *pcStatusMessage = "PASS\r\n"; /* 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; } - /* Print a pass/fail message to the terminal. This will be - visible in the CrossWorks IDE. */ -// MPU_debug_printf( pcStatusMessage ); -( void ) pcStatusMessage; + /* print pcStatusMessage here. */ + ( void ) pcStatusMessage; /* Reset the count of 'still alive' messages. */ memset( ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) ); @@ -432,7 +482,7 @@ const char *pcStatusMessage = "PASS\r\n"; static void prvTestMemoryRegions( void ) { -long l; +int32_t x; char cTemp; /* The check task (from which this function is called) is created in the @@ -459,10 +509,10 @@ char cTemp; /*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/ /* The read/write array can still be successfully read and written. */ - for( l = 0; l < mainREAD_WRITE_ALIGN_SIZE; l++ ) + for( x = 0; x < mainREAD_WRITE_ALIGN_SIZE; x++ ) { - cReadWriteArray[ l ] = 'a'; - if( cReadWriteArray[ l ] != 'a' ) + cReadWriteArray[ x ] = 'a'; + if( cReadWriteArray[ x ] != 'a' ) { /* Something unexpected happened. Delete this task so the error is apparent (no output will be displayed). */ @@ -477,9 +527,9 @@ char cTemp; /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */ /* The read only array can be successfully read... */ - for( l = 0; l < mainREAD_ONLY_ALIGN_SIZE; l++ ) + for( x = 0; x < mainREAD_ONLY_ALIGN_SIZE; x++ ) { - cTemp = cReadOnlyArray[ l ]; + cTemp = cReadOnlyArray[ x ]; } /* ...but cannot be written. Uncomment the following line to test. */ @@ -645,15 +695,26 @@ QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters; } /*-----------------------------------------------------------*/ +static void prvTaskToDelete( void *pvParameters ) +{ + /* Remove compiler warnings about unused parameters. */ + ( void ) pvParameters; + + /* This task has nothing to do - for code coverage test purposes it is + deleted by the Idle task. */ + vTaskSuspend( NULL ); +} +/*-----------------------------------------------------------*/ + void vApplicationIdleHook( void ) { -extern unsigned long __SRAM_segment_end__[]; -extern unsigned long __privileged_data_start__[]; -extern unsigned long __privileged_data_end__[]; -extern unsigned long __FLASH_segment_start__[]; -extern unsigned long __FLASH_segment_end__[]; -volatile unsigned long *pul; -volatile unsigned long ulReadData; +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 uint32_t ulReadData; /* The idle task, and therefore this function, run in Supervisor mode and can therefore access all memory. Try reading from corners of flash and @@ -685,26 +746,34 @@ volatile unsigned long ulReadData; /* pul = __SRAM_segment_end__ + 1; ulReadData = *pul; */ + /* One task is created purely so it can be deleted - done for code coverage + test purposes. */ + if( xTaskToDelete != NULL ) + { + vTaskDelete( xTaskToDelete ); + xTaskToDelete = NULL; + } + ( void ) ulReadData; } /*-----------------------------------------------------------*/ static void prvOldStyleUserModeTask( void *pvParameters ) { -extern unsigned long __privileged_data_start__[]; -extern unsigned long __privileged_data_end__[]; -extern unsigned long __SRAM_segment_end__[]; -extern unsigned long __privileged_functions_end__[]; -extern unsigned long __FLASH_segment_start__[]; -extern unsigned long __FLASH_segment_end__[]; -//const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigned long * ) 0x400FC0C4; -volatile unsigned long *pul; -volatile unsigned long ulReadData; +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 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 unsigned long __privileged_functions_start__[]; -const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned long * ) 0xe000e014; */ +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;*/ ( void ) pvParameters; @@ -727,29 +796,29 @@ const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned ulReadData = *pul; /* Standard peripherals are accessible. */ -// ulReadData = *pulStandardPeripheralRegister; + /*ulReadData = *pulStandardPeripheralRegister;*/ /* System peripherals are not accessible. Uncomment the following line to test. Also uncomment the declaration of pulSystemPeripheralRegister - at the top of this function. */ - /* ulReadData = *pulSystemPeripheralRegister; */ + at the top of this function. + ulReadData = *pulSystemPeripheralRegister; */ /* Reading from anywhere inside the privileged Flash or RAM should cause a fault. This can be tested by uncommenting any of the following pairs of lines. Also uncomment the declaration of __privileged_functions_start__ at the top of this function. */ - /* pul = __privileged_functions_start__; - ulReadData = *pul; */ + /*pul = __privileged_functions_start__; + ulReadData = *pul;*/ - /* pul = __privileged_functions_end__ - 1; - ulReadData = *pul; */ + /*pul = __privileged_functions_end__ - 1; + ulReadData = *pul;*/ - /* pul = __privileged_data_start__; - ulReadData = *pul; */ + /*pul = __privileged_data_start__; + ulReadData = *pul;*/ - /* pul = __privileged_data_end__ - 1; - ulReadData = *pul; */ + /*pul = __privileged_data_end__ - 1; + ulReadData = *pul;*/ /* Must not just run off the end of a task function, so delete this task. Note that because this task was created using xTaskCreate() the stack was @@ -762,17 +831,17 @@ const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned static void prvOldStylePrivilegedModeTask( void *pvParameters ) { -extern unsigned long __privileged_data_start__[]; -extern unsigned long __privileged_data_end__[]; -extern unsigned long __SRAM_segment_end__[]; -extern unsigned long __privileged_functions_start__[]; -extern unsigned long __privileged_functions_end__[]; -extern unsigned long __FLASH_segment_start__[]; -extern unsigned long __FLASH_segment_end__[]; -volatile unsigned long *pul; -volatile unsigned long ulReadData; -const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned long * ) 0xe000e014; /* Systick */ -//const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigned long * ) 0x400FC0C4; +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 uint32_t ulReadData; +const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */ +/*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/ ( void ) pvParameters; @@ -808,7 +877,7 @@ const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned /* Finally, accessing both System and normal peripherals should both be possible. */ ulReadData = *pulSystemPeripheralRegister; -// ulReadData = *pulStandardPeripheralRegister; + /*ulReadData = *pulStandardPeripheralRegister;*/ /* Must not just run off the end of a task function, so delete this task. Note that because this task was created using xTaskCreate() the stack was @@ -825,7 +894,7 @@ static void prvDeleteMe( void ) } /*-----------------------------------------------------------*/ -static void prvSendImAlive( QueueHandle_t xHandle, unsigned long ulTaskNumber ) +static void prvSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ) { if( xHandle != NULL ) { @@ -841,9 +910,9 @@ static void prvSetupHardware( void ) void vApplicationTickHook( void ) { -static unsigned long ulCallCount; -const unsigned long ulCallsBetweenSends = 5000 / portTICK_PERIOD_MS; -const unsigned long ulMessage = mainPRINT_SYSTEM_STATUS; +static uint32_t ulCallCount; +const uint32_t ulCallsBetweenSends = 5000UL / configTICK_RATE_HZ; +const uint32_t ulMessage = mainPRINT_SYSTEM_STATUS; portBASE_TYPE xDummy; /* If configUSE_TICK_HOOK is set to 1 then this function will get called @@ -887,26 +956,26 @@ void vApplicationMallocFailedHook( void ) } /*-----------------------------------------------------------*/ -void hard_fault_handler(unsigned int * hardfault_args) +void hard_fault_handler( uint32_t * hardfault_args ) { -volatile unsigned int stacked_r0; -volatile unsigned int stacked_r1; -volatile unsigned int stacked_r2; -volatile unsigned int stacked_r3; -volatile unsigned int stacked_r12; -volatile unsigned int stacked_lr; -volatile unsigned int stacked_pc; -volatile unsigned int stacked_psr; - - stacked_r0 = ((unsigned long) hardfault_args[0]); - stacked_r1 = ((unsigned long) hardfault_args[1]); - stacked_r2 = ((unsigned long) hardfault_args[2]); - stacked_r3 = ((unsigned long) hardfault_args[3]); - - stacked_r12 = ((unsigned long) hardfault_args[4]); - stacked_lr = ((unsigned long) hardfault_args[5]); - stacked_pc = ((unsigned long) hardfault_args[6]); - stacked_psr = ((unsigned long) hardfault_args[7]); +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( ;; ); @@ -939,7 +1008,7 @@ void HardFault_Handler( void ) } /*-----------------------------------------------------------*/ -void MPU_Fault_ISR( void ) __attribute__((naked)); +void MemManage_Handler( void ) __attribute__((naked)); void MemManage_Handler( void ) { __asm volatile @@ -957,5 +1026,51 @@ void MemManage_Handler( void ) /*-----------------------------------------------------------*/ -#warning Why must configSUPPORT_STATIC_ALLOCATION be set to 1 when the MPU is used? -#warning Linker script is crippled for use with the simulator. \ No newline at end of file +/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an +implementation of vApplicationGetIdleTaskMemory() to provide the memory that is +used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) +{ +/* If the buffers to be provided to the Idle task are declared inside this +function then they must be declared static - otherwise they will be allocated on +the stack and so not exists after this function exits. */ +static StaticTask_t xIdleTaskTCB; +static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; +} +/*-----------------------------------------------------------*/ + +/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the +application must provide an implementation of vApplicationGetTimerTaskMemory() +to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) +{ +/* If the buffers to be provided to the Timer task are declared inside this +function then they must be declared static - otherwise they will be allocated on +the stack and so not exists after this function exits. */ +static StaticTask_t xTimerTaskTCB; +static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; +} diff --git a/FreeRTOS/Source/include/mpu_prototypes.h b/FreeRTOS/Source/include/mpu_prototypes.h new file mode 100644 index 000000000..f289596fd --- /dev/null +++ b/FreeRTOS/Source/include/mpu_prototypes.h @@ -0,0 +1,176 @@ +/* + FreeRTOS V9.0.0rc2 - Copyright (C) 2016 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! +*/ + +/* + * When the MPU is used the standard (non MPU) API functions are mapped to + * equivalents that start "MPU_", the prototypes for which are defined in this + * header files. This will cause the application code to call the MPU_ version + * which wraps the non-MPU version with privilege promoting then demoting code, + * so the kernel code always runs will full privileges. + */ + + +#ifndef MPU_PROTOTYPES_H +#define MPU_PROTOTYPES_H + +/* MPU versions of tasks.h API function. */ +BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask ); +TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ); +BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ); +void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ); +void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ); +void MPU_vTaskDelay( const TickType_t xTicksToDelay ); +void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ); +BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ); +UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t xTask ); +eTaskState MPU_eTaskGetState( TaskHandle_t xTask ); +void MPU_vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ); +void MPU_vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ); +void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ); +void MPU_vTaskResume( TaskHandle_t xTaskToResume ); +void MPU_vTaskStartScheduler( void ); +void MPU_vTaskSuspendAll( void ); +BaseType_t MPU_xTaskResumeAll( void ); +TickType_t MPU_xTaskGetTickCount( void ); +UBaseType_t MPU_uxTaskGetNumberOfTasks( void ); +char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ); +TaskHandle_t MPU_xTaskGetHandle( const char *pcNameToQuery ); +UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ); +void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ); +TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ); +void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue ); +void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex ); +BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ); +TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ); +UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ); +void MPU_vTaskList( char * pcWriteBuffer ); +void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer ); +BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue ); +BaseType_t MPU_xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); +uint32_t MPU_ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ); +BaseType_t MPU_xTaskIncrementTick( void ); +TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ); +void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ); +BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ); +void MPU_vTaskMissedYield( void ); +BaseType_t MPU_xTaskGetSchedulerState( void ); + +/* MPU versions of queue.h API function. */ +BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition ); +BaseType_t MPU_xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xJustPeek ); +UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ); +UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ); +void MPU_vQueueDelete( QueueHandle_t xQueue ); +QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ); +QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue ); +QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ); +QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue ); +void* MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ); +BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait ); +BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ); +void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName ); +void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ); +const char * MPU_pcQueueGetName( QueueHandle_t xQueue ); +QueueHandle_t MPU_xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ); +QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType ); +QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ); +BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); +BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); +QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, const TickType_t xTicksToWait ); +BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ); +void MPU_vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ); +UBaseType_t MPU_uxQueueGetQueueNumber( QueueHandle_t xQueue ); +uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ); + +/* MPU versions of timers.h API function. */ +TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction ); +TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer ); +void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ); +void MPU_vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID ); +BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ); +TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ); +BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ); +const char * MPU_pcTimerGetName( TimerHandle_t xTimer ); +TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ); +TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ); +BaseType_t MPU_xTimerCreateTimerTask( void ); +BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ); + +/* MPU versions of event_group.h API function. */ +EventGroupHandle_t MPU_xEventGroupCreate( void ); +EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer ); +EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ); +EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ); +EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); +EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ); +void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ); +UBaseType_t MPU_uxEventGroupGetNumber( void* xEventGroup ); + +#endif /* MPU_PROTOTYPES_H */ + diff --git a/FreeRTOS/Source/include/mpu_wrappers.h b/FreeRTOS/Source/include/mpu_wrappers.h index b70f60543..5adbca624 100644 --- a/FreeRTOS/Source/include/mpu_wrappers.h +++ b/FreeRTOS/Source/include/mpu_wrappers.h @@ -79,80 +79,102 @@ only for ports that are using the MPU. */ those files. */ #ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE - #define xTaskCreate MPU_xTaskCreate - #define xTaskCreateRestricted MPU_xTaskCreateRestricted - #define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions - #define vTaskDelete MPU_vTaskDelete - #define vTaskDelayUntil MPU_vTaskDelayUntil - #define vTaskDelay MPU_vTaskDelay - #define uxTaskPriorityGet MPU_uxTaskPriorityGet - #define vTaskPrioritySet MPU_vTaskPrioritySet - #define eTaskGetState MPU_eTaskGetState - #define vTaskSuspend MPU_vTaskSuspend - #define vTaskResume MPU_vTaskResume - #define vTaskSuspendAll MPU_vTaskSuspendAll - #define xTaskResumeAll MPU_xTaskResumeAll - #define xTaskGetTickCount MPU_xTaskGetTickCount - #define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks - #define vTaskList MPU_vTaskList - #define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats - #define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag - #define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag - #define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook - #define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark - #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle - #define xTaskGetSchedulerState MPU_xTaskGetSchedulerState - #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle - #define uxTaskGetSystemState MPU_uxTaskGetSystemState - #define xTaskGenericNotify MPU_xTaskGenericNotify - #define xTaskNotifyWait MPU_xTaskNotifyWait - #define ulTaskNotifyTake MPU_ulTaskNotifyTake - - #define xQueueGenericCreate MPU_xQueueGenericCreate - #define xQueueCreateMutex MPU_xQueueCreateMutex - #define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive - #define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive - #define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore - #define xQueueGenericSend MPU_xQueueGenericSend - #define xQueueGenericReceive MPU_xQueueGenericReceive - #define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting - #define vQueueDelete MPU_vQueueDelete - #define xQueueGenericReset MPU_xQueueGenericReset - #define xQueueCreateSet MPU_xQueueCreateSet - #define xQueueSelectFromSet MPU_xQueueSelectFromSet - #define xQueueAddToSet MPU_xQueueAddToSet - #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet - #define xQueueGetMutexHolder MPU_xQueueGetMutexHolder - - #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) - #define pvPortMalloc MPU_pvPortMalloc - #define vPortFree MPU_vPortFree - #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ - - #define xPortGetFreeHeapSize MPU_xPortGetFreeHeapSize - #define vPortInitialiseBlocks MPU_vPortInitialiseBlocks - #define xPortGetMinimumEverFreeHeapSize MPU_xPortGetMinimumEverFreeHeapSize - - #if configQUEUE_REGISTRY_SIZE > 0 - #define vQueueAddToRegistry MPU_vQueueAddToRegistry - #define vQueueUnregisterQueue MPU_vQueueUnregisterQueue + /* + * Map standard (non MPU) API functions to equivalents that start + * "MPU_". This will cause the application code to call the MPU_ + * version, which wraps the non-MPU version with privilege promoting + * then demoting code, so the kernel code always runs will full + * privileges. + */ + + /* Map standard tasks.h API functions to the MPU equivalents. */ + #define xTaskCreate MPU_xTaskCreate + #define xTaskCreateStatic MPU_xTaskCreateStatic + #define xTaskCreateRestricted MPU_xTaskCreateRestricted + #define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions + #define vTaskDelete MPU_vTaskDelete + #define vTaskDelay MPU_vTaskDelay + #define vTaskDelayUntil MPU_vTaskDelayUntil + #define xTaskAbortDelay MPU_xTaskAbortDelay + #define uxTaskPriorityGet MPU_uxTaskPriorityGet + #define eTaskGetState MPU_eTaskGetState + #define vTaskGetInfo MPU_vTaskGetInfo + #define vTaskPrioritySet MPU_vTaskPrioritySet + #define vTaskSuspend MPU_vTaskSuspend + #define vTaskResume MPU_vTaskResume + #define vTaskSuspendAll MPU_vTaskSuspendAll + #define xTaskResumeAll MPU_xTaskResumeAll + #define xTaskGetTickCount MPU_xTaskGetTickCount + #define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks + #define pcTaskGetName MPU_pcTaskGetName + #define xTaskGetHandle MPU_xTaskGetHandle + #define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark + #define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag + #define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag + #define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer + #define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer + #define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook + #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle + #define uxTaskGetSystemState MPU_uxTaskGetSystemState + #define vTaskList MPU_vTaskList + #define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats + #define xTaskGenericNotify MPU_xTaskGenericNotify + #define xTaskNotifyWait MPU_xTaskNotifyWait + #define ulTaskNotifyTake MPU_ulTaskNotifyTake + + #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle + #define vTaskSetTimeOutState MPU_vTaskSetTimeOutState + #define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut + #define xTaskGetSchedulerState MPU_xTaskGetSchedulerState + + /* Map standard queue.h API functions to the MPU equivalents. */ + #define xQueueGenericSend MPU_xQueueGenericSend + #define xQueueGenericReceive MPU_xQueueGenericReceive + #define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting + #define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable + #define vQueueDelete MPU_vQueueDelete + #define xQueueCreateMutex MPU_xQueueCreateMutex + #define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic + #define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore + #define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic + #define xQueueGetMutexHolder MPU_xQueueGetMutexHolder + #define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive + #define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive + #define xQueueGenericCreate MPU_xQueueGenericCreate + #define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic + #define xQueueCreateSet MPU_xQueueCreateSet + #define xQueueAddToSet MPU_xQueueAddToSet + #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet + #define xQueueSelectFromSet MPU_xQueueSelectFromSet + #define xQueueGenericReset MPU_xQueueGenericReset + + #if( configQUEUE_REGISTRY_SIZE > 0 ) + #define vQueueAddToRegistry MPU_vQueueAddToRegistry + #define vQueueUnregisterQueue MPU_vQueueUnregisterQueue + #define pcQueueGetName MPU_pcQueueGetName #endif - #define xTimerCreate MPU_xTimerCreate - #define pvTimerGetTimerID MPU_pvTimerGetTimerID - #define vTimerSetTimerID MPU_vTimerSetTimerID - #define xTimerIsTimerActive MPU_xTimerIsTimerActive - #define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle - #define xTimerPendFunctionCall MPU_xTimerPendFunctionCall - #define pcTimerGetName MPU_pcTimerGetName - #define xTimerGenericCommand MPU_xTimerGenericCommand - - #define xEventGroupCreate MPU_xEventGroupCreate - #define xEventGroupWaitBits MPU_xEventGroupWaitBits - #define xEventGroupClearBits MPU_xEventGroupClearBits - #define xEventGroupSetBits MPU_xEventGroupSetBits - #define xEventGroupSync MPU_xEventGroupSync - #define vEventGroupDelete MPU_vEventGroupDelete + /* Map standard timer.h API functions to the MPU equivalents. */ + #define xTimerCreate MPU_xTimerCreate + #define xTimerCreateStatic MPU_xTimerCreateStatic + #define pvTimerGetTimerID MPU_pvTimerGetTimerID + #define vTimerSetTimerID MPU_vTimerSetTimerID + #define xTimerIsTimerActive MPU_xTimerIsTimerActive + #define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle + #define xTimerPendFunctionCall MPU_xTimerPendFunctionCall + #define pcTimerGetName MPU_pcTimerGetName + #define xTimerGetPeriod MPU_xTimerGetPeriod + #define xTimerGetExpiryTime MPU_xTimerGetExpiryTime + #define xTimerGenericCommand MPU_xTimerGenericCommand + + /* Map standard event_group.h API functions to the MPU equivalents. */ + #define xEventGroupCreate MPU_xEventGroupCreate + #define xEventGroupCreateStatic MPU_xEventGroupCreateStatic + #define xEventGroupWaitBits MPU_xEventGroupWaitBits + #define xEventGroupClearBits MPU_xEventGroupClearBits + #define xEventGroupSetBits MPU_xEventGroupSetBits + #define xEventGroupSync MPU_xEventGroupSync + #define vEventGroupDelete MPU_vEventGroupDelete /* Remove the privileged function macro. */ #define PRIVILEGED_FUNCTION diff --git a/FreeRTOS/Source/include/timers.h b/FreeRTOS/Source/include/timers.h index 4fc54cb4b..5942f629e 100644 --- a/FreeRTOS/Source/include/timers.h +++ b/FreeRTOS/Source/include/timers.h @@ -258,7 +258,7 @@ typedef void (*PendedFunction_t)( void *, uint32_t ); * * // Starting the scheduler will start the timers running as they have already * // been set into the active state. - * xTaskStartScheduler(); + * vTaskStartScheduler(); * * // Should not reach here. * for( ;; ); @@ -388,7 +388,7 @@ typedef void (*PendedFunction_t)( void *, uint32_t ); * * // Starting the scheduler will start the timers running as they have already * // been set into the active state. - * xTaskStartScheduler(); + * vTaskStartScheduler(); * * // Should not reach here. * for( ;; ); @@ -819,7 +819,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION; * * // Starting the scheduler will start the timer running as it has already * // been set into the active state. - * xTaskStartScheduler(); + * vTaskStartScheduler(); * * // Should not reach here. * for( ;; ); diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c index ad7e7d294..eaace142c 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c @@ -80,6 +80,9 @@ task.h is included from an application file. */ #include "FreeRTOS.h" #include "task.h" #include "queue.h" +#include "timers.h" +#include "event_groups.h" +#include "mpu_prototypes.h" #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -175,56 +178,6 @@ static void prvRestoreContextOfFirstTask( void ) __attribute__(( naked )) PRIVIL */ static void prvSVCHandler( uint32_t *pulRegisters ) __attribute__(( noinline )) PRIVILEGED_FUNCTION; -/* - * Prototypes for all the MPU wrappers. - */ -BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ); -BaseType_t MPU_xTaskCreate( TaskFunction_t pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask ); -void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const xRegions ); -void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete ); -void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TickType_t xTimeIncrement ); -void MPU_vTaskDelay( TickType_t xTicksToDelay ); -UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t pxTask ); -void MPU_vTaskPrioritySet( TaskHandle_t pxTask, UBaseType_t uxNewPriority ); -eTaskState MPU_eTaskGetState( TaskHandle_t pxTask ); -void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend ); -void MPU_vTaskResume( TaskHandle_t pxTaskToResume ); -void MPU_vTaskSuspendAll( void ); -BaseType_t MPU_xTaskResumeAll( void ); -TickType_t MPU_xTaskGetTickCount( void ); -UBaseType_t MPU_uxTaskGetNumberOfTasks( void ); -void MPU_vTaskList( char *pcWriteBuffer ); -void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer ); -void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxTagValue ); -TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ); -BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ); -UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ); -TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ); -BaseType_t MPU_xTaskGetSchedulerState( void ); -TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ); -UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t *pxTaskStatusArray, UBaseType_t uxArraySize, uint32_t *pulTotalRunTime ); -QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType ); -BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition ); -BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue, BaseType_t xNewQueue ); -UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue ); -BaseType_t MPU_xQueueGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ); -QueueHandle_t MPU_xQueueCreateMutex( void ); -QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount ); -BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime ); -BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex ); -void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName ); -void MPU_vQueueDelete( QueueHandle_t xQueue ); -void *MPU_pvPortMalloc( size_t xSize ); -void MPU_vPortFree( void *pv ); -void MPU_vPortInitialiseBlocks( void ); -size_t MPU_xPortGetFreeHeapSize( void ); -QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength ); -QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t xBlockTimeTicks ); -BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); -BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); -BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ); -void* MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ); - /*-----------------------------------------------------------*/ /* @@ -491,7 +444,7 @@ extern uint32_t __privileged_data_end__[]; if( *portMPU_TYPE == portEXPECTED_MPU_TYPE_VALUE ) { /* First setup the entire flash for unprivileged read only access. */ - *portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */ + *portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portUNPRIVILEGED_FLASH_REGION ); @@ -503,7 +456,7 @@ extern uint32_t __privileged_data_end__[]; /* Setup the first 16K for privileged only access (even though less than 10K is actually being used). This is where the kernel code is placed. */ - *portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */ + *portMPU_REGION_BASE_ADDRESS = ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portPRIVILEGED_FLASH_REGION ); @@ -596,7 +549,7 @@ uint32_t ul; if( xRegions == NULL ) { /* No MPU regions are specified so allow access to all RAM. */ - xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress = + xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress = ( ( uint32_t ) __SRAM_segment_start__ ) | /* Base address. */ ( portMPU_REGION_VALID ) | ( portSTACK_REGION ); @@ -691,15 +644,30 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); } /*-----------------------------------------------------------*/ -BaseType_t MPU_xTaskCreate( TaskFunction_t pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask ) -{ -BaseType_t xReturn; -BaseType_t xRunningPrivileged = prvRaisePrivilege(); +#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) + BaseType_t MPU_xTaskCreate( TaskFunction_t pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask ) + { + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); - xReturn = xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ); - portRESET_PRIVILEGE( xRunningPrivileged ); - return xReturn; -} + xReturn = xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif /* configSUPPORT_DYNAMIC_ALLOCATION */ +/*-----------------------------------------------------------*/ + +#if( configSUPPORT_STATIC_ALLOCATION == 1 ) + TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) + { + TaskHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif /* configSUPPORT_STATIC_ALLOCATION */ /*-----------------------------------------------------------*/ void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const xRegions ) @@ -714,10 +682,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( INCLUDE_vTaskDelete == 1 ) void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskDelete( pxTaskToDelete ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } #endif /*-----------------------------------------------------------*/ @@ -725,10 +693,23 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( INCLUDE_vTaskDelayUntil == 1 ) void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TickType_t xTimeIncrement ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); + } +#endif +/*-----------------------------------------------------------*/ + +#if ( INCLUDE_xTaskAbortDelay == 1 ) + BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) + { + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTaskAbortDelay( xTask ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; } #endif /*-----------------------------------------------------------*/ @@ -736,10 +717,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( INCLUDE_vTaskDelay == 1 ) void MPU_vTaskDelay( TickType_t xTicksToDelay ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskDelay( xTicksToDelay ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } #endif /*-----------------------------------------------------------*/ @@ -748,10 +729,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t pxTask ) { UBaseType_t uxReturn; - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); uxReturn = uxTaskPriorityGet( pxTask ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return uxReturn; } #endif @@ -760,10 +741,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( INCLUDE_vTaskPrioritySet == 1 ) void MPU_vTaskPrioritySet( TaskHandle_t pxTask, UBaseType_t uxNewPriority ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskPrioritySet( pxTask, uxNewPriority ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } #endif /*-----------------------------------------------------------*/ @@ -771,24 +752,35 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( INCLUDE_eTaskGetState == 1 ) eTaskState MPU_eTaskGetState( TaskHandle_t pxTask ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); eTaskState eReturn; eReturn = eTaskGetState( pxTask ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return eReturn; } #endif /*-----------------------------------------------------------*/ +#if( configUSE_TRACE_FACILITY == 1 ) + void MPU_vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ) + { + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + vTaskGetInfo( xTask, pxTaskStatus, xGetFreeStackSpace, eState ); + portRESET_PRIVILEGE( xRunningPrivileged ); + } +#endif +/*-----------------------------------------------------------*/ + #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) { TaskHandle_t xReturn; - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetIdleTaskHandle(); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return eReturn; } #endif @@ -797,10 +789,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( INCLUDE_vTaskSuspend == 1 ) void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskSuspend( pxTaskToSuspend ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } #endif /*-----------------------------------------------------------*/ @@ -808,10 +800,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( INCLUDE_vTaskSuspend == 1 ) void MPU_vTaskResume( TaskHandle_t pxTaskToResume ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskResume( pxTaskToResume ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } #endif /*-----------------------------------------------------------*/ @@ -821,7 +813,7 @@ void MPU_vTaskSuspendAll( void ) BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskSuspendAll(); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } /*-----------------------------------------------------------*/ @@ -831,8 +823,8 @@ BaseType_t xReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskResumeAll(); - portRESET_PRIVILEGE( xRunningPrivileged ); - return xReturn; + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -842,7 +834,7 @@ TickType_t xReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetTickCount(); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } /*-----------------------------------------------------------*/ @@ -853,11 +845,35 @@ UBaseType_t uxReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); uxReturn = uxTaskGetNumberOfTasks(); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return uxReturn; } /*-----------------------------------------------------------*/ +char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) +{ +char *pcReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + pcReturn = pcTaskGetName( xTaskToQuery ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return pcReturn; +} +/*-----------------------------------------------------------*/ + +#if ( INCLUDE_xTaskGetHandle == 1 ) + TaskHandle_t MPU_xTaskGetHandle( const char *pcNameToQuery ) + { + TaskHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTaskGetHandle( pcNameToQuery ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return pcReturn; + } +#endif +/*-----------------------------------------------------------*/ + #if ( configUSE_TRACE_FACILITY == 1 ) void MPU_vTaskList( char *pcWriteBuffer ) { @@ -872,10 +888,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( configGENERATE_RUN_TIME_STATS == 1 ) void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskGetRunTimeStats( pcWriteBuffer ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } #endif /*-----------------------------------------------------------*/ @@ -883,10 +899,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); #if ( configUSE_APPLICATION_TASK_TAG == 1 ) void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxTagValue ) { - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); vTaskSetApplicationTaskTag( xTask, pxTagValue ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); } #endif /*-----------------------------------------------------------*/ @@ -895,23 +911,47 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) { TaskHookFunction_t xReturn; - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetApplicationTaskTag( xTask ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } #endif /*-----------------------------------------------------------*/ +#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) + void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue ) + { + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue ); + portRESET_PRIVILEGE( xRunningPrivileged ); + } +#endif +/*-----------------------------------------------------------*/ + +#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) + void *MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex ) + { + void *pvReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + pvReturn = pvTaskGetThreadLocalStoragePointer( xTaskToQuery, xIndex ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return pvReturn; + } +#endif +/*-----------------------------------------------------------*/ + #if ( configUSE_APPLICATION_TASK_TAG == 1 ) BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) { BaseType_t xReturn; - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskCallApplicationTaskHook( xTask, pvParameter ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } #endif @@ -934,10 +974,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) { UBaseType_t uxReturn; - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); uxReturn = uxTaskGetStackHighWaterMark( xTask ); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return uxReturn; } #endif @@ -947,10 +987,10 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) { TaskHandle_t xReturn; - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetCurrentTaskHandle(); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } #endif @@ -960,26 +1000,100 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); BaseType_t MPU_xTaskGetSchedulerState( void ) { BaseType_t xReturn; - BaseType_t xRunningPrivileged = prvRaisePrivilege(); + BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetSchedulerState(); - portRESET_PRIVILEGE( xRunningPrivileged ); + portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } #endif /*-----------------------------------------------------------*/ -QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType ) +void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) +{ +BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + vTaskSetTimeOutState( pxTimeOut ); + portRESET_PRIVILEGE( xRunningPrivileged ); +} +/*-----------------------------------------------------------*/ + +BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) { -QueueHandle_t xReturn; +BaseType_t xReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); - xReturn = xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType ); + xReturn = xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait ); portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } /*-----------------------------------------------------------*/ +#if( configUSE_TASK_NOTIFICATIONS == 1 ) + BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue ) + { + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTaskGenericNotify( xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TASK_NOTIFICATIONS == 1 ) + BaseType_t MPU_xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) + { + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTaskNotifyWait( ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TASK_NOTIFICATIONS == 1 ) + uint32_t MPU_ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) + { + uint32_t ulReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + ulReturn = ulTaskNotifyTake( xClearCountOnExit, xTicksToWait ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return ulReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) + QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType ) + { + QueueHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configSUPPORT_STATIC_ALLOCATION == 1 ) + QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType ) + { + QueueHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xQueueGenericCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue, BaseType_t xNewQueue ) { BaseType_t xReturn; @@ -1013,6 +1127,17 @@ UBaseType_t uxReturn; } /*-----------------------------------------------------------*/ +UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) +{ +BaseType_t xRunningPrivileged = prvRaisePrivilege(); +UBaseType_t uxReturn; + + uxReturn = uxQueueSpacesAvailable( xQueue ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return uxReturn; +} +/*-----------------------------------------------------------*/ + BaseType_t MPU_xQueueGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking ) { BaseType_t xRunningPrivileged = prvRaisePrivilege(); @@ -1046,23 +1171,36 @@ void * xReturn; } /*-----------------------------------------------------------*/ -#if ( configUSE_MUTEXES == 1 ) - QueueHandle_t MPU_xQueueCreateMutex( void ) +#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) + QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) { - QueueHandle_t xReturn; + QueueHandle_t xReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); - xReturn = xQueueCreateMutex( queueQUEUE_TYPE_MUTEX ); + xReturn = xQueueCreateMutex( ucQueueType ); portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; } #endif /*-----------------------------------------------------------*/ -#if configUSE_COUNTING_SEMAPHORES == 1 +#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) + QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue ) + { + QueueHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xQueueCreateMutexStatic( ucQueueType, pxStaticQueue ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount ) { - QueueHandle_t xReturn; + QueueHandle_t xReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount ); @@ -1072,6 +1210,20 @@ void * xReturn; #endif /*-----------------------------------------------------------*/ +#if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) + + QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue ) + { + QueueHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + #if ( configUSE_MUTEXES == 1 ) BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime ) { @@ -1151,7 +1303,7 @@ void * xReturn; /*-----------------------------------------------------------*/ #if configQUEUE_REGISTRY_SIZE > 0 - void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, char *pcName ) + void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName ) { BaseType_t xRunningPrivileged = prvRaisePrivilege(); @@ -1162,6 +1314,32 @@ void * xReturn; #endif /*-----------------------------------------------------------*/ +#if configQUEUE_REGISTRY_SIZE > 0 + void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) + { + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + vQueueUnregisterQueue( xQueue ); + + portRESET_PRIVILEGE( xRunningPrivileged ); + } +#endif +/*-----------------------------------------------------------*/ + +#if configQUEUE_REGISTRY_SIZE > 0 + const char *MPU_pcQueueGetName( QueueHandle_t xQueue ) + { + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + const char *pcReturn; + + pcReturn = pcQueueGetName( xQueue ); + + portRESET_PRIVILEGE( xRunningPrivileged ); + return pcReturn; + } +#endif +/*-----------------------------------------------------------*/ + void MPU_vQueueDelete( QueueHandle_t xQueue ) { BaseType_t xRunningPrivileged = prvRaisePrivilege(); @@ -1224,6 +1402,247 @@ BaseType_t xRunningPrivileged = prvRaisePrivilege(); return xReturn; } +/*-----------------------------------------------------------*/ + +#if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) ) + TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction ) + { + TimerHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerCreate( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) ) + TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer ) + { + TimerHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + void *MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) + { + void * pvReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + pvReturn = pvTimerGetTimerID( xTimer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return pvReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + void MPU_vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID ) + { + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + vTimerSetTimerID( xTimer, pvNewID ); + portRESET_PRIVILEGE( xRunningPrivileged ); + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) + { + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerIsTimerActive( xTimer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) + { + TaskHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerGetTimerDaemonTaskHandle(); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) + BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ) + { + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerPendFunctionCall( xFunctionToPend, pvParameter1, ulParameter2, xTicksToWait ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) + { + const char * pcReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + pcReturn = pcTimerGetName( xTimer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return pcReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) + { + TickType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerGetPeriod( xTimer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) + { + TickType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerGetExpiryTime( xTimer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configUSE_TIMERS == 1 ) + BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) + { + BaseType_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xTimerGenericCommand( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) + EventGroupHandle_t MPU_xEventGroupCreate( void ) + { + EventGroupHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xEventGroupCreate(); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +#if( configSUPPORT_STATIC_ALLOCATION == 1 ) + EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer ) + { + EventGroupHandle_t xReturn; + BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xEventGroupCreateStatic( pxEventGroupBuffer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + +EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) +{ +EventBits_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) +{ +EventBits_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xEventGroupClearBits( xEventGroup, uxBitsToClear ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) +{ +EventBits_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xEventGroupSetBits( xEventGroup, uxBitsToSet ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ) +{ +EventBits_t xReturn; +BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + xReturn = xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait ); + portRESET_PRIVILEGE( xRunningPrivileged ); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) +{ +BaseType_t xRunningPrivileged = prvRaisePrivilege(); + + vEventGroupDelete( xEventGroup ); + portRESET_PRIVILEGE( xRunningPrivileged ); +} +/*-----------------------------------------------------------*/ + + + + /* Functions that the application writer wants to execute in privileged mode can be defined in application_defined_privileged_functions.h. The functions diff --git a/FreeRTOS/Source/portable/GCC/ARM_CR5/port.c b/FreeRTOS/Source/portable/GCC/ARM_CR5/port.c index b7eab92bd..bcbf34bac 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CR5/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CR5/port.c @@ -394,7 +394,7 @@ uint32_t ulAPSR, ulCycles = 8; /* 8 bits per byte. */ } } - /* Will only get here if xTaskStartScheduler() was called with the CPU in + /* Will only get here if vTaskStartScheduler() was called with the CPU in a non-privileged mode or the binary point register was not set to its lowest possible value. prvTaskExitError() is referenced to prevent a compiler warning about it being defined but not referenced in the case that the user diff --git a/FreeRTOS/Source/portable/GCC/ARM_CRx_No_GIC/port.c b/FreeRTOS/Source/portable/GCC/ARM_CRx_No_GIC/port.c index d11a03a01..9e96da799 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CRx_No_GIC/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CRx_No_GIC/port.c @@ -268,7 +268,7 @@ uint32_t ulAPSR; vPortRestoreTaskContext(); } - /* Will only get here if xTaskStartScheduler() was called with the CPU in + /* Will only get here if vTaskStartScheduler() was called with the CPU in a non-privileged mode or the binary point register was not set to its lowest possible value. prvTaskExitError() is referenced to prevent a compiler warning about it being defined but not referenced in the case that the user diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/port.c b/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/port.c index dbc5b60fd..e24aea10a 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/port.c @@ -254,7 +254,7 @@ uint32_t ulAPSR; vPortRestoreTaskContext(); } - /* Will only get here if xTaskStartScheduler() was called with the CPU in + /* Will only get here if vTaskStartScheduler() was called with the CPU in a non-privileged mode or the binary point register was not set to its lowest possible value. */ return 0; diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c index d39b22287..3cbae9f05 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c @@ -314,7 +314,7 @@ uint32_t ulAPSR; } } - /* Will only get here if xTaskStartScheduler() was called with the CPU in + /* Will only get here if vTaskStartScheduler() was called with the CPU in a non-privileged mode or the binary point register was not set to its lowest possible value. */ return 0; diff --git a/FreeRTOS/Source/portable/IAR/ARM_CRx_No_GIC/port.c b/FreeRTOS/Source/portable/IAR/ARM_CRx_No_GIC/port.c index 6bfa9af65..a95b5e79e 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CRx_No_GIC/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CRx_No_GIC/port.c @@ -265,7 +265,7 @@ uint32_t ulAPSR; vPortRestoreTaskContext(); } - /* Will only get here if xTaskStartScheduler() was called with the CPU in + /* Will only get here if vTaskStartScheduler() was called with the CPU in a non-privileged mode or the binary point register was not set to its lowest possible value. prvTaskExitError() is referenced to prevent a compiler warning about it being defined but not referenced in the case that the user diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port_asm.S b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port_asm.S index 5db0ca07e..0a76ca1b5 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port_asm.S +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port_asm.S @@ -72,7 +72,6 @@ #include "FreeRTOSConfig.h" #include "ISR_Support.h" - .extern pxCurrentTCB .extern vTaskSwitchContext .extern vPortIncrementTick