STATUS | |
---|---|
Linux environment | |
IDF environment | |
IDF compile sources | |
IDF export > fails on RISC-V host | |
Toit generate build files | |
Toit compile sources | |
Toit generate boot snapshot | |
Toit run examples | |
Cross-compile > fails to link on Arch | |
Embedded support |
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 --recursive
make all
build/host/bin/toit.run examples/hello.toit
build/host/bin/toit.run examples/bubble_sort.toit
build/host/bin/toit.run examples/mandelbrot.toit
This 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 all-cross CROSS_ARCH=<TARGET>
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/snapshots
build/win64/sdk/snapshots/inject_config.snapshot
build/win64/sdk/snapshots/snapshot_to_image.snapshot
build/win64/sdk/snapshots/system_message.snapshot
Note: The
sdk/lib
directory 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.