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)
This commit is contained in:
Richard Elberger 2026-06-24 09:35:20 -04:00
parent 294945fc99
commit f025e433e0
4 changed files with 84 additions and 36 deletions

View file

@ -1017,3 +1017,10 @@ XPSR
XRAM
xtal
XTENSA
ACLE
acle
APDA
APDB
REGEN
SSVE
SVCR

View file

@ -53,6 +53,10 @@
#define portSTACK_LIMIT_PADDING 0
#endif
#ifndef portSTRIP_ADDRESS_TAG
#define portSTRIP_ADDRESS_TAG( pxPointer ) ( pxPointer )
#endif
/* Stack overflow check is not straight forward to implement for MPU ports
* because of the following reasons:
* 1. The context is stored in TCB and as a result, pxTopOfStack member points
@ -106,7 +110,7 @@
const uint32_t * const pulStack = ( uint32_t * ) portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxStack ); \
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
\
if( ( portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxTopOfStack ) <= ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxStack ) + portSTACK_LIMIT_PADDING ) || \
if( ( portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxTopOfStack ) <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) || \
( pulStack[ 0 ] != ulCheckValue ) || \
( pulStack[ 1 ] != ulCheckValue ) || \
( pulStack[ 2 ] != ulCheckValue ) || \
@ -134,7 +138,7 @@
\
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
\
if( ( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \
if( ( portSTRIP_ADDRESS_TAG( pxCurrentTCB->pxTopOfStack ) >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \
( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) ) \
{ \
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \

View file

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

14
tasks.c
View file

@ -2011,11 +2011,21 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
#if ( portSTACK_GROWTH < 0 )
{
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxTopOfStack ) - ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxNewTCB->pxTopOfStack ) ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
/* portSTRIP_ADDRESS_TAG handles MTE-tagged pointers returned by
* pxPortInitialiseStack when configARMV9_MTE_STACK is enabled. */
#ifdef portSTRIP_ADDRESS_TAG
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( portSTRIP_ADDRESS_TAG( pxTopOfStack ) - portSTRIP_ADDRESS_TAG( pxNewTCB->pxTopOfStack ) ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
#else
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxTopOfStack - pxNewTCB->pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
#endif
}
#else /* portSTACK_GROWTH */
{
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxNewTCB->pxTopOfStack ) - ( StackType_t * ) portSTRIP_ADDRESS_TAG( pxTopOfStack ) ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
#ifdef portSTRIP_ADDRESS_TAG
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( portSTRIP_ADDRESS_TAG( pxNewTCB->pxTopOfStack ) - portSTRIP_ADDRESS_TAG( pxTopOfStack ) ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
#else
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxNewTCB->pxTopOfStack - pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
#endif
}
#endif /* portSTACK_GROWTH */
}