Пример #1
0
                ll("wait"),
                SUBI(w.wait, w.wait, 1),
                CMPI(w.wait, 0),
                BNE(ll.wait),
                Rem("End delay loop"),
                Rem("Increment the char counter"),
                ADDI(w.counter, w.counter, 1),
                Rem("are at the end of the printable chars?"),
                CMPI(w.counter, 125),
                BNE(ll.loop),
                SUBI(w.dur, w.dur, 0x0FFF),
                CMPI(w.dur, 0x0000),
                BNE(ll.skip),
                MOVI(w.dur, 0xFFFF),
                ll("skip"),
                uart.writeHex(w.dur),
            ],
            Rem("and around again, Firmware has builtin main loop"),
        ]


firmware = CharSplash

if __name__ == "__main__":
    from spork.upload import Uploader
    import fwtest

    spork = fwtest.build(firmware)
    up = Uploader()
    up.upload(spork)
Пример #2
0
    def setup(self):
        self.w.req(["leds", "temp"])

    # def prelude(self):
    #    return [DeviceSetup(self.w)()]

    def instr(self):
        echo_char = EchoChar()
        reg = self.reg
        w = self.w
        return [
            Rem("Blink the led on timer expire"),
            Blink(w, reg),
            Rem("Check if there is a char on the uart ?"),
            LDXA(w.temp, reg.serial.rx.rdy),
            CMPI(w.temp, 1),
            BNE("skip_echo"),
            echo_char(),
            L("skip_echo"),
        ]


if __name__ == "__main__":
    print("build echo firmware")
    from spork.upload import Uploader
    import fwtest

    spork = fwtest.build(Echo)
    up = Uploader()
    up.upload(spork)
Пример #3
0
            CMPI(w.temp, 1),
            BNE(ll.over),
            MOVI(w.temp, 1),
            STXA(w.temp, reg.timer.ev.pending),
            uart.cr(),
            self.stringer.boop(w.temp),
            uart.writestring(w.temp),
            uart.cr(),
            info(),
            uart.cr(),
            ll("over"),
            ADDI(w.counter, w.counter, 1),
            # ANDI(w.temp,w.counter,0xFFFF),
            CMPI(w.counter, 0),
            BNE(ll.skip),
            info(),
            ll("skip"),
        ]


" load this "
firmware = Small

if __name__ == "__main__":
    from spork.upload import Uploader
    import fwtest

    spork = fwtest.build(firmware, detail=False)
    up = Uploader()
    up.upload(spork)
Пример #4
0
            uart.writestring(w.temp),
            Rem("load the pad address into the register"),
            # console.pad(w.pad_address),
            Rem("Primary Loop"),
            ll("loop"),
            Rem("get the uart status"),
            uart.read(ret=[w.incoming_word, w.status]),
            Rem("if the status is zero skip"),
            CMPI(w.status, 0),
            BZ(ll.skip),
            Rem("process the keystroke"),
            console(w.incoming_word, w.pad_address, w.status, ret=[w.status]),
            action(w.pad_address, w.status, ret=[w.status]),
            ll("skip"),
            Rem("Timer event"),
            # TODO timer event
            J(ll.loop),
        ]


" load this "
firmware = Bootloader

if __name__ == "__main__":
    from spork.upload import Uploader
    import fwtest

    spork = fwtest.build(Bootloader, detail=False)
    up = Uploader()
    up.upload(spork)