Jaguar: Live reloading for the ESP32

kasperl
Posts: 18
Joined: Wed Nov 24, 2021 10:08 am

Jaguar: Live reloading for the ESP32

Postby kasperl » Sun Dec 12, 2021 7:28 am

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. It is live reloading on a microcontroller :)

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

Image

Jaguar is free and open source. It is based on the Toit language and it makes good use of the underlying capabilities of the Toit virtual machine. You can find the source code and start contributing to Jaguar on GitHub: https://github.com/toitlang/jaguar.

I would love your feedback!
Last edited by kasperl on Tue Dec 14, 2021 10:24 am, edited 1 time in total.

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: Jaguar: A fast way to develop for the ESP32

Postby ESP_krzychb » Sun Dec 12, 2021 10:52 am

Hi kasperl,

The speed of loading the application (and the possibility to quickly iterate the code updates) is indeed impressive!
I was initially hesitant to try it out because of the need to install an additional set of the software (go and Jaguar).
However, after watching your video I decided to give it a try and the installation went quickly and without any issues.

I have some questions:
- After loading the application with jag command and then resetting the device I do not see the application restarting automatically. I need to use jag command to run the application again. Is it expected behavior or did I miss some configuration?
- How to load and run different applications on multiple devices entirely from the command line without first scanning and then manually selecting a device with "Choose what Jaguar device you want to use:"?
- Does Jaguar support loading applications into separate containers on the same esp device like it can be done when developing with the cloud version of Toit (by using .yaml files to specify unique application names)?

kasperl
Posts: 18
Joined: Wed Nov 24, 2021 10:08 am

Re: Jaguar: A fast way to develop for the ESP32

Postby kasperl » Sun Dec 12, 2021 11:06 am

Thank you for trying out Jaguar on your ESP32. Let me try to answer your questions.

1) You're right that resetting the device causes it to forget about the installed application. It is still in flash though, so you could change the code to find it there (maybe keep track of its position in NVS?) and automatically start it. Patches are welcome!

2) We should probably add a way to choose the device from the command line for 'jag run'. Would that solve your issue? We'd like to give all devices a unique name so this is easier going forward (https://github.com/toitlang/jaguar/issues/23).

3) Jaguar works by loading the application into a separate container, but it only runs one at a time. We start installing the program here https://github.com/toitlang/jaguar/blob ... r.toit#L49 (this is what kills the old version of the program) and we start running it here https://github.com/toitlang/jaguar/blob ... r.toit#L60.

Hope that helps!

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: Jaguar: A fast way to develop for the ESP32

Postby ESP_krzychb » Sun Dec 12, 2021 12:11 pm

Thank you for the tips.
After checking the links I learned and appreciate how concise the Jaguar code is!

For items 1 and 3 I have entered https://github.com/toitlang/jaguar/issues/27 and https://github.com/toitlang/jaguar/issues/28

kasperl
Posts: 18
Joined: Wed Nov 24, 2021 10:08 am

Re: Jaguar: A fast way to develop for the ESP32

Postby kasperl » Sun Dec 12, 2021 1:27 pm

Perfect. Really appreciate the filed issues!

kasperl
Posts: 18
Joined: Wed Nov 24, 2021 10:08 am

Re: Jaguar: A fast way to develop for the ESP32

Postby kasperl » Tue Dec 14, 2021 6:02 am

Just shipped a new version (v0.0.5) of Jaguar that gives flashed device a unique id - and a catchy name - so they are easy to find later.

Code: Select all

% jag scan
Choose what Jaguar device you want to use: 
  ▸ elegant-disease (address: http://0.0.0.0:49458, 64-bit)
    local-bank (address: http://192.168.86.26:9000, 32-bit)
    spare-dog (address: http://0.0.0.0:49457, 64-bit)

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: Jaguar: A fast way to develop for the ESP32

Postby ESP_krzychb » Tue Dec 14, 2021 7:27 am

Jaguar is like a box of chocolates. You never know what name you're gonna get. :D

kasperl
Posts: 18
Joined: Wed Nov 24, 2021 10:08 am

Re: Jaguar: A fast way to develop for the ESP32

Postby kasperl » Tue Dec 14, 2021 10:11 am

My favorite name so far is magical-juice, but I haven't flashed so many device yet, so something better might pop up :)

Hackswell
Posts: 14
Joined: Wed Jun 03, 2020 8:13 pm

Re: Jaguar: A fast way to develop for the ESP32

Postby Hackswell » Tue Dec 14, 2021 3:23 pm

kasperl wrote:
Tue Dec 14, 2021 6:02 am
Just shipped a new version (v0.0.5) of Jaguar that gives flashed device a unique id - and a catchy name - so they are easy to find later.

Code: Select all

% jag scan
Choose what Jaguar device you want to use: 
  ▸ elegant-disease (address: http://0.0.0.0:49458, 64-bit)
    local-bank (address: http://192.168.86.26:9000, 32-bit)
    spare-dog (address: http://0.0.0.0:49457, 64-bit)
Pardon me, good sir... would you happen to have a spare-dog, please?

And does the elegant-disease leave an exquisite corpse?

kasperl
Posts: 18
Joined: Wed Nov 24, 2021 10:08 am

Re: Jaguar: Live reloading for the ESP32

Postby kasperl » Tue Dec 14, 2021 8:50 pm

Jaguar v0.1.1 (just released) comes with support for live reloading based on file watching, so you can do this:

Code: Select all

jag watch example.toit
and whenever you change example.toit or any file it depends on, your ESP32 automatically gets the new code. It is pretty magical.

Who is online

Users browsing this forum: No registered users and 316 guests