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:32:38 +0000 (20:02 +0930)
ecpprog/ecpprog.c

index c9550e46503b1f2337c8389e645ff15f4f77fa03..66a04230c532dc69d7cd9b0bb564451386af7b7c 100644 (file)
@@ -983,12 +983,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);