Merge branch 'fix/freertos_riscv_px_end_of_stack_alignment_v6.0' into 'release/v6.0'

fix(freertos): fix riscv pxEndOfStack offset alignment (v6.0)

See merge request espressif/esp-idf!46535
This commit is contained in:
Marius Vikhammer
2026-03-25 16:13:15 +08:00
3 changed files with 25 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,6 +7,7 @@
#pragma once
#include "sdkconfig.h"
#include "freertos/FreeRTOSConfig.h"
/* Macros used instead ofsetoff() for better performance of interrupt handler */
#if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES
@@ -27,10 +28,27 @@ uxPriority (4)
#define PORT_OFFSET_PX_STACK 0x30
#endif /* #if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES */
#if ( configNUMBER_OF_CORES > 1 )
#define PORT_TCB_CORE_FIELDS_SIZE 8
#else
#define PORT_TCB_CORE_FIELDS_SIZE 0
#endif
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
#define PORT_TCB_PREEMPT_DISABLE_FIELD_SIZE 4
#else
#define PORT_TCB_PREEMPT_DISABLE_FIELD_SIZE 0
#endif
/* Align the value up to the nearest multiple of 4 */
#define PORT_ALIGN_UP_TO_4(value) (((value) + 3) & ~3)
#define PORT_OFFSET_PX_END_OF_STACK ( \
PORT_OFFSET_PX_STACK \
+ 4 /* StackType_t * pxStack */ \
+ CONFIG_FREERTOS_MAX_TASK_NAME_LEN /* pcTaskName[ configMAX_TASK_NAME_LEN ] */ \
+ PORT_TCB_CORE_FIELDS_SIZE /* BaseType_t xDummy23 + UBaseType_t uxDummy24 */ \
+ PORT_ALIGN_UP_TO_4(configMAX_TASK_NAME_LEN) /* pcTaskName[ configMAX_TASK_NAME_LEN ] */ \
+ PORT_TCB_PREEMPT_DISABLE_FIELD_SIZE /* BaseType_t xDummy25 */ \
)
#ifndef __ASSEMBLER__
@@ -49,10 +49,13 @@
#define CORE_ID_SIZE 4
#endif
/* Align the value up to the nearest multiple of 4 */
#define PORT_ALIGN_UP_TO_4(value) (((value) + 3) & ~3)
#define PORT_OFFSET_PX_END_OF_STACK ( \
PORT_OFFSET_PX_STACK \
+ 4 /* void * pxDummy6 */ \
+ CONFIG_FREERTOS_MAX_TASK_NAME_LEN /* uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ] */ \
+ PORT_ALIGN_UP_TO_4(configMAX_TASK_NAME_LEN) /* uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ] */ \
+ CORE_ID_SIZE /* BaseType_t xDummyCoreID */ \
)
@@ -6,3 +6,4 @@ CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=7
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3000
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_FREERTOS_MAX_TASK_NAME_LEN=17