diff --git a/extras/tests/simavr_based/Makefile b/extras/tests/simavr_based/Makefile index b8502ba..150ca2b 100644 --- a/extras/tests/simavr_based/Makefile +++ b/extras/tests/simavr_based/Makefile @@ -46,39 +46,9 @@ simavr/simavr/run_avr: simavr/simavr/sim/run_avr.c make -C simavr build-simavr simavr/simavr/sim/run_avr.c: - git clone https://github.com/gin66/simavr.git - # these versions work out of the box - #(cd simavr;git checkout 8d660ce) - #(cd simavr;git checkout a56b550) - #(cd simavr;git checkout c6d5375) - #(cd simavr;git checkout 9ed8eb6) - #(cd simavr;git checkout b653a13) - # - # these versions work only with patch applied - #(cd simavr;git checkout d2aaebd) - #(cd simavr;git checkout ea4c450) - #(cd simavr;git checkout d6ba83c) - #(cd simavr;git checkout ce6738b) - #(cd simavr;git checkout a5634af) - #(cd simavr;git checkout 13363d5) - #(cd simavr;git checkout 1379eed) - # - # these versions cannot be reverse patched - #(cd simavr;git checkout c96ea61) # fails - #(cd simavr;git checkout 4d1750b) # fails - #(cd simavr;git checkout adfce91) # fails - # - # test using: - # make proper run_avr;make -C test_sd_01b_2560t3/ - # - # patch derived by: - # git diff b653a13..d2aaebd >../../simavr.patch - # - # select current HEAD as of now - (cd simavr;git checkout 7003af) - # apply patch, which is now minimal: -# (cd simavr;patch -p1 -t <../simavr.patch) - (cd simavr;patch -p1 -t <../simavr.patch2) + # git clone https://github.com/gin66/simavr.git + git clone https://github.com/buserror/simavr.git + (cd simavr;git checkout 132cc67) proper: clean rm -f run_avr diff --git a/extras/tests/simavr_based/simavr.patch b/extras/tests/simavr_based/simavr.patch deleted file mode 100644 index 0b042fa..0000000 --- a/extras/tests/simavr_based/simavr.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c -index 91cf106..3d489d5 100644 ---- a/simavr/sim/avr_ioport.c -+++ b/simavr/sim/avr_ioport.c -@@ -158,6 +158,11 @@ avr_ioport_irq_notify( - value &= 0xff; - uint8_t mask = 1 << irq->irq; - uint8_t ddr = avr->data[p->r_ddr]; -+ // Set the real PIN bit. Ignore DDR as it's masked when read. -+ -+ avr->data[p->r_pin] &= ~mask; -+ if (value) -+ avr->data[p->r_pin] |= mask; - - if (output) { - if ((mask & ddr) == 0) diff --git a/extras/tests/simavr_based/simavr.patch2 b/extras/tests/simavr_based/simavr.patch2 deleted file mode 100644 index 216ecd8..0000000 --- a/extras/tests/simavr_based/simavr.patch2 +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c -index 91cf106..b1dba73 100644 ---- a/simavr/sim/avr_ioport.c -+++ b/simavr/sim/avr_ioport.c -@@ -155,27 +155,34 @@ avr_ioport_irq_notify( - avr_t * avr = p->io.avr; - - int output = value & AVR_IOPORT_OUTPUT; -- value &= 0xff; - uint8_t mask = 1 << irq->irq; - uint8_t ddr = avr->data[p->r_ddr]; -+ uint8_t new_pin; - -+ value &= 0xff; -+ new_pin = (avr->data[p->r_pin] & ~mask) | (value ? mask : 0); - if (output) { -- if ((mask & ddr) == 0) -- return; // TODO: stop further processing of IRQ. -- -- // If the IRQ was marked as Output, also do the IO write. -+ uint8_t new_out; -+ -+ new_out = (avr->data[p->r_port] & ~mask) | (value ? mask : 0); -+ if (mask & ddr) { -+ // If the IRQ was marked as Output, do the IO write. -+ -+ avr_ioport_write(avr, p->r_port, new_out, p); -+ avr_core_watch_write(avr, p->r_pin, new_pin); -+ } else { -+ /* Set the PORT register so the output will be visible -+ * when the corresponding DDR bit is set. -+ * Real hardware does not do this. -+ */ - -- avr_ioport_write(avr, -- p->r_port, -- (avr->data[p->r_port] & ~mask) | -- (value ? mask : 0), -- p); -+ avr->data[p->r_port] = new_out; -+ return; // TODO: stop further processing of IRQ. -+ } - } else { - // Set the real PIN bit. Ignore DDR as it's masked when read. - -- avr_core_watch_write(avr, p->r_pin, -- (avr->data[p->r_pin] & ~mask) | -- (value ? mask : 0)); -+ avr_core_watch_write(avr, p->r_pin, new_pin); - - /* BUG: If DDR bit is set here, there should be no - * interrupt. But a spurious IRQ call by the user