Skip to content

Commit 59b9ade

Browse files
authored
Merge branch 'main' into fix/rl78-port-far-param-init
2 parents dde270b + 692c4b0 commit 59b9ade

File tree

28 files changed

+562
-343
lines changed

28 files changed

+562
-343
lines changed

.github/scripts/kernel_checker.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@
114114
r'.*portable/.*/ARM_CM35*',
115115
r'.*portable/.*/ARM_CM55*',
116116
r'.*portable/.*/ARM_CM85*',
117+
r'.*portable/.*/ARM_CM0*',
118+
r'.*portable/.*/ARM_CM3_MPU*',
119+
r'.*portable/.*/ARM_CM4_MPU*',
120+
r'.*portable/.*/ARM_CM4F_MPU*',
117121
]
118122

119123
KERNEL_HEADER = [
@@ -150,8 +154,8 @@
150154
FREERTOS_COPYRIGHT_REGEX = r"^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$"
151155

152156
FREERTOS_ARM_COLLAB_COPYRIGHT_REGEX = r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$)|" + \
153-
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright 20\d\d Arm Limited and/or its affiliates( \*\/)?$)|" + \
154-
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? <[email protected]>( \*\/)?$)"
157+
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright 20\d\d(-20\d\d)? Arm Limited and/or its affiliates( +<open-source-office@arm\.com>)?( \*\/)?$)|" + \
158+
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? <open-source-office@arm\.com>( \*\/)?$)"
155159

156160

157161
class KernelHeaderChecker(HeaderChecker):

portable/ARMv8M/non_secure/port.c

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
33
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4-
* Copyright 2024 Arm Limited and/or its affiliates
4+
* Copyright 2024-2025 Arm Limited and/or its affiliates
55
66
*
77
* SPDX-License-Identifier: MIT
@@ -1200,7 +1200,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
12001200
extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ];
12011201
xMPU_SETTINGS * pxMpuSettings;
12021202
uint32_t * pulSystemCallStack;
1203-
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
1203+
uint32_t ulHardwareSavedExceptionFrameSize, ulSystemCallLocation, i;
12041204

12051205
#if defined( __ARMCC_VERSION )
12061206

@@ -1236,12 +1236,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
12361236
{
12371237
pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack;
12381238

1239+
/* Hardware Saved Stack Frame Size upon Exception entry:
1240+
* - No FPU: basic frame (R0-R3, R12, LR, PC, and xPSR) = 8 words.
1241+
* - With FPU (lazy stacking): basic frame + S0–S15 + FPSCR + reserved word = 26 words.
1242+
*/
12391243
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
12401244
{
12411245
if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL )
12421246
{
12431247
/* Extended frame i.e. FPU in use. */
1244-
ulStackFrameSize = 26;
1248+
ulHardwareSavedExceptionFrameSize = 26;
12451249
__asm volatile (
12461250
" vpush {s0} \n" /* Trigger lazy stacking. */
12471251
" vpop {s0} \n" /* Nullify the affect of the above instruction. */
@@ -1251,20 +1255,20 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
12511255
else
12521256
{
12531257
/* Standard frame i.e. FPU not in use. */
1254-
ulStackFrameSize = 8;
1258+
ulHardwareSavedExceptionFrameSize = 8;
12551259
}
12561260
}
12571261
#else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
12581262
{
1259-
ulStackFrameSize = 8;
1263+
ulHardwareSavedExceptionFrameSize = 8;
12601264
}
12611265
#endif /* configENABLE_FPU || configENABLE_MVE */
12621266

12631267
/* Make space on the system call stack for the stack frame. */
1264-
pulSystemCallStack = pulSystemCallStack - ulStackFrameSize;
1268+
pulSystemCallStack = pulSystemCallStack - ulHardwareSavedExceptionFrameSize;
12651269

12661270
/* Copy the stack frame. */
1267-
for( i = 0; i < ulStackFrameSize; i++ )
1271+
for( i = 0; i < ulHardwareSavedExceptionFrameSize; i++ )
12681272
{
12691273
pulSystemCallStack[ i ] = pulTaskStack[ i ];
12701274
}
@@ -1300,7 +1304,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13001304

13011305
/* Remember the location where we should copy the stack frame when we exit from
13021306
* the system call. */
1303-
pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize;
1307+
pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulHardwareSavedExceptionFrameSize;
13041308

13051309
/* Record if the hardware used padding to force the stack pointer
13061310
* to be double word aligned. */
@@ -1350,7 +1354,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13501354
extern TaskHandle_t pxCurrentTCB;
13511355
xMPU_SETTINGS * pxMpuSettings;
13521356
uint32_t * pulTaskStack;
1353-
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
1357+
uint32_t ulHardwareSavedExceptionFrameSize, ulSystemCallLocation, i;
13541358

13551359
#if defined( __ARMCC_VERSION )
13561360

@@ -1382,12 +1386,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13821386
{
13831387
pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack;
13841388

1389+
/* Hardware Saved Stack Frame Size upon Exception entry:
1390+
* - No FPU: basic frame (R0-R3, R12, LR, PC, and xPSR) = 8 words.
1391+
* - With FPU (lazy stacking): basic frame + S0–S15 + FPSCR + reserved word = 26 words.
1392+
*/
13851393
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
13861394
{
13871395
if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL )
13881396
{
13891397
/* Extended frame i.e. FPU in use. */
1390-
ulStackFrameSize = 26;
1398+
ulHardwareSavedExceptionFrameSize = 26;
13911399
__asm volatile (
13921400
" vpush {s0} \n" /* Trigger lazy stacking. */
13931401
" vpop {s0} \n" /* Nullify the affect of the above instruction. */
@@ -1397,20 +1405,20 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13971405
else
13981406
{
13991407
/* Standard frame i.e. FPU not in use. */
1400-
ulStackFrameSize = 8;
1408+
ulHardwareSavedExceptionFrameSize = 8;
14011409
}
14021410
}
14031411
#else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
14041412
{
1405-
ulStackFrameSize = 8;
1413+
ulHardwareSavedExceptionFrameSize = 8;
14061414
}
14071415
#endif /* configENABLE_FPU || configENABLE_MVE */
14081416

14091417
/* Make space on the task stack for the stack frame. */
1410-
pulTaskStack = pulTaskStack - ulStackFrameSize;
1418+
pulTaskStack = pulTaskStack - ulHardwareSavedExceptionFrameSize;
14111419

14121420
/* Copy the stack frame. */
1413-
for( i = 0; i < ulStackFrameSize; i++ )
1421+
for( i = 0; i < ulHardwareSavedExceptionFrameSize; i++ )
14141422
{
14151423
pulTaskStack[ i ] = pulSystemCallStack[ i ];
14161424
}

portable/GCC/ARM_CM0/port.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
33
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
* Copyright 2025 Arm Limited and/or its affiliates
5+
46
*
57
* SPDX-License-Identifier: MIT
68
*
@@ -915,7 +917,10 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
915917
xMPU_SETTINGS * pxMpuSettings;
916918
uint32_t * pulSystemCallStack;
917919
uint32_t ulSystemCallLocation, i;
918-
const uint32_t ulStackFrameSize = 8;
920+
/* Hardware Saved Stack Frame Size upon Exception entry:
921+
* Basic frame (R0-R3, R12, LR, PC, and xPSR) = 8 words.
922+
*/
923+
const uint32_t ulHardwareSavedExceptionFrameSize = 8;
919924

920925
#if defined( __ARMCC_VERSION )
921926

@@ -955,10 +960,10 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
955960
pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack;
956961

957962
/* Make space on the system call stack for the stack frame. */
958-
pulSystemCallStack = pulSystemCallStack - ulStackFrameSize;
963+
pulSystemCallStack = pulSystemCallStack - ulHardwareSavedExceptionFrameSize;
959964

960965
/* Copy the stack frame. */
961-
for( i = 0; i < ulStackFrameSize; i++ )
966+
for( i = 0; i < ulHardwareSavedExceptionFrameSize; i++ )
962967
{
963968
pulSystemCallStack[ i ] = pulTaskStack[ i ];
964969
}
@@ -981,7 +986,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
981986

982987
/* Remember the location where we should copy the stack frame when we exit from
983988
* the system call. */
984-
pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize;
989+
pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulHardwareSavedExceptionFrameSize;
985990

986991
/* Record if the hardware used padding to force the stack pointer
987992
* to be double word aligned. */
@@ -1036,7 +1041,10 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
10361041
xMPU_SETTINGS * pxMpuSettings;
10371042
uint32_t * pulTaskStack;
10381043
uint32_t ulSystemCallLocation, i;
1039-
const uint32_t ulStackFrameSize = 8;
1044+
/* Hardware Saved Stack Frame Size upon Exception entry:
1045+
* Basic frame (R0-R3, R12, LR, PC, and xPSR) = 8 words.
1046+
*/
1047+
const uint32_t ulHardwareSavedExceptionFrameSize = 8;
10401048

10411049
#if defined( __ARMCC_VERSION )
10421050

@@ -1072,10 +1080,10 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
10721080
pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack;
10731081

10741082
/* Make space on the task stack for the stack frame. */
1075-
pulTaskStack = pulTaskStack - ulStackFrameSize;
1083+
pulTaskStack = pulTaskStack - ulHardwareSavedExceptionFrameSize;
10761084

10771085
/* Copy the stack frame. */
1078-
for( i = 0; i < ulStackFrameSize; i++ )
1086+
for( i = 0; i < ulHardwareSavedExceptionFrameSize; i++ )
10791087
{
10801088
pulTaskStack[ i ] = pulSystemCallStack[ i ];
10811089
}

portable/GCC/ARM_CM23/non_secure/port.c

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
33
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4-
* Copyright 2024 Arm Limited and/or its affiliates
4+
* Copyright 2024-2025 Arm Limited and/or its affiliates
55
66
*
77
* SPDX-License-Identifier: MIT
@@ -1200,7 +1200,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
12001200
extern UBaseType_t uxSystemCallImplementations[ NUM_SYSTEM_CALLS ];
12011201
xMPU_SETTINGS * pxMpuSettings;
12021202
uint32_t * pulSystemCallStack;
1203-
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
1203+
uint32_t ulHardwareSavedExceptionFrameSize, ulSystemCallLocation, i;
12041204

12051205
#if defined( __ARMCC_VERSION )
12061206

@@ -1236,12 +1236,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
12361236
{
12371237
pulSystemCallStack = pxMpuSettings->xSystemCallStackInfo.pulSystemCallStack;
12381238

1239+
/* Hardware Saved Stack Frame Size upon Exception entry:
1240+
* - No FPU: basic frame (R0-R3, R12, LR, PC, and xPSR) = 8 words.
1241+
* - With FPU (lazy stacking): basic frame + S0–S15 + FPSCR + reserved word = 26 words.
1242+
*/
12391243
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
12401244
{
12411245
if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL )
12421246
{
12431247
/* Extended frame i.e. FPU in use. */
1244-
ulStackFrameSize = 26;
1248+
ulHardwareSavedExceptionFrameSize = 26;
12451249
__asm volatile (
12461250
" vpush {s0} \n" /* Trigger lazy stacking. */
12471251
" vpop {s0} \n" /* Nullify the affect of the above instruction. */
@@ -1251,20 +1255,20 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
12511255
else
12521256
{
12531257
/* Standard frame i.e. FPU not in use. */
1254-
ulStackFrameSize = 8;
1258+
ulHardwareSavedExceptionFrameSize = 8;
12551259
}
12561260
}
12571261
#else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
12581262
{
1259-
ulStackFrameSize = 8;
1263+
ulHardwareSavedExceptionFrameSize = 8;
12601264
}
12611265
#endif /* configENABLE_FPU || configENABLE_MVE */
12621266

12631267
/* Make space on the system call stack for the stack frame. */
1264-
pulSystemCallStack = pulSystemCallStack - ulStackFrameSize;
1268+
pulSystemCallStack = pulSystemCallStack - ulHardwareSavedExceptionFrameSize;
12651269

12661270
/* Copy the stack frame. */
1267-
for( i = 0; i < ulStackFrameSize; i++ )
1271+
for( i = 0; i < ulHardwareSavedExceptionFrameSize; i++ )
12681272
{
12691273
pulSystemCallStack[ i ] = pulTaskStack[ i ];
12701274
}
@@ -1300,7 +1304,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13001304

13011305
/* Remember the location where we should copy the stack frame when we exit from
13021306
* the system call. */
1303-
pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulStackFrameSize;
1307+
pxMpuSettings->xSystemCallStackInfo.pulTaskStack = pulTaskStack + ulHardwareSavedExceptionFrameSize;
13041308

13051309
/* Record if the hardware used padding to force the stack pointer
13061310
* to be double word aligned. */
@@ -1350,7 +1354,7 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13501354
extern TaskHandle_t pxCurrentTCB;
13511355
xMPU_SETTINGS * pxMpuSettings;
13521356
uint32_t * pulTaskStack;
1353-
uint32_t ulStackFrameSize, ulSystemCallLocation, i;
1357+
uint32_t ulHardwareSavedExceptionFrameSize, ulSystemCallLocation, i;
13541358

13551359
#if defined( __ARMCC_VERSION )
13561360

@@ -1382,12 +1386,16 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13821386
{
13831387
pulTaskStack = pxMpuSettings->xSystemCallStackInfo.pulTaskStack;
13841388

1389+
/* Hardware Saved Stack Frame Size upon Exception entry:
1390+
* - No FPU: basic frame (R0-R3, R12, LR, PC, and xPSR) = 8 words.
1391+
* - With FPU (lazy stacking): basic frame + S0–S15 + FPSCR + reserved word = 26 words.
1392+
*/
13851393
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
13861394
{
13871395
if( ( ulLR & portEXC_RETURN_STACK_FRAME_TYPE_MASK ) == 0UL )
13881396
{
13891397
/* Extended frame i.e. FPU in use. */
1390-
ulStackFrameSize = 26;
1398+
ulHardwareSavedExceptionFrameSize = 26;
13911399
__asm volatile (
13921400
" vpush {s0} \n" /* Trigger lazy stacking. */
13931401
" vpop {s0} \n" /* Nullify the affect of the above instruction. */
@@ -1397,20 +1405,20 @@ void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) /* PRIVILEGED_FUNCTIO
13971405
else
13981406
{
13991407
/* Standard frame i.e. FPU not in use. */
1400-
ulStackFrameSize = 8;
1408+
ulHardwareSavedExceptionFrameSize = 8;
14011409
}
14021410
}
14031411
#else /* if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
14041412
{
1405-
ulStackFrameSize = 8;
1413+
ulHardwareSavedExceptionFrameSize = 8;
14061414
}
14071415
#endif /* configENABLE_FPU || configENABLE_MVE */
14081416

14091417
/* Make space on the task stack for the stack frame. */
1410-
pulTaskStack = pulTaskStack - ulStackFrameSize;
1418+
pulTaskStack = pulTaskStack - ulHardwareSavedExceptionFrameSize;
14111419

14121420
/* Copy the stack frame. */
1413-
for( i = 0; i < ulStackFrameSize; i++ )
1421+
for( i = 0; i < ulHardwareSavedExceptionFrameSize; i++ )
14141422
{
14151423
pulTaskStack[ i ] = pulSystemCallStack[ i ];
14161424
}

0 commit comments

Comments
 (0)