Skip to content

Commit

Permalink
Update MPU wrapper for pcTaskGetName API (#737)
Browse files Browse the repository at this point in the history
* Update MPU wrapper for pcTaskGetName

* Fix Formatting

* Fix mpu wrappers V1

---------

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
  • Loading branch information
kar-rahul-aws and aggarg authored Aug 4, 2023
1 parent a5bf4d9 commit 02be485
Show file tree
Hide file tree
Showing 36 changed files with 31 additions and 851 deletions.
2 changes: 1 addition & 1 deletion include/mpu_prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL;
void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL;
TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL;
UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL;
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) FREERTOS_SYSTEM_CALL;
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask,
Expand Down Expand Up @@ -118,6 +117,7 @@ void MPU_vTaskPrioritySet( TaskHandle_t xTask,
TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
void * pvParameter ) PRIVILEGED_FUNCTION;
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
Expand Down
2 changes: 1 addition & 1 deletion include/mpu_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#define vTaskResume MPU_vTaskResume
#define xTaskGetTickCount MPU_xTaskGetTickCount
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
#define pcTaskGetName MPU_pcTaskGetName
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
Expand Down Expand Up @@ -94,6 +93,7 @@
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook

#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define pcTaskGetName MPU_pcTaskGetName
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
#define xTaskCreateRestrictedStatic MPU_xTaskCreateRestrictedStatic
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,35 +407,6 @@ UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* __attribute__ (( naked )) FREE
}
/*-----------------------------------------------------------*/

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_pcTaskGetNameImpl \n"
" \n"
" push {r0, r1} \n"
" mrs r0, control \n"
" movs r1, #1 \n"
" tst r0, r1 \n"
" bne MPU_pcTaskGetName_Unpriv \n"
" MPU_pcTaskGetName_Priv: \n"
" pop {r0, r1} \n"
" b MPU_pcTaskGetNameImpl \n"
" MPU_pcTaskGetName_Unpriv: \n"
" pop {r0, r1} \n"
" svc %0 \n"
" bl MPU_pcTaskGetNameImpl \n"
" svc %1 \n"
" bx lr \n"
" \n"
: : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory"
);
}
/*-----------------------------------------------------------*/

#if ( configGENERATE_RUN_TIME_STATS == 1 )

configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,35 +407,6 @@ UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* __attribute__ (( naked )) FREE
}
/*-----------------------------------------------------------*/

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_pcTaskGetNameImpl \n"
" \n"
" push {r0, r1} \n"
" mrs r0, control \n"
" movs r1, #1 \n"
" tst r0, r1 \n"
" bne MPU_pcTaskGetName_Unpriv \n"
" MPU_pcTaskGetName_Priv: \n"
" pop {r0, r1} \n"
" b MPU_pcTaskGetNameImpl \n"
" MPU_pcTaskGetName_Unpriv: \n"
" pop {r0, r1} \n"
" svc %0 \n"
" bl MPU_pcTaskGetNameImpl \n"
" svc %1 \n"
" bx lr \n"
" \n"
: : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory"
);
}
/*-----------------------------------------------------------*/

#if ( configGENERATE_RUN_TIME_STATS == 1 )

configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,34 +396,6 @@ UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* __attribute__ (( naked )) FREE
}
/*-----------------------------------------------------------*/

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_pcTaskGetNameImpl \n"
" \n"
" push {r0} \n"
" mrs r0, control \n"
" tst r0, #1 \n"
" bne MPU_pcTaskGetName_Unpriv \n"
" MPU_pcTaskGetName_Priv: \n"
" pop {r0} \n"
" b MPU_pcTaskGetNameImpl \n"
" MPU_pcTaskGetName_Unpriv: \n"
" pop {r0} \n"
" svc %0 \n"
" bl MPU_pcTaskGetNameImpl \n"
" svc %1 \n"
" bx lr \n"
" \n"
: : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory"
);
}
/*-----------------------------------------------------------*/

#if ( configGENERATE_RUN_TIME_STATS == 1 )

configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,34 +396,6 @@ UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* __attribute__ (( naked )) FREE
}
/*-----------------------------------------------------------*/

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_pcTaskGetNameImpl \n"
" \n"
" push {r0} \n"
" mrs r0, control \n"
" tst r0, #1 \n"
" bne MPU_pcTaskGetName_Unpriv \n"
" MPU_pcTaskGetName_Priv: \n"
" pop {r0} \n"
" b MPU_pcTaskGetNameImpl \n"
" MPU_pcTaskGetName_Unpriv: \n"
" pop {r0} \n"
" svc %0 \n"
" bl MPU_pcTaskGetNameImpl \n"
" svc %1 \n"
" bx lr \n"
" \n"
: : "i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory"
);
}
/*-----------------------------------------------------------*/

#if ( configGENERATE_RUN_TIME_STATS == 1 )

configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,6 @@ MPU_uxTaskGetNumberOfTasks:
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_pcTaskGetName
MPU_pcTaskGetName:
push {r0, r1}
mrs r0, control
movs r1, #1
tst r0, r1
bne MPU_pcTaskGetName_Unpriv
MPU_pcTaskGetName_Priv:
pop {r0, r1}
b MPU_pcTaskGetNameImpl
MPU_pcTaskGetName_Unpriv:
pop {r0, r1}
svc #portSVC_SYSTEM_CALL_ENTER
bl MPU_pcTaskGetNameImpl
svc #portSVC_SYSTEM_CALL_EXIT
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_ulTaskGetRunTimeCounter
MPU_ulTaskGetRunTimeCounter:
push {r0, r1}
Expand Down Expand Up @@ -1370,10 +1352,6 @@ MPU_xTaskGetTickCountImpl:
MPU_uxTaskGetNumberOfTasksImpl:
b MPU_uxTaskGetNumberOfTasksImpl

PUBWEAK MPU_pcTaskGetNameImpl
MPU_pcTaskGetNameImpl:
b MPU_pcTaskGetNameImpl

PUBWEAK MPU_ulTaskGetRunTimeCounterImpl
MPU_ulTaskGetRunTimeCounterImpl:
b MPU_ulTaskGetRunTimeCounterImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,6 @@ MPU_uxTaskGetNumberOfTasks:
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_pcTaskGetName
MPU_pcTaskGetName:
push {r0, r1}
mrs r0, control
movs r1, #1
tst r0, r1
bne MPU_pcTaskGetName_Unpriv
MPU_pcTaskGetName_Priv:
pop {r0, r1}
b MPU_pcTaskGetNameImpl
MPU_pcTaskGetName_Unpriv:
pop {r0, r1}
svc #portSVC_SYSTEM_CALL_ENTER
bl MPU_pcTaskGetNameImpl
svc #portSVC_SYSTEM_CALL_EXIT
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_ulTaskGetRunTimeCounter
MPU_ulTaskGetRunTimeCounter:
push {r0, r1}
Expand Down Expand Up @@ -1370,10 +1352,6 @@ MPU_xTaskGetTickCountImpl:
MPU_uxTaskGetNumberOfTasksImpl:
b MPU_uxTaskGetNumberOfTasksImpl

PUBWEAK MPU_pcTaskGetNameImpl
MPU_pcTaskGetNameImpl:
b MPU_pcTaskGetNameImpl

PUBWEAK MPU_ulTaskGetRunTimeCounterImpl
MPU_ulTaskGetRunTimeCounterImpl:
b MPU_ulTaskGetRunTimeCounterImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,6 @@ MPU_uxTaskGetNumberOfTasks:
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_pcTaskGetName
MPU_pcTaskGetName:
push {r0}
mrs r0, control
tst r0, #1
bne MPU_pcTaskGetName_Unpriv
MPU_pcTaskGetName_Priv:
pop {r0}
b MPU_pcTaskGetNameImpl
MPU_pcTaskGetName_Unpriv:
pop {r0}
svc #portSVC_SYSTEM_CALL_ENTER
bl MPU_pcTaskGetNameImpl
svc #portSVC_SYSTEM_CALL_EXIT
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_ulTaskGetRunTimeCounter
MPU_ulTaskGetRunTimeCounter:
push {r0}
Expand Down Expand Up @@ -1299,10 +1282,6 @@ MPU_xTaskGetTickCountImpl:
MPU_uxTaskGetNumberOfTasksImpl:
b MPU_uxTaskGetNumberOfTasksImpl

PUBWEAK MPU_pcTaskGetNameImpl
MPU_pcTaskGetNameImpl:
b MPU_pcTaskGetNameImpl

PUBWEAK MPU_ulTaskGetRunTimeCounterImpl
MPU_ulTaskGetRunTimeCounterImpl:
b MPU_ulTaskGetRunTimeCounterImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,6 @@ MPU_uxTaskGetNumberOfTasks:
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_pcTaskGetName
MPU_pcTaskGetName:
push {r0}
mrs r0, control
tst r0, #1
bne MPU_pcTaskGetName_Unpriv
MPU_pcTaskGetName_Priv:
pop {r0}
b MPU_pcTaskGetNameImpl
MPU_pcTaskGetName_Unpriv:
pop {r0}
svc #portSVC_SYSTEM_CALL_ENTER
bl MPU_pcTaskGetNameImpl
svc #portSVC_SYSTEM_CALL_EXIT
bx lr
/*-----------------------------------------------------------*/

PUBLIC MPU_ulTaskGetRunTimeCounter
MPU_ulTaskGetRunTimeCounter:
push {r0}
Expand Down Expand Up @@ -1299,10 +1282,6 @@ MPU_xTaskGetTickCountImpl:
MPU_uxTaskGetNumberOfTasksImpl:
b MPU_uxTaskGetNumberOfTasksImpl

PUBWEAK MPU_pcTaskGetNameImpl
MPU_pcTaskGetNameImpl:
b MPU_pcTaskGetNameImpl

PUBWEAK MPU_ulTaskGetRunTimeCounterImpl
MPU_ulTaskGetRunTimeCounterImpl:
b MPU_ulTaskGetRunTimeCounterImpl
Expand Down
24 changes: 0 additions & 24 deletions portable/Common/mpu_wrappers.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,30 +477,6 @@
}
/*-----------------------------------------------------------*/

char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) /* FREERTOS_SYSTEM_CALL */
{
char * pcReturn;

if( portIS_PRIVILEGED() == pdFALSE )
{
portRAISE_PRIVILEGE();
portMEMORY_BARRIER();

pcReturn = pcTaskGetName( xTaskToQuery );
portMEMORY_BARRIER();

portRESET_PRIVILEGE();
portMEMORY_BARRIER();
}
else
{
pcReturn = pcTaskGetName( xTaskToQuery );
}

return pcReturn;
}
/*-----------------------------------------------------------*/

#if ( INCLUDE_xTaskGetHandle == 1 )
TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) /* FREERTOS_SYSTEM_CALL */
{
Expand Down
Loading

0 comments on commit 02be485

Please sign in to comment.