Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This involves very few changes, all typical to WASM ports:
MAP_SHARED
flags, soMAP_PRIVATE
is used instead.There is also an update to bring ECP5 bbasm CMake rules to parity with iCE40 ones, since although it is possible to embed chipdb into nextpnr on WASM, a 200 MB WASM file has very few practical uses.
The README is not updated and there is no included toolchain file because at the moment it's not possible to build nextpnr with upstream boost and wasi-libc. Boost requires a patch (merged, will be available in boost 1.74.0), wasi-libc requires a few unmerged patches.
Nevertheless I will briefly describe in this PR how to build it.
$WASI_SDK
to the location where it's unpackedsysroot/lib/wasm32-wasi/libwasi-emulated-mman.a
-lwasi-emulated-mman
inCMakeLists.txt
with the full path tolibwasi-emulated-mman.a
project-config.jam
(replacing<WASI-SDK>
as appropriate) and run./b2 threading=single link=static
-DUSE_C_EMBED=ON
. This will fail because your compiler probably doesn't support#embed
but that's okToolchain-WASI.cmake
cmake .. -DCMAKE_TOOLCHAIN_FILE=Toolchain-WASI.cmake -DSTATIC_BUILD=ON -DBOOST_ROOT=<Boost root> -DIMPORT_EXECUTABLES=<host build directory>/ImportExecutables.cmake -DARCH=<arch> -DBUILD_GUI=OFF -DBUILD_PYTHON=OFF -DEXTERNAL_CHIPDB=ON -DEXTERNAL_CHIPDB_ROOT=/share/nextpnr
make
. You should have anextpnr-<arch>.wasm
nowwasmtime run ./nextpnr-<arch>.wasm --dir . --mapdir /share/nextpnr/<arch>::<host build directory>/<arch>/chipdbs -- <args>
where<args>
are the normal nextpnr arguments