Conversation
This change adds ability to compile test software, synthesize and simulate on windows platform through WSL2.
|
|
||
| # Symlink proj for easy access and build tracking, ensuring its update | ||
| file delete -force ${project_root}/out.xci | ||
| file link -symbolic ${project_root}/out.xci $xci |
There was a problem hiding this comment.
On Windows, Vivado can't create symbolic links (hard links only).
Because of that, symlink creation moved to xilinx.mk
This makes script to be independent of import Windows PATH variable.
|
Looks pretty good at first sight 👍 I will need to find some time to play with this on a Windows system. An open point is if we can perhaps set up some Github runners to test Windows support as much as possible without commercial tools (mostly the build steps), as I'd hate to break it with a silly typo down the road and not notice. I will also look into this. |
|
Sure, take your time! The documentation with WSL configuration specifics is in the linked PR. |
If it helps: WSL2 is available in the |
|
It turned out that even when using I was able to write a build workflow ported for the Windows platform, but it includes some workarounds. The issue is that GitHub Actions are applied to the host itself, and I'm not aware of a way to apply them inside WSL on that host. Because of this, existing actions like Currently, the build completes successfully, but there is a problem with the Additionally, the current check effectively tests parts of the repository that are unchanged by this pull request, since all my modifications are tied to targets depending on commercial CAD tools. Effectively, it just verifies that the build flow sw/hw/sim -all on the Windows platform via WSL2 completes without errors. It might make sense to verify that commands for Vivado by, for example, correctly expanding them to the expected text outputs. However, I'm not sure how to implement that without hardcoding paths in the checks. This is my first workflow, so it might not be perfectly written, but I hope you'll find it useful: name: build
on: [push, pull_request, workflow_dispatch]
jobs:
build:
strategy:
matrix:
target: [sw, hw, sim]
fail-fast: false
runs-on: windows-2025
steps:
- name: Setup WSL
uses: vedantmgoyal9/setup-wsl2@main
with:
distro: Ubuntu
- name: Set custom WSL mount root
run: |
wsl bash -c "echo -e '[automount]\nroot = /' | sudo tee /etc/wsl.conf"
wsl --shutdown
- name: Install Dependencies
run: |
wsl bash -c "set -e; sudo apt update; for i in {1..5}; do sudo apt install -y python3 python3-pip python3-venv unzip gdisk && break; echo 'APT failed, retrying (\$i)...'; sleep 10; done"
- name: Install Bender
run: |
wsl bash -c 'curl -f -sSL https://github.com/pulp-platform/bender/releases/download/v0.27.1/bender-0.27.1-x86_64-linux-gnu-ubuntu22.04.tar.gz -o $HOME/bender.tar.gz'
wsl bash -c 'tar -xzf $HOME/bender.tar.gz -C $HOME'
wsl bash -c 'chmod +x $HOME/bender'
- name: Install RISC-V GCC toolchain
run: |
wsl curl -f -sSL https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.03.14/riscv64-elf-ubuntu-22.04-nightly-2023.03.14-nightly.tar.gz -o toolchain.tar.gz
wsl bash -c 'mkdir -p $HOME/riscv'
wsl bash -c 'tar -xzf toolchain.tar.gz -C $HOME/riscv --strip-components=1'
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Python requirements
run: wsl pip3 install -r requirements.txt
- name: Build target
run: |
wsl bash -c 'export CHS_SW_GCC_BINROOT=$HOME/riscv/bin BENDER=$HOME/bender && make ${{ matrix.target }}-all'
- name: Check whether clean
run: |
wsl echo "* text=auto" >> .gitattributes
wsl git add --renormalize .
wsl rm .gitattributes
wsl git status
wsl bash -c 'test -z "$(git status --porcelain --ignore-submodules)"' |
|
I needed to add this line in common.tcl: set_param board.repoPaths [list C:/Users/shc/vivado-boards-master/new/board_files/genesys2/H]--> but I guess that is about my vivado installation. and I needed to change this line in set ROOT "/mnt/c/Users/shc/cheshire"to this windows path manually: set ROOT "C:/Users/shc/cheshire"--> but also this is probably because of my usage of bender in wsl, too. Other than that, it is working properly on windows in wsl environment after exporting export VIVADO="cmd.exe /C 'C:/Xilinx/Vivado/2022.2/bin/vivado.bat'"Thanks! |
|
Thank you for your feedback!
I think it might be possible to skip this step if you configure WSL to mount Windows drives directly to the root. After that, you'll have WSL-paths that look like Then restart WSL from Windows by running You can find more details in the user manual I wrote here. |
celuk
left a comment
There was a problem hiding this comment.
Thanks for the reply. I realized another drawback when I tried this version in ubuntu instead of wsl. Windows support should not break the original functionality.
It cannot find generated ips like clkwiz if you are not using wsl:
ERROR: [Synth 8-439] module 'clkwiz' not found [/home/shc/projects/cheshire/target/xilinx/src/cheshire_top_xilinx.sv:135]
ERROR: [Synth 8-6156] failed synthesizing module 'cheshire_top_xilinx' [/home/shc/projects/cheshire/target/xilinx/src/cheshire_top_xilinx.sv:16]I needed to edit xilinx.mk this way to get it work:
@@ -72,9 +72,9 @@ $$(CHS_XILINX_DIR)/out/%.$(1).bit: \
@rm -f $$(CHS_XILINX_DIR)/build/$$*.$(1)*.log $$(CHS_XILINX_DIR)/build/$$*.$(1)*.jou
cd $$| && { \
IMPL_TCL=$$<; \
+ XCI_LIST="$(foreach ip,$(CHS_XILINX_IPS_$(1)),$(CHS_XILINX_DIR)/build/$(1).$(ip)/$(ip).srcs/sources_1/ip/$(ip)/$(ip).xci)"; \
if [ -n "$$$$WSL_DISTRO_NAME" ]; then \
IMPL_TCL=$$$$(wslpath -m $$$$IMPL_TCL); \
- XCI_LIST="$(CHS_XILINX_IPS_$(1):%=$(CHS_XILINX_DIR)/build/$(1).%/out.xci)";\
XCI_LIST_PROCESSED=""; \
for f in $$$$XCI_LIST; do \
XCI_LIST_PROCESSED="$$$$XCI_LIST_PROCESSED $$$$(wslpath -m $$$$f)"; \Note that, my first try - just moving XCI_LIST line outside of the wsl if block didn't work, after ai fixed it with foreach it worked and I didn't try any further but I am sure there should be a solution with less modification by sticking to the original.
|
@celuk, thank you! I'll check this version on a linux machine to make sure we won't need another fix. |
Add PLATFORM_PATH macro to convert paths with wslpath when running under WSL, and leave them unchanged otherwise. This removes inline WSL checks, eliminates shell loops for XCI path conversion, and simplifies Vivado invocation rules.
Introduce realpath_tcl helper that resolves absolute paths and symbolic links in a cross-platform way.
|
So I took another look at my |
This PR adds the ability to compile test software, synthesize and simulate on windows platform through WSL2.