Develop, update, and restart your ESP32 applications in less than two seconds

Related tags

Network esp32 toit
Overview

Jaguar

Develop, update, and restart your ESP32 applications in less than two seconds. Use the really fast development cycle to iterate quickly and learn fast!

What is it?

Jaguar is a small Toit program that runs on your ESP32. It uses the capabilities of the Toit virtual machine to let you update and restart your ESP32 applications written in Toit over WiFi. Change your Toit code in your editor, update the application on your device, and restart it all within seconds. No need to flash over serial, reboot your device, or wait for it to reconnect to your network.

Watch a short video that shows how you can experience Jaguar on your ESP32 in less than 3 minutes:

Jaguar demonstration

How does it work?

Jaguar runs a small HTTP server that listens for incoming requests. The requests contain compiled Toit applications that are relocated and installed in flash on the device. Before installing an application, we stop any old version of the application and free the resources it has consumed. The new version of the application gets to start again from main.

How do I use it?

First you'll need to have a Go development environment properly set up. Using that you can install the jag command line tool using go install:

go install github.com/toitlang/jaguar/cmd/jag@latest

Remember to add $HOME/go/bin or %USERPROFILE%\go\bin to your PATH. Next step is to let jag download and configure the Toit SDK and the associated tools for flashing the Jaguar application onto your ESP32:

jag setup

Now it is time to connect your ESP32 with a serial cable to your computer and put the Jaguar application onto it:

jag flash --port=/dev/ttyUSB0 --wifi-ssid="<ssid>" --wifi-password="<password>"

Now it is possible to monitor the serial output from the device:

jag monitor --port=/dev/ttyUSB0

Once the serial output shows that your ESP32 runs the Jaguar application, it will start announcing its presence to the network using UDP broadcast. You can find a device by scanning, but this requires you to be on the same local network as your ESP32:

jag scan

With the scanning complete, you're ready to run your first Toit program on your Jaguar-enabled ESP32 device:

jag run examples/hello.toit

Building it yourself

You've read this far and you want to know how to build Jaguar and the underlying Toit language implementation yourself? Great! You will need to follow the instructions for building Toit and make sure you can flash a simple example onto your device.

Let's assume your git clones can be referenced like this:

export TOIT_PATH=<path to https://github.com/toitlang/toit clone>
export JAGUAR_PATH=<path to https://github.com/toitlang/jaguar clone>

Now start with flashing the Jaguar application onto your ESP32. This is easily doable from within the $TOIT_PATH directory:

make flash ESP32_ENTRY=$JAGUAR_PATH/src/jaguar.toit \
  ESP32_PORT=/dev/ttyUSB0 \
  ESP32_WIFI_SSID="<ssid>" \
  ESP32_WIFI_PASSWORD="<password>"

For building Jaguar, all you need to do is run from within your $JAGUAR_PATH directory:

make

You can now run Jaguar by telling it where to find the Toit SDK and the snapshot for the Jaguar application for the ESP32:

export JAG_TOIT_PATH=$TOIT_PATH/build/host/sdk
export JAG_ENTRY_POINT=$TOIT_PATH/build/snapshot
build/jag scan

To also do the ESP32 flashing through Jaguar, you'll need two extra environment variables:

export JAG_ESP32_BIN_PATH=$TOIT_PATH/build/esp32
export JAG_ESPTOOL_PATH=$IDF_PATH/components/esptool_py/esptool/esptool.py
build/jag flash --port=/dev/ttyUSB0 --wifi-ssid="<ssid>" --wifi-password="<password>"

Contributing

We welcome and value your open source contributions to Jaguar (or Shaguar as we like to call it).

Shaguar!

You might also like...
Hetzner-dns-updater - A simple tool to update a DNS record via Hetzner DNS API. Used for simple HA together with Nomad

hetzner-dns-updater A small utility tool to update a single record via Hetzner D

Send email and SMS broadcasts to your contacts. SMS are sent via your Android phone connected to your PC.

Polysender Send email and SMS broadcasts to your contacts. Polysender is a desktop application, so it does not require a complicated server setup. Ema

Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes.

DNS-Updater Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes. Motivation Havin

A server that proxies requests and uses fhttp & my fork of CycleTLS to modify your clienthello and prevent your requests from being fingerprinted.

TLS-Fingerprint-API A server that proxies requests and uses my fork of CycleTLS & fhttp (fork of net/http) to prevent your requests from being fingerp

Simple, secure and modern Go HTTP server to serve static sites, single-page applications or a file with ease

srv srv is a simple, secure and modern HTTP server, written in Go, to serve static sites, single-page applications or a file with ease. You can use it

A REST API for the DN42 registry, written in Go, to provide a bridge between interactive applications and the registry.

dn42regsrv A REST API for the DN42 registry, written in Go, to provide a bridge between interactive applications and registry data. A public instance

Echo-server - An HTTP echo server designed for testing applications and proxies

echo-server An HTTP echo server designed for testing applications and proxies. R

A library to simplify writing applications using TCP sockets to stream protobuff messages

BuffStreams Streaming Protocol Buffers messages over TCP in Golang What is BuffStreams? BuffStreams is a set of abstraction over TCPConns for streamin

Kiara is a Go equivalent of Phoenix PubSub that makes it easy for Go applications to communicate with each other.
Kiara is a Go equivalent of Phoenix PubSub that makes it easy for Go applications to communicate with each other.

Kiara is a Go equivalent of Phoenix PubSub that makes it easy for Go applications to communicate with each other. Examples Basic Usage Custom Co

Comments
  • ESP32-C3 not support

    ESP32-C3 not support

    % jag flash           
    Flashing device over serial on port '/dev/cu.usbserial-2140' ...
    esptool.py v3.0
    Serial port /dev/cu.usbserial-2140
    Connecting....
    WARNING: This chip doesn't appear to be a ESP32 (chip magic value 0x1b31506f). Probably it is unsupported by this version of esptool.
    Chip is ESP32-D0WDQ6 (revision 0)
    Features: WiFi, BT, Dual Core, Coding Scheme None
    WARNING: Detected crystal freq 0.00MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?
    Crystal is 26MHz
    MAC: 00:00:00:00:00:00
    Uploading stub...
    Running stub...
    
    A fatal error occurred: Invalid head of packet (0x47)
    Error: exit status 2
    

    I could use this command to flash micropython framework: esptool.py --chip esp32-c3 --baud 460800 --port /dev/cu.usbserial-2140 write_flash -z 0x0

    How can I add those similar additional params to jag command line?

    opened by nne998 1
  • Reply to HTTP requests with error code on failures

    Reply to HTTP requests with error code on failures

    Today, Jaguar doesn't reply with an error to HTTP requests that fail in unexpected ways (exceptions, timeouts, etc.).

    We probably need to wrap the HTTP request handling in something that acts on exceptions. It isn't quite clear if the request should be considered handled if we sent the exception back to the user or if we should continue unwinding.

    https://github.com/toitlang/jaguar/blob/59aa0fcd6d1b3e671998878a72dbd55d50b6e8e8/src/jaguar.toit#L480

    enhancement good first issue 
    opened by kasperl 0
  • Default timeout for 'jag scan' with IP address is too low

    Default timeout for 'jag scan' with IP address is too low

    It seems pretty common that we cannot complete the HTTP /identify request in 600ms. Perhaps we need a higher default timeout when we're scanning specific addresses because it involves a HTTP roundtrip that isn't necessary when just listening for broadcasted UDP packets?

    good first issue 
    opened by kasperl 1
  • WiFi times out waiting for IP address from DHCP server

    WiFi times out waiting for IP address from DHCP server

    after successfull start and longer run, the toit firmware reports wifi reconnection errors:

    Restart Message: grafik

    Decoded Error: EXCEPTION error. DEADLINE_EXCEEDED 0: Monitor.await /core/monitor_impl.toit:28:20 1: ResourceState_.wait_for_state_ /core/events.toit:55:5 2: ResourceState_.wait. /core/events.toit:22:12 3: Monitor.locked_. /core/monitor_impl.toit:123:12 4: Monitor.locked_ /core/monitor_impl.toit:95:3 5: ResourceState_.wait /core/events.toit:21:3 6: WifiModule.wait_for_ip_address system/extensions/esp32/wifi.toit:208:25 7: WifiServiceDefinition.turn_on.. system/extensions/esp32/wifi.toit:67:47 8: Task_.with_deadline_. /core/task.toit:73:21 9: Task_.with_deadline_ /core/task.toit:67:3 10: with_timeout /core/utils.toit:179:15 11: with_timeout /core/utils.toit:162:12 12: WifiServiceDefinition.turn_on. system/extensions/esp32/wifi.toit:67:7 13: WifiServiceDefinition.turn_on system/extensions/esp32/wifi.toit:62:3 14: WifiState.up.. system/extensions/esp32/wifi.toit:102:31 15: WifiState.up. system/extensions/esp32/wifi.toit:98:3 16: Monitor.locked_. /core/monitor_impl.toit:123:12 17: Monitor.locked_ /core/monitor_impl.toit:95:3 18: WifiState.up system/extensions/esp32/wifi.toit:98:3 19: WifiServiceDefinition.connect system/extensions/esp32/wifi.toit:53:23 20: WifiServiceDefinition.connect system/extensions/esp32/wifi.toit:44:12 21: NetworkServiceDefinitionBase.handle system/extensions/shared/network_base.toit:26:14 22: WifiServiceDefinition.handle system/extensions/esp32/wifi.toit:41:12 23: ServiceManager_. /system/services.toit:332:15 24: RpcRequest_.process. /rpc/broker.toit:98:26 25: RpcRequest_.process /rpc/broker.toit:95:3 26: RpcRequestQueue_.ensure_processing_task_... /rpc/broker.toit:214:20 27: RpcRequestQueue_.ensure_processing_task_.. /rpc/broker.toit:209:9 28: RpcRequestQueue_.ensure_processing_task_. /rpc/broker.toit:204:81

    opened by kaxori 7
Releases(v1.7.14)
Owner
Toit language
Toit language
EasyTCP is a light-weight and less painful TCP server framework written in Go (Golang) based on the standard net package.

EasyTCP is a light-weight TCP framework written in Go (Golang), built with message router. EasyTCP helps you build a TCP server easily fast and less painful.

zxl 551 Jan 7, 2023
Automatically update your Windows hosts file with the WSL2 VM IP address

Automatically update your Windows hosts file with the WSL2 VM IP address

null 1.4k Jan 9, 2023
hc is a lightweight framework to develop HomeKit accessories in Go.

hc hc is a lightweight framework to develop HomeKit accessories in Go. It abstracts the HomeKit Accessory Protocol (HAP) and makes it easy to work wit

Matthias 1.7k Jan 4, 2023
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

fasthttp Fast HTTP implementation for Go. Currently fasthttp is successfully used by VertaMedia in a production serving up to 200K rps from more than

Aliaksandr Valialkin 18.9k Jan 5, 2023
Plugs module to see different types of plug types needed in different countries, and a comparison tool between two countries plug socket types.

plugs Importing the module: go get github.com/matthewboyd/plugs "github.com/matthewboyd/plugs" How to use the module: There are two functions wi

Matthew Boyd 2 Dec 28, 2021
Business Logic for Multiply two numbers Service.

Business Logic for Multiply two numbers Service. 1. Related projects This project has two related projects: Rest: https://github.com/kenesparta/tk-res

Ken Esparta Ccorahua 1 Oct 19, 2021
An anonymous, encrypted Point-to-Point (Layer 3) tunnel between two peers.

NKN-Link An anonymous, encrypted Point-to-Point (Layer 3) tunnel between two peers. NKN-Link Table of Contents Preface Description Install Setup Run P

HAH! Sun 8 Dec 20, 2022
kcp is a prototype of a Kubernetes API server that is not a Kubernetes cluster - a place to create, update, and maintain Kube-like APis with controllers above or without clusters.

kcp is a minimal Kubernetes API server How minimal exactly? kcp doesn't know about Pods or Nodes, let alone Deployments, Services, LoadBalancers, etc.

Prototype of Future Kubernetes Ideas 1.8k Jan 6, 2023
dynflare is a tool to automatically update dns records at Cloudflare, when the ip changes.

dynflare dynflare is a tool to automatically update dns records at Cloudflare, when the ip changes. How it works The current ips are determined by ask

Lukas Dietrich 0 Dec 7, 2021
Use DDNS to Update a Cloudflare Spectrum Application's IP Address

Cloudflare Spectrum DDNS NOTICE - PROJECT IS A WORK IN PROGRESS Cloudflare Spectrum's functionality is limited to specifying IP addresses for SSH and

Connor McKelvey 2 Sep 15, 2022