Page 1 of 1

Jaguar: Dynamically install or update drivers on your ESP32

Posted: Sat Sep 10, 2022 11:30 am
by kasperl
Hi all,

We've improved our open-source developer tooling ("Jaguar") for the ESP32 with support for dynamically installing or updating drivers and services without reflashing or rebooting your devices.

As an example, you can install an NTP-based time synchronization service on your device through:

Code: Select all

$ jag container install ntp examples/ntp/ntp.toit
The service persists across reboots and it encapsulates the time synchronization code nicely in a memory-isolated container that doesn't interfere with your application code:

Code: Select all

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:320
load:0x40078000,len:13216
load:0x40080400,len:2964
entry 0x400805c8
[toit] INFO: starting <v2.0.0-alpha.22>
[jaguar] INFO: container 'ntp' started
[wifi] DEBUG: connecting
[wifi] DEBUG: connected
[wifi] INFO: network address dynamically assigned through dhcp {ip: 192.168.86.34}
[jaguar] INFO: running Jaguar device 'possible-teaching' on 'http://192.168.86.34:9000'
[ntp] INFO: synchronized {adjustment: 461886h45m59.639723406s, time: 2022-09-10T06:46:02}
...
You can also run complex drivers like the ones for cellular modems this way:

Code: Select all

$ jag container install cellular-bg96 quectel-cellular/src/bg96.toit \
    -D cellular.uart.tx=17 \
    -D cellular.uart.rx=16 \
    -D cellular.apn=soracom.io
Once installed, using the cellular modem to provide a network is as easy as:

Code: Select all

import cellular
import http

main:
  network := cellular.open
  client := http.Client network
  host := "www.google.com"
  response := client.get host "/"

  bytes := 0
  while data := response.body.read: bytes += data.size
  print "Read $bytes bytes from http://$host/ via cellular!"
Jaguar is based on the free and open-source Toit language implementation. You can download it from https://github.com/toitlang/jaguar and have it running on your device in less than 5 minutes. We'd love your feedback and can't wait to see what you build with this :)

Regards,
Kasper

Re: Jaguar: Dynamically install or update drivers on your ESP32

Posted: Sun Sep 11, 2022 6:29 am
by kasperl
Oh, and if Discord is your kind of thing, you're very welcome to join the community discussions: https://chat.toit.io/.