This is an automated email from Gerrit.

"Mateus Campaner Hercules <mchercu...@gmail.com>" just uploaded a new patch set 
to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7479

-- gerrit

commit 25952e3db892fc0e2a95e4f3e7657bec81909659
Author: Mateus Campaner Hercules <mchercu...@gmail.com>
Date:   Wed Feb 15 13:25:48 2023 -0300

    Update FreeRTOS's thread stack model decision tree.
    
    Adds provision to reading a thread stack from a target using
    a MPU with or without FPU.
    
    Signed-off-by: Mateus Campaner Hercules <mchercu...@gmail.com>
    Change-Id: I626d4f05eb1124da0dcf7073482a994ff6cdfb6f

diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c
index dbd9cb97db..275a56e86b 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/FreeRTOS.c
@@ -478,6 +478,26 @@ static int freertos_get_thread_reg_list(struct rtos *rtos, 
int64_t thread_id,
                }
        }
 
+       if (cm4_mpu_enabled == 1) {
+               /* Read the LR to decide between stacking with or without FPU */
+               uint32_t lr_svc = 0;
+               retval = target_read_u32(rtos->target,
+                               stack_ptr + 0x20,
+                               &lr_svc);
+               if (retval != ERROR_OK) {
+                       LOG_OUTPUT("Error reading stack frame from FreeRTOS 
thread");
+                       return retval;
+               }
+               if ((lr_svc & 0x10) == 0)
+                       return rtos_generic_stack_read(rtos->target,
+                                       param->stacking_info_cm4f_mpu_fpu,
+                                       stack_ptr,
+                                       reg_list,
+                                       num_regs);
+               else
+                       return rtos_generic_stack_read(rtos->target, 
param->stacking_info_cm4f_mpu, stack_ptr, reg_list, num_regs);
+       }
+
        if (cm4_fpu_enabled == 1) {
                /* Read the LR to decide between stacking with or without FPU */
                uint32_t lr_svc = 0;

-- 

Reply via email to