mini-jtag: reset board before load config bits file
This commit is contained in:
parent
a840ebfdcc
commit
5b07f103d7
|
@ -37,14 +37,29 @@ clean:
|
||||||
|
|
||||||
%.bit:
|
%.bit:
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Compile $@ by yourself. copy the bits file here"
|
@echo "Move the config bits file: <$@> here."
|
||||||
@echo ""
|
@echo ""
|
||||||
@exit 1
|
@exit 1
|
||||||
|
|
||||||
test: test-counter test-blinking test-hello_world
|
test: test-hello_world test-blinking test-counter
|
||||||
|
|
||||||
|
hello_world.bit:
|
||||||
|
make -C .. hello_world fp2bit
|
||||||
|
../hello_world | ../fp2bit - $@
|
||||||
|
|
||||||
|
test-hello_world: hello_world.bit mini-jtag
|
||||||
|
./mini-jtag load $<
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
blinking.bit:
|
||||||
|
make -C .. blinking_led fp2bit
|
||||||
|
../blinking_led | ../fp2bit - $@
|
||||||
|
|
||||||
|
test-blinking: blinking.bit mini-jtag
|
||||||
|
./mini-jtag load $<
|
||||||
|
sleep 2
|
||||||
|
|
||||||
test-counter: counter.bit mini-jtag
|
test-counter: counter.bit mini-jtag
|
||||||
@./mini-jtag reset
|
|
||||||
@./mini-jtag load $<
|
@./mini-jtag load $<
|
||||||
@echo "Read counter registers (1 ~ 5)"
|
@echo "Read counter registers (1 ~ 5)"
|
||||||
@./mini-jtag read 0 # read version
|
@./mini-jtag read 0 # read version
|
||||||
|
@ -68,18 +83,3 @@ test-counter: counter.bit mini-jtag
|
||||||
@sleep 1
|
@sleep 1
|
||||||
@./mini-jtag read 4 # read counter
|
@./mini-jtag read 4 # read counter
|
||||||
@./mini-jtag write 1 0 # disable counter
|
@./mini-jtag write 1 0 # disable counter
|
||||||
|
|
||||||
test-blinking: blinking.bit mini-jtag
|
|
||||||
./mini-jtag reset
|
|
||||||
./mini-jtag idcode
|
|
||||||
./mini-jtag load $<
|
|
||||||
sleep 2
|
|
||||||
./mini-jtag reset
|
|
||||||
|
|
||||||
hello_world.bit:
|
|
||||||
make -C ../
|
|
||||||
../hello_world | ../fp2bit - $@
|
|
||||||
|
|
||||||
test-hello_world: hello_world.bit
|
|
||||||
./mini-jtag reset
|
|
||||||
./mini-jtag load $<
|
|
||||||
|
|
|
@ -61,6 +61,13 @@ static void rev_dump(uint8_t *buf, uint16_t len)
|
||||||
printf("%02x ", buf[i]);
|
printf("%02x ", buf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void brd_reset(struct ftdi_context *ftdi)
|
||||||
|
{
|
||||||
|
tap_reset_rti(ftdi);
|
||||||
|
tap_shift_ir(ftdi, JPROGRAM);
|
||||||
|
tap_reset_rti(ftdi);
|
||||||
|
}
|
||||||
|
|
||||||
static void usage(char *name)
|
static void usage(char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -138,11 +145,8 @@ int main(int argc, char **argv)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp (argv[1], "reset")) {
|
if (!strcmp (argv[1], "reset"))
|
||||||
tap_reset_rti(&ftdi);
|
brd_reset(&ftdi);
|
||||||
tap_shift_ir(&ftdi, JPROGRAM);
|
|
||||||
tap_reset_rti(&ftdi);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp (argv[1], "load")) {
|
if (!strcmp (argv[1], "load")) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -194,9 +198,9 @@ int main(int argc, char **argv)
|
||||||
for (u = 0; u < bs->length; u++)
|
for (u = 0; u < bs->length; u++)
|
||||||
dr_data[u] = rev8(bs->data[u]);
|
dr_data[u] = rev8(bs->data[u]);
|
||||||
|
|
||||||
tap_reset_rti(&ftdi);
|
brd_reset(&ftdi);
|
||||||
tap_shift_ir(&ftdi, CFG_IN);
|
|
||||||
|
|
||||||
|
tap_shift_ir(&ftdi, CFG_IN);
|
||||||
tap_shift_dr_bits(&ftdi, dr_data, bs->length * 8, NULL);
|
tap_shift_dr_bits(&ftdi, dr_data, bs->length * 8, NULL);
|
||||||
|
|
||||||
/* ug380.pdf
|
/* ug380.pdf
|
||||||
|
|
Loading…
Reference in New Issue
Block a user