https://toitlang.org/ logo
How to Decode stack-trace with a custom envelope
# help
i
I used the envelop esp32s3 to install and flash my own code using the tutorial in the toit repo (I did not build my own toit, I used one from envelopes) I receive a crash but it can not be decoded:
Copy code
$ jag decode WyNVBVVYU1UQdjIuMC4wLWFscGhhLjE0NVNVAFskVSNVEMo6M7I26VnnsQydl1gfQixbI1UEVUVTVQlFWENFUFRJT05TVQRbNzRdWyNVAlVTWyNVC1sjbAAAAANVRlUASR5/WyNsAAAAA1VGVQFJHmtbI2wAAAADVUZVAkkErlsjbAAAAANVRlUDSRKLWyNsAAAAA1VGVQRJFD9bI2wAAAADVUZVBUkUVlsjbAAAAANVRlUGSWbdWyNsAAAAA1VGVQdJZvVbI2wAAAADVUZVCElmGVsjbAAAAANVRlUJSWahWyNsAAAAA1VGVQpJEqI=
EXCEPTION error. 
[74]
No such file: C:\...\.cache\jaguar\snapshots\ca3a33b2-36e9-59e7-b10c-9d97581f422c.snapshot
Error: cannot decode stacktrace without snapshot for program: ca3a33b2-36e9-59e7-b10c-9d97581f422c
How can I change this path or tell toit to use it? And where can I even find this snapshot? Is it the one I created (but with a different name?)
I copied the snapshot I created and installed into jaguar snapshots and renamed it to the uuid. That worked but is there a more convenient way to do so? I am using the following commands to build and flash the device: compile main app
toit.compile -w komodo.snapshot src/komodo.toit
install container to envelope:
firmware -e firmware-esp32s3.envelope  container install komodo komodo.snapshot
flash:
firmware -e firmware-esp32s3.envelope flash -p COM19 --baud 921600 --chip esp32s3
f
There is currently no better way to do this. Our tools automatically copy snapshots they create into that directory so
jag monitor
works.
k
Maybe
jag decode
could take a path to a snapshot as an optional argument?
f
Probably a good idea.
To an envelope could also work.
and would automatically get all the snapshots of the device.
i
I think I can pass an envelope but that was not decoding
f
Yes. The envelope is currently only used for the C-based stack traces. When the underlying system crashes.
We would need to improve
jag
to also search for snapshots in it.
i
how can I determine the uuid which the snapshot is named after? then I could copy the snapshop into the .cache folder
f
The latest SDK has
toit tool snapshot uuid
And older (but still recent) SDKs have
tools/toitp uuid file.snapshot
(iirc).
i
@floitsch is there a docker image where toit is already installed? I want to build that ne firmware in my GitHub repo and release it there so I can download the file from GitHub as the server for my firmware
f
If you want to run Toit on GitHub runners use the GitHub action: https://github.com/toitlang/action-setup
i
ah nice! thanks
https://github.com/open-thngs/trap-a-rep-trigger/actions/runs/8786093560/workflow I want to compile the snapshot and install it in to the envelope and then upload the envelope to GitHub. But I need to install the jag packages I am using, or how is this intended to work?
the jag is not known in this case and I can not install the packages
f
Use
toit.pkg
instead.
i
hm.. something does not work here:
Copy code
/home/runner/work/trap-a-rep-trigger/trap-a-rep-trigger/src/toit/package.lock:5:10: error: Package 'github.com/informaticore/toit-ringbuffer-1.0.3' not found
the link is not right at least
I am using now
toit.pkg install
which should install all dependencies (which is just this one)
aahh I think I am running it in the wrong folder
what about this part
firmware -e firmware-esp32s2.envelope container install komodo komodo.snapshot
firmware is not avaialble as well
f
you can always use
toit.pkg --project-root=...
i
yes I was running it in the root working directory, its fine now. But now I can not run the firmware part where I install the container into the envelope? because firmware does not exist where is this actually coming from? jaguar I guess?
Copy code
- name: Build toit firmware
  working-directory: src/toit
  run: |
    toit.pkg install
    toit.compile -w komodo.snapshot src/komodo.toit
    firmware -e firmware-esp32s2.envelope container install komodo komodo.snapshot
f
firmware
is also part of the SDK. It might not be automatically in the PATH. But the GitHub action also sets an environment variable where it has put the SDK. It's then in
sdk/tools
i
you might add this to the GitHub action to maybe also put this as an env. Btw: the file which is generated by that build process and which is flashed onto the device - is this the one I can download and "install" via BLE? as a firmware update? or do I actually only need the snapshot? I am a bit confused because the size of this firmware is quite big
f
The envelope and snapshot usually contain all the debug info... (You can remove those with the
--strip
flag). The binary you get from the
firmware extract
command, on the other hand, is just what needs to be shipped
Shouldn't be too hard to set an environment variable, but we are moving towards exposing all functionality through the
toit
executable anyway. So you would rarely need it.
i
that looks corrrect - the extracted bin file is only 1.3mb. nice! Now my GitHub repo generates the firmware which can be downloaded by an app and shipped to the ESP
2 Views