sram mode: don't transmit trailing invalid bytes
authorGreg Davill <greg.davill@gmail.com>
Sun, 20 Sep 2020 10:30:02 +0000 (20:00 +0930)
committerGreg Davill <greg.davill@gmail.com>
Sun, 20 Sep 2020 10:38:25 +0000 (20:08 +0930)
ecpprog/ecpprog.c

index 8a5724e862a6a2662f6c36712f0bddf413eed2ea..39698890fb714c7a45c10ee5bcde0c334010bc06 100644 (file)
@@ -1024,12 +1024,12 @@ int main(int argc, char **argv)
                        if (verbose)
                                fprintf(stderr, "sending %d bytes.\n", rc);
 
-                       for(int i = 0; i < len; i++){
+                       for(int i = 0; i < rc; i++){
                                buffer[i] = bit_reverse(buffer[i]);
                        }
 
                        jtag_go_to_state(STATE_CAPTURE_DR);
-                       jtag_tap_shift(buffer, buffer, len*8, false);
+                       jtag_tap_shift(buffer, buffer, rc*8, false);
                }
        
                ecp_jtag_cmd(ISC_DISABLE);