https://github.com/andygeiss/esp32
Build your own toolchain to develop, test, build and finally deploy a Golang controller to your ESP32 device.
https://github.com/andygeiss/esp32
esp32 espressif go golang iot iot-device
Last synced: 8 months ago
JSON representation
Build your own toolchain to develop, test, build and finally deploy a Golang controller to your ESP32 device.
- Host: GitHub
- URL: https://github.com/andygeiss/esp32
- Owner: andygeiss
- License: mit
- Created: 2018-01-02T10:56:18.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-08-05T05:21:41.000Z (over 1 year ago)
- Last Synced: 2025-04-14T10:07:04.496Z (8 months ago)
- Topics: esp32, espressif, go, golang, iot, iot-device
- Language: Go
- Homepage:
- Size: 64.5 KB
- Stars: 88
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ESP32
[](https://github.com/andygeiss/esp32/blob/master/LICENSE)
[](https://github.com/andygeiss/esp32/releases)
[](https://goreportcard.com/report/github.com/andygeiss/esp32)
[](https://codeclimate.com/github/andygeiss/esp32/maintainability)
Build your own toolchain to develop, test, build and finally deploy a Golang controller to your ESP32 device.
## Purpose
The [Arduino IDE](https://www.arduino.cc/en/Main/Software) is easy to use.
But I faced problems like maintainability and testability at more complicated IoT projects.
I needed to compile and flash the ESP32 before testing my code functionality by doing it 100% manually.
This solution transpiles Golang into Arduino code, which can be compiled to an image by using the ESP32 toolchain.
Now I am able to use a fully automated testing approach instead of doing it 100% manually.
## Process
+--------+ +---------+ +----------+
| Test +----> Build +----> Deploy |
+--------+ +---------+ +----------+
make make flash
**Important**: The Transpiler only supports a small subset of the [Golang Language Specification](https://golang.org/ref/spec).
## Installation
First download and install the latest [Arduino IDE](https://www.arduino.cc/en/Main/Software) into /opt/arduino or change INO_IDE_PATH in the Makefile
and necessary packages.
- **Ubuntu**:
sudo apt-get install -y bison flex git gperf libncurses-dev make python
- **Manjaro**:
sudo pip install pyserial
Next run the ESP32 SDK-Installation:
make packages
Look at the [examples](https://github.com/andygeiss/esp32/tree/master/examples) for more information.
## Develop, Test and Build
Change the Arduino port to your current settings by changing the Makefile:
INO_PORT="/dev/ttyUSB0"
Also set the SSID and PASS strings at application/device/controller.go to your WiFi Access Point and start the build process by using:
make
Run the binary at build/device-${ARCH} to simulate your ESP32 device locally.
Connecting to WiFi ...... Connected!
## Deploy
Finally use the following command to deploy the image device.img to your real ESP32 device.
make flash
**Important**: Please ensure that the current user is in the dialout group. Or you will receive a permission denied.
This will create the following output:
2018/08/05 16:04:22 Flashing ...
esptool.py v2.3.1
Connecting....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Compressed 607456 bytes to 366770...
Wrote 607456 bytes (366770 compressed) at 0x00010000 in 5.9 seconds (effective 816.9 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
2018/08/05 16:04:22 Done.