tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
15.16k stars 890 forks source link

TinyGo for ESP32 on Windows 10 - not compiling #3998

Open Gustavomurta opened 9 months ago

Gustavomurta commented 9 months ago

I can't compile TinyGo for ESP32 on Windows 10. I saw that to run the esptool tool on Linux, esptool.py is used. But in Windows 10 there is no such command, after installing esptool. The command is esptool (without .py).

C:\Users\jgust>esptool version esptool.py v4.6.2

Therefore, when trying to compile TinyGo for ESP32 I receive this error message.

"esptool.py": executable file not found in %PATH%

PS C:\Users\jgust\tinygo\programas\esp32\flash_spi\flash_example\console\spi> tinygo flash -target=esp32-coreboard-v2 main.go
error: failed to flash C:\Users\jgust\AppData\Local\Temp\tinygo4028449839\main.bin: exec: "esptool.py": executable file not found in %PATH%
C:\Users\jgust>tinygo env
GOOS="windows"
GOARCH="amd64"
GOROOT="C:\\Program Files\\Go\\"
GOPATH="C:\\Users\\jgust\\go\\"
GOCACHE="C:\\Users\\jgust\\AppData\\Local\\tinygo"
CGO_ENABLED="1"
TINYGOROOT="C:\\Users\\jgust\\scoop\\apps\\tinygo\\current"

Can anyone help with this problem? Thank you.

sago35 commented 9 months ago

Copying esptool.exe to create esptool.py.exe should work fine.

The following is reference information, but it is written in Japanese. https://qiita.com/sago35/items/4517cc96919f84f0efb3#esptoolpy-%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB-%E3%83%90%E3%82%A4%E3%83%8A%E3%83%AA%E3%82%92%E5%85%A5%E6%89%8B%E3%81%99%E3%82%8B

sago35 commented 9 months ago

I think it's better to modify the main TinyGo codebase.

Gustavomurta commented 9 months ago

Sago35, I copied the esptool program from the link you indicated: https://github.com/espressif/esptool/releases/

To be able to use it on Windows, I renamed the program to esptool.py.exe

I found where the original tool was in Windows: C:\Users\jgust\AppData\Local\Programs\Python\Python312\Scripts

How to find where a Program is installed in Windows 11/10: https://www.thewindowsclub.com/how-to-find-where-a-program-is-installed-in-windows-10

I copied the renamed tool into this folder. I tested it and it worked! Thank you very much.

It's not the ideal solution, but it's an alternative.

jiangbo66666 commented 3 months ago

awesome , i got it . thanks