mini-jtag: reset board before load config bits file
This commit is contained in:
parent
a840ebfdcc
commit
5b07f103d7
|
@ -37,14 +37,29 @@ clean:
|
|||
|
||||
%.bit:
|
||||
@echo ""
|
||||
@echo "Compile $@ by yourself. copy the bits file here"
|
||||
@echo "Move the config bits file: <$@> here."
|
||||
@echo ""
|
||||
@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
|
||||
@./mini-jtag reset
|
||||
@./mini-jtag load $<
|
||||
@echo "Read counter registers (1 ~ 5)"
|
||||
@./mini-jtag read 0 # read version
|
||||
|
@ -68,18 +83,3 @@ test-counter: counter.bit mini-jtag
|
|||
@sleep 1
|
||||
@./mini-jtag read 4 # read 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]);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
fprintf(stderr,
|
||||
|
@ -138,11 +145,8 @@ int main(int argc, char **argv)
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
if (!strcmp (argv[1], "reset")) {
|
||||
tap_reset_rti(&ftdi);
|
||||
tap_shift_ir(&ftdi, JPROGRAM);
|
||||
tap_reset_rti(&ftdi);
|
||||
}
|
||||
if (!strcmp (argv[1], "reset"))
|
||||
brd_reset(&ftdi);
|
||||
|
||||
if (!strcmp (argv[1], "load")) {
|
||||
int i;
|
||||
|
@ -194,9 +198,9 @@ int main(int argc, char **argv)
|
|||
for (u = 0; u < bs->length; u++)
|
||||
dr_data[u] = rev8(bs->data[u]);
|
||||
|
||||
tap_reset_rti(&ftdi);
|
||||
tap_shift_ir(&ftdi, CFG_IN);
|
||||
brd_reset(&ftdi);
|
||||
|
||||
tap_shift_ir(&ftdi, CFG_IN);
|
||||
tap_shift_dr_bits(&ftdi, dr_data, bs->length * 8, NULL);
|
||||
|
||||
/* ug380.pdf
|
||||
|
|
Loading…
Reference in New Issue
Block a user