Add spi_passthrough target for nexus platform

Change-Id: Icc77a79dab65ec6161d701a274aafa6ac4d83ecf
diff --git a/platforms/nexus/matcha_hw.mk b/platforms/nexus/matcha_hw.mk
index fcfa68d..2fd416a 100644
--- a/platforms/nexus/matcha_hw.mk
+++ b/platforms/nexus/matcha_hw.mk
@@ -157,7 +157,21 @@
 	cd $(MATCHA_SRC_DIR) && \
 		bazel clean --expunge
 
+## Build the spi_passthough binary
+#
+# This builds the spi_passthrough_fpga_nexus.bin binary that can be used to
+# write flash tarballs to the nexus SPI boot flash. The binary will be copied
+# to out/spi_passthrough_fpga_nexus.bin
+spi_passthrough: | $(OUT)
+	cd $(MATCHA_SRC_DIR) && \
+	  bazel build --define DISABLE_VERILATOR_BUILD=true \
+		sw/device/examples/spi_passthrough
+	find "$(MATCHA_SRC_DIR)/bazel-out/" -type f -wholename "*fastbuild-*/sw/device/examples/spi_passthrough/spi_passthrough_fpga_nexus.bin" |\
+			xargs -I '{}' cp -f '{}' "$(OUT)"
+
+
 .PHONY:: matcha_hw_verilator_sim matcha_hw_clean matcha_hw_verilator_tests
 .PHONY:: matcha_sw_all opentitantool_pkg
 .PHONY:: matcha_hw_fpga_nexus matcha_kelvin_fpga_tarballs
 .PHONY:: multihart_boot_rom
+.PHONY:: spi_passthrough