[BUG] Undefined stack protection symbols in MicroBlaze portasm.S

Abierto
#1,416 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

@furkanyilmazgtb ya está trabajando en esto.

Desde el 12/5/2026.

  • #1417 de @furkanyilmazgtb — abierto
  • #1442 de @Old-Ding — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c

Línea de trabajo

Start with the offset and context-size definitions near the top of portable/portasm.S in the MicroBlaze port, and check how portSLR_OFFSET, portSHR_OFFSET and portCONTEXT_SIZE are used by the save and restore macros. Two open pull requests (#1417 and #1442) already target this, so read them before writing anything new. Done means the assembly builds with XPAR_MICROBLAZE_USE_STACK_PROTECTION across the FPU on/off and __arch64__ combinations, with the offsets consistent in each.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Describe the bug
In the MicroBlazeV9 FreeRTOS port, enabling XPAR_MICROBLAZE_USE_STACK_PROTECTION requires portSLR_OFFSET and portSHR_OFFSET to be part of the saved task context layout. In portable/portasm.S, these offsets were used in save/restore macros but were not fully integrated with context size/offset definitions, which can lead to undefined-symbol assembler errors or task-context layout mismatch depending on configuration.

This fix integrates stack-protection offsets into context-size definitions for both 32-bit and __arch64__ builds, and aligns portCONTEXT_SIZE / portMINUS_CONTEXT_SIZE with optional FPU + stack-protection fields.

Target

  • Development board: [MicroBlaze-based custom board]
  • Instruction Set Architecture: [MicroBlaze 32-bit (primary), MicroBlaze 64-bit path also updated]
  • IDE and version: [Vitis / XSCT based flow - 2023.2 Classics]
  • Toolchain and version: [mb-gcc ]

Host

  • Host OS: [Windows 11 Pro 25H2]

To Reproduce

  • Use FreeRTOS v11.3.0 MicroBlaze port with XPAR_MICROBLAZE_USE_STACK_PROTECTION enabled.
  • Build portable/portasm.S path with different combinations of:
    • XPAR_MICROBLAZE_USE_FPU = 0/1
    • __arch64__ defined/undefined

Expected behavior
When stack protection is enabled, SLR/SHR registers must have valid context offsets and context frame size must include these fields consistently for all relevant config combinations (32-bit/64-bit, FPU on/off). Save and restore paths should be layout-compatible and stable.

Screenshots

Image Image

Additional context
Patch summary applied in portable/portasm.S:

  • Added conditional stack-protection offsets and adjusted context size in the same definition block:
    • 32-bit + FPU: portFSR_OFFSET=132, portSLR_OFFSET=136, portSHR_OFFSET=140, portCONTEXT_SIZE=144
    • 32-bit no FPU: portSLR_OFFSET=132, portSHR_OFFSET=136, portCONTEXT_SIZE=140
    • 64-bit + FPU: portFSR_OFFSET=264, portSLR_OFFSET=272, portSHR_OFFSET=280, portCONTEXT_SIZE=288
    • 64-bit no FPU: portSLR_OFFSET=264, portSHR_OFFSET=272, portCONTEXT_SIZE=280
  • Removed duplicate portFSR_OFFSET define in offset section to avoid macro redefinition/confusion.

Link to issue post: https://forums.freertos.org/t/microblaze-compilation-error-when-upgrading-to-freertos-v11-3-0/24994

Lenguaje dominante
C
Estrellas
4.6k
Forks
1.6k
Merge medio
2 d 22 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de FreeRTOS/FreeRTOS-Kernel

Todos los issues de FreeRTOS/FreeRTOS-Kernel

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.