From b3cda781a6a96b5306aa61eb7985555b242ad04e Mon Sep 17 00:00:00 2001 From: Tobias Platen Date: Thu, 10 Mar 2022 19:52:26 +0100 Subject: [PATCH] update orangecrab-examples section --- HDL_workflow/microwatt.mdwn | 19 ++++++++++- HDL_workflow/orangecrab-examples.diff | 46 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 HDL_workflow/orangecrab-examples.diff diff --git a/HDL_workflow/microwatt.mdwn b/HDL_workflow/microwatt.mdwn index d87b14781..1acedf73d 100644 --- a/HDL_workflow/microwatt.mdwn +++ b/HDL_workflow/microwatt.mdwn @@ -142,6 +142,23 @@ separate USB-serial adapter. see the following for further details: # running orangecrab-examples before flashing microwatt -If the OrangeCrab is running in DFU mode, lsusb will show +If the OrangeCrab is running in DFU mode, lsusb will show: 1209:5af0 Generic OrangeCrab r0.2 DFU Bootloader v3.1-6-g62e92e2 + +OrangeCrab has two DFU devices: + + Found DFU: [1209:5af0] ver=0101, devnum=22, cfg=1, intf=0, path="1-4.2", alt=1, name="0x00100000 RISC-V Firmware", serial="UNKNOWN" + Found DFU: [1209:5af0] ver=0101, devnum=22, cfg=1, intf=0, path="1-4.2", alt=0, name="0x00080000 Bitstream", serial="UNKNOWN" + +Then clone and patch orangecrab-examples: + + git clone https://github.com/orangecrab-fpga/orangecrab-examples + patch -p1 < orangecrab-examples.diff + +To build and flash the example: + + pushd orangecrab-examples/nmigen + python3 blink.py + popd + sudo dfu-util -D orangecrab-examples/nmigen/build/top.bit -a 0 diff --git a/HDL_workflow/orangecrab-examples.diff b/HDL_workflow/orangecrab-examples.diff new file mode 100644 index 000000000..f3cdf2c26 --- /dev/null +++ b/HDL_workflow/orangecrab-examples.diff @@ -0,0 +1,46 @@ +diff --git a/nmigen/blink.py b/nmigen/blink.py +index a966594..6e78cc6 100644 +--- a/nmigen/blink.py ++++ b/nmigen/blink.py +@@ -16,16 +16,32 @@ class Blink(Elaboratable): + red_led = rgb.r + green_led = rgb.g + blue_led = rgb.b +- +- m.d.comb += [ +- red_led.o.eq(self.count[27]), +- green_led.o.eq(self.count[26]), +- blue_led.o.eq(self.count[25]), +- ] +- ++ #platform.request('0') ++ #platform.request('1') ++ color = "BLUE" ++ ++ ## 27 26 25 ++ if color=="GREEN": ++ m.d.comb += [ ++ red_led.o.eq(0), ++ green_led.o.eq(self.count[26]), ++ blue_led.o.eq(0), ++ ] ++ elif color=="RED": ++ m.d.comb += [ ++ red_led.o.eq(self.count[26]), ++ green_led.o.eq(0), ++ blue_led.o.eq(0), ++ ] ++ elif color=="BLUE": ++ m.d.comb += [ ++ red_led.o.eq(0), ++ green_led.o.eq(0), ++ blue_led.o.eq(self.count[26]), ++ ] + return m + + + if __name__ == "__main__": +- platform = OrangeCrabR0_2Platform() +- platform.build(Blink(), do_program=True) ++ platform = OrangeCrabR0_2_85k_Platform() ++ platform.build(Blink(), do_program=False) -- 2.30.2