toit icon indicating copy to clipboard operation
toit copied to clipboard

Document how to build on Windows hosts

Open kasperl opened this issue 4 years ago • 1 comments

The instructions in the README file only show how to do this Linux and macOS hosts.

kasperl avatar Dec 01 '21 11:12 kasperl

Not a ton of detail, but these are the steps I wrote down under Windows 10 to get this project compiled.

Install Debian from the Windows Store

Open the Debian terminal and enter everything below:

This is all set to work from ~ cd ~

Update first and install everything needed

sudo apt update
sudo apt install build-essential cmake ninja-build golang python3 python3-venv virtualenv python3-virtualenv libusb-1.0-0 git-all
sudo pip3 install pyserial

Grab ESP-IDF

git clone https://github.com/toitware/esp-idf.git
pushd esp-idf/
git checkout patch-head-4.3-3
git submodule update --init --recursive
popd

Export the path, add it to .bashrc to make it permanent export IDF_PATH=~/esp-idf/

Install and export

$IDF_PATH/install.sh
. $IDF_PATH/export.sh

Clone Toit and build

cd ~
git clone https://github.com/toitlang/toit.git
cd toit/
make tools
make esp32

At this point make esp32 should run without errors. The output mentions running make flash to get it on your ESP32, which isn't there at the moment #51 . To use the alternative command it suggests, modify it like so.

My output: python /home/microfire/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0xd000 /home/microfire/toit/build/esp32/ota_data_initial.bin 0x1000 /home/microfire/toit/build/esp32/bootloader/bootloader.bin 0x10000 /home/microfire/toit/build/esp32/toit.bin 0x8000 /home/microfire/toit/build/esp32/partitions.bin make[1]: Leaving directory '/home/microfire/toit/toolchains/esp32'

Change the bold parts: sudo python3 /home/microfire/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyS17 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0xd000 /home/microfire/toit/build/esp32/ota_data_initial.bin 0x1000 /home/microfire/toit/build/esp32/bootloader/bootloader.bin 0x10000 /home/microfire/toit/build/esp32/toit.bin 0x8000 /home/microfire/toit/build/esp32/partitions.bin make[1]: Leaving directory '/home/microfire/toit/toolchains/esp32'

You'll need to find your ESP32 in the /dev/ folder. An easy way is to open the Windows Device Manager program, find Ports (COM & LPT), expand it and unplug/plug your ESP32 in to see which COM port it comes up as. If it was COM17, for example, it will be /dev/ttyS17 in Debian.

justind000 avatar Dec 02 '21 14:12 justind000