Skip to content

Instantly share code, notes, and snippets.

@gojimmypi

gojimmypi/Makefile

Last active Mar 24, 2019
Embed
What would you like to do?
Makefile gtkwave sim and xserver recipes for WSL FPGA programming
PROJ = ulx3s_adda
sim:
rm -f $(PROJ).vcd
iverilog -o $(PROJ).vvp $(PROJ).v $(PROJ)_tb.v
vvp $(PROJ).vvp
export DISPLAY=:0
## if we are running in WSL, we need a bit of help for GUI XWindows
## and sometimes the WSL username is not the same as the Windows username & we need the *windows* user path.
## this is the Windows %USER% environment variable when called from makefile: $(shell cmd.exe /c "echo $$USER")
@if [ "$(shell grep Microsoft /proc/version)" != "" ]; then \
cp /mnt/c/cygwin64/home/$(shell cmd.exe /c "echo $$USER")/.Xauthority ~/.Xauthority; \
fi
(gtkwave $(PROJ).vcd $(PROJ)_savefile.gtkw)&
xserver:
## launch the Windows cygwin64 startxwin when WSL is detected
@if [ "$(shell grep Microsoft /proc/version)" != "" ]; then \
echo "Launching Windows XServer from WSL..."; \
(/mnt/c/cygwin64/bin/run.exe --quote /usr/bin/bash.exe -l -c " exec /usr/bin/startxwin -- -listen tcp -nowgl")& \
else \
echo "Not launching WSL XServer!" ; \
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment