From 1298023463f147f464141ab10549eb08836457df Mon Sep 17 00:00:00 2001 From: regymm <31496626+regymm@users.noreply.github.com> Date: Sat, 27 Jan 2024 16:34:41 +0900 Subject: [PATCH] fixes --- Makefile | 6 +++--- README.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/Makefile b/Makefile index 30c105f..5df5134 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,8 @@ build_libftdi: EMCC=${EMSCRIPTEN_DIR}/emcc INCLUDES=-I./installed/include/libftdi1 -I./installed/include/libusb-1.0 DEFINES=-DBLASTERII_DIR=\"\" -DDATA_DIR=\"/usr/local/share\" -DFTDI_VERSION=105 -DISE_DIR=\"/opt/Xilinx/14.7\" -DUSE_DEVICE_ARG -DVERSION=\"v0.11.0-wasm\" -#OPTIMIZE=-O3 # release, takes 30 mins -OPTIMIZE=-O1 # iteration +OPTIMIZE=-O3 # release, takes 30 mins +#OPTIMIZE=-O1 # iteration #OPTIMIZE=-g # debug CFLAGS=$(OPTIMIZE) -pthread -fexceptions $(INCLUDES) $(DEFINES) LDFLAGS=$(OPTIMIZE) --bind -fexceptions installed/lib/libusb-1.0.a installed/lib/libftdi1.a -s "EXPORTED_RUNTIME_METHODS=['callMain']" -s ASYNCIFY -s ASYNCIFY_STACK_SIZE=512000 -s ALLOW_MEMORY_GROWTH -s INVOKE_RUN=0 -s USE_PTHREADS=1 # -s TOTAL_MEMORY=2048MB -s ASSERTIONS=1 --shell-file wasmFPGAloader_shell.html -s NO_EXIT_RUNTIME=1 #-s NO_DISABLE_EXCEPTION_CATCHING -s DISABLE_EXCEPTION_CATCHING=0 # -s SAFE_HEAP=0 -s NO_DISABLE_EXCEPTION_CATCHING -s MEMORY64=0 @@ -38,4 +38,4 @@ wasmFPGALoader.js: $(OBJECTS) $(EMCC) $(LDFLAGS) $(OBJECTS) -o $@ clean: - -rm wasmFPGAloader.{js,wasm} $(OBJECTS) + -rm wasmFPGALoader.{js,wasm} $(OBJECTS) diff --git a/README.md b/README.md new file mode 100644 index 0000000..7dbf536 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +## wasmFPGALoader + +[openFPGALoader](https://github.com/trabucayre/openFPGALoader) ported to WebAssembly, using WebUSB backend. Program all your FPGA boards from the browser! + +Reference article: [here](https://web.dev/articles/porting-libusb-to-webusb) + +#### Build + +``` +git submodule update --init +make build_libusb +make build_libftdi +make +``` + +#### Host + +HTTPS must be used for WebUSB, and two add_headers as in Nginx conf file are necessary for SharedArrayBuffer. + +``` +mkdir certs +openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./certs/nginx.key -out ./certs/nginx.crt +docker run --rm -p 443:443 -p 80:80 \ + -v $(pwd):/usr/share/nginx/html:ro \ + -v $(pwd)/certs:/etc/nginx/ssl \ + -v $(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf:ro \ + -d nginx +``` + +#### WebUSB + +Only Chromium-based browsers are supported. On Windows, .... can be used to replace/install required FTDI drivers.