Install a Debian-based Linux distro (choose one)
- SiFive Unmatched: Ubuntu Server 20.04
- Virtual Machine: RISC-V VM with QEMU
apt update
apt install git build-essential bc cmake python3 python3-pip python-is-python3 libffi-dev libssl-dev cargo golang ninja-build#Toit
git clone https://github.com/toitlang/toit.git
cd toit/
#ESP-IDF
git submodule update --init --recursivemake allbuild/host/sdk/bin/toit.run examples/hello.toit
build/host/sdk/bin/toit.run examples/bubble_sort.toit
build/host/sdk/bin/toit.run examples/mandelbrot.toitThis section describes how to compile the Toit binaries (toit.compile and toit.run) for another architecture (like RISC-V).
Note: This is necessary to generate the snapshots that are part of the SDK.
Follow steps 2-4 above on the host.
apt update
#RISC-V 64 (fails to link on Arch Linux)
apt install g++-riscv64-linux-gnu gcc-riscv64-linux-gnu
#ARM 32 (template warnings on compile, but works)
apt install g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
#ARM 64
apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
#WIN 32
apt install g++-mingw-w64-i686 gcc-mingw-w64-i686
#WIN 64
apt install g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64#Substitute <TARGET> with one of [arm32, arm64, riscv64, win32, win64]
make CROSS_ARCH=<TARGET> sdk-crossFor example, for Windows:
make CROSS_ARCH=win64 sdk-cross
A complete Toit environment should now be ready for use on the target architecture
ᐅ find build/win64/sdk
build/win64/sdk
build/win64/sdk/bin
build/win64/sdk/bin/toit.run.exe
build/win64/sdk/bin/toit.compile.exe
build/win64/sdk/bin/toit.run.snapshot
build/win64/sdk/lib
build/win64/sdk/tools
build/win64/sdk/tools/firmware.exe
build/win64/sdk/tools/snapshot_to_image.exe
build/win64/sdk/tools/stacktrace.exe
build/win64/sdk/tools/system_message.exe
build/win64/sdk/tools/toitp.exeNote: The
sdk/libdirectory is, by default, only a symlink to the 'lib' directory. For deployment the SDK needs to have the symlink replaced by a copy of the 'lib' directory.