guild icon
Toit
#How to Decode stack-trace with a custom envelope
Thread channel in help
theHuanter
theHuanter 04/22/2024 06:58 AM
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:

$ 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?)
theHuanter
theHuanter 04/22/2024 07:03 AM
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
(edited)
floitsch
floitsch 04/22/2024 09:43 AM
There is currently no better way to do this.
Our tools automatically copy snapshots they create into that directory so jag monitor works.
bitphlipphar
bitphlipphar 04/22/2024 10:18 AM
Maybe jag decode could take a path to a snapshot as an optional argument?
floitsch
floitsch 04/22/2024 10:19 AM
Probably a good idea.
floitsch
floitsch 04/22/2024 10:20 AM
To an envelope could also work.
floitsch
floitsch 04/22/2024 10:20 AM
and would automatically get all the snapshots of the device.
theHuanter
theHuanter 04/22/2024 12:06 PM
I think I can pass an envelope but that was not decoding
theHuanter
theHuanter 04/22/2024 12:07 PM
floitsch
floitsch 04/22/2024 12:07 PM
Yes. The envelope is currently only used for the C-based stack traces. When the underlying system crashes.
floitsch
floitsch 04/22/2024 12:07 PM
We would need to improve jag to also search for snapshots in it.
theHuanter
theHuanter 04/22/2024 12:08 PM
how can I determine the uuid which the snapshot is named after? then I could copy the snapshop into the .cache folder
floitsch
floitsch 04/22/2024 12:19 PM
The latest SDK has toit tool snapshot uuid
๐Ÿ‘1
floitsch
floitsch 04/22/2024 12:21 PM
And older (but still recent) SDKs have tools/toitp uuid file.snapshot (iirc).(edited)
theHuanter
theHuanter 04/22/2024 01:08 PM
@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
floitsch
floitsch 04/22/2024 01:10 PM
If you want to run Toit on GitHub runners use the GitHub action: https://github.com/toitlang/action-setup
GitHub Action to setup Toit. Contribute to toitlang/action-setup development by creating an account on GitHub.
theHuanter
theHuanter 04/22/2024 02:02 PM
ah nice! thanks
theHuanter
theHuanter 04/22/2024 02:48 PM
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?
Device to detect passing creatures to trigger an external device like a DSLR camera - install toit libraries before compiling ยท open-thngs/trap-a-rep-trigger@30300d3
theHuanter
theHuanter 04/22/2024 02:48 PM
the jag is not known in this case and I can not install the packages
floitsch
floitsch 04/22/2024 02:53 PM
Use toit.pkg instead.
theHuanter
theHuanter 04/22/2024 03:25 PM
hm.. something does not work here: /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
theHuanter
theHuanter 04/22/2024 03:26 PM
I am using now toit.pkg install which should install all dependencies (which is just this one)(edited)
theHuanter
theHuanter 04/22/2024 03:27 PM
aahh I think I am running it in the wrong folder
theHuanter
theHuanter 04/22/2024 03:42 PM
what about this part firmware -e firmware-esp32s2.envelope container install komodo komodo.snapshot
theHuanter
theHuanter 04/22/2024 03:42 PM
firmware is not avaialble as well
floitsch
floitsch 04/22/2024 03:44 PM
you can always use toit.pkg --project-root=...
floitschfloitsch
you can always use toit.pkg --project-root=...
theHuanter
theHuanter 04/22/2024 09:14 PM
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?

- 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
(edited)
floitsch
floitsch 04/22/2024 09:39 PM
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
๐Ÿ‘1
theHuanter
theHuanter 04/22/2024 10:06 PM
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
(edited)
floitsch
floitsch 04/22/2024 10:19 PM
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
theHuanterOPtheHuanter
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...(edited)
floitsch
floitsch 04/22/2024 10:22 PM
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.
๐Ÿ‘1
theHuanter
theHuanter 04/23/2024 07:58 AM
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
๐Ÿ‘1
32 messages in total