This is an automated email from Gerrit.

Andrey Smirnov ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/2033

-- gerrit

commit c05049ee741ddd476afcd29b67309d17bf577adf
Author: Andrey Smirnov <[email protected]>
Date:   Sat Mar 8 13:01:09 2014 -0800

    CMSIS-DAP: Check IDCODE against the expected one
    
    Change-Id: I53ef518e7b5b5fbfb0023f42db8766fb9c1f84a8
    Signed-off-by: Andrey Smirnov <[email protected]>

diff --git a/src/target/adi_v5_cmsis_dap.c b/src/target/adi_v5_cmsis_dap.c
index d43488a..61e59de 100644
--- a/src/target/adi_v5_cmsis_dap.c
+++ b/src/target/adi_v5_cmsis_dap.c
@@ -308,6 +308,8 @@ static int cmsis_dap_init(struct command_context *ctx)
 #endif
 
        uint8_t ack;
+       bool found = false;
+
 
        status = cmsis_dap_queue_idcode_read(dap, &ack, &idcode);
 
@@ -315,8 +317,28 @@ static int cmsis_dap_init(struct command_context *ctx)
                target->tap->hasidcode = true;
                target->tap->idcode = idcode;
                LOG_INFO("IDCODE 0x%08" PRIx32, idcode);
+
+               int i;
+               int limit = target->tap->expected_ids_cnt;
+
+               for (i = 0; i < limit; i++) {
+                       uint32_t expected = target->tap->expected_ids[i];
+
+                       /* treat "-expected-id 0" as a "don't-warn" wildcard */
+                       if (!expected || target->tap->idcode == expected) {
+                               found = true;
+                               break;
+                       }
+               }
        }
 
+       if (!found) {
+               LOG_ERROR("target not found: idcode: 0x%08" PRIx32,
+                         target->tap->idcode);
+               return ERROR_FAIL;
+       }
+
+
        /* force clear all sticky faults */
        cmsis_dap_queue_ap_abort(dap, &ack);
 

-- 

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to