Skip to content

Commit bdba8a9

Browse files
committed
armv9: fix CI checks (spelling, header, unit test, formatting)
- tasks.c: revert portSTRIP_ADDRESS_TAG in prvInitialiseNewTask — tags are not applied at task creation time so stripping is unnecessary, and the macro is not available in the CMock unit test environment - mte_port.c: add standard FreeRTOS MIT license header - include/stack_macros.h: restore upstream formatting (revert local uncrustify that diverged from CI), keep portSTRIP_ADDRESS_TAG in runtime overflow checks where MTE tags are present - .github/.cSpellWords.txt: add ARM architecture terms (ACLE, APDA, APDB, REGEN, SSVE, SVCR)
1 parent 294945f commit bdba8a9

4 files changed

Lines changed: 40 additions & 6 deletions

File tree

.github/.cSpellWords.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,3 +1017,10 @@ XPSR
10171017
XRAM
10181018
xtal
10191019
XTENSA
1020+
ACLE
1021+
acle
1022+
APDA
1023+
APDB
1024+
REGEN
1025+
SSVE
1026+
SVCR

include/stack_macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@
103103
#define taskCHECK_FOR_STACK_OVERFLOW() \
104104
do \
105105
{ \
106-
const uint32_t * const pulStack = ( uint32_t * ) portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxStack ); \
106+
const uint32_t * const pulStack = ( uint32_t * ) portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxStack ); \
107107
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
108108
\
109-
if( ( portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxTopOfStack ) <= ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxStack ) + portSTACK_LIMIT_PADDING ) || \
109+
if( ( portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxTopOfStack ) <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) || \
110110
( pulStack[ 0 ] != ulCheckValue ) || \
111111
( pulStack[ 1 ] != ulCheckValue ) || \
112112
( pulStack[ 2 ] != ulCheckValue ) || \
@@ -134,7 +134,7 @@
134134
\
135135
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
136136
\
137-
if( ( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \
137+
if( ( portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxTopOfStack ) >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \
138138
( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) ) \
139139
{ \
140140
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \

portable/GCC/ARM_AARCH64_ARMV9/mte_port.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
1+
/*
2+
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
3+
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* SPDX-License-Identifier: MIT
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
8+
* this software and associated documentation files (the "Software"), to deal in
9+
* the Software without restriction, including without limitation the rights to
10+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11+
* the Software, and to permit persons to whom the Software is furnished to do so,
12+
* subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
*
24+
* https://www.FreeRTOS.org
25+
* https://github.com/FreeRTOS
26+
*
27+
*/
28+
129
/*
230
* mte_port.c — MTE heap wrapper and stack tagging for FreeRTOS Armv9 port.
331
*
432
* Uses ARM ACLE intrinsics (arm_acle.h) for MISRA C:2012 compliance.
5-
* No pointer-to-integer casts required.
633
*
734
* configARMV9_MTE_HEAP: wraps pvPortMalloc/vPortFree with IRG/STG tagging
835
* configARMV9_MTE_STACK: tags task stack memory on creation

tasks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,11 +2011,11 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
20112011

20122012
#if ( portSTACK_GROWTH < 0 )
20132013
{
2014-
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxTopOfStack ) - ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxNewTCB->pxTopOfStack ) ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
2014+
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxTopOfStack - pxNewTCB->pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
20152015
}
20162016
#else /* portSTACK_GROWTH */
20172017
{
2018-
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxNewTCB->pxTopOfStack ) - ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxTopOfStack ) ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
2018+
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxNewTCB->pxTopOfStack - pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
20192019
}
20202020
#endif /* portSTACK_GROWTH */
20212021
}

0 commit comments

Comments
 (0)