This is an automated email from Gerrit.

Antonio Borneo (borneo.anto...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6310

-- gerrit

commit f5521d5e9c87d63ee2a8f8fb99f2f30930bedba1
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Wed Jun 9 11:27:57 2021 +0200

    arm_tpiu_swo: fix autodetection of SWO pin frequency
    
    While the documentation reports that SWO pin frequency can be
    omitted to let the adapter autodetect the value, the code wrongly
    drops an error when pin frequency is not specified.
    
    Don't require the pin frequency to be set at "enable", but verify
    that the adapter has properly changes it to a valid value.
    
    Change-Id: I3dfbe3256e8887ef4f03512769b06381cdc9db0d
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>
    Reported-by: Karl Palsson <ka...@tweak.net.au>
    Fixes: 184724d14e12 ("arm_tpiu_swo: add support for independent TPIU and 
SWO")

diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 6d1e94f..0fe8a57 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -616,10 +616,8 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int 
argc, Jim_Obj *const
        }
 
        if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || 
obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
-               if (!obj->swo_pin_freq) {
-                       LOG_ERROR("SWO pin frequency not set");
-                       return JIM_ERR;
-               }
+               if (!obj->swo_pin_freq)
+                       LOG_DEBUG("SWO pin frequency not set, will be 
autodetected by the adapter");
 
        struct target *target = get_current_target(cmd_ctx);
 
@@ -720,6 +718,12 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int 
argc, Jim_Obj *const
                        return JIM_ERR;
                }
 
+               if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || 
obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
+                       if (!swo_pin_freq) {
+                               LOG_ERROR("SWO pin frequency not set");
+                               return JIM_ERR;
+                       }
+
                if (obj->swo_pin_freq != swo_pin_freq)
                        LOG_INFO("SWO pin data rate adjusted by adapter to %d 
Hz", swo_pin_freq);
                obj->swo_pin_freq = swo_pin_freq;

-- 

Reply via email to