https://toitlang.org/ logo
Make jag flash not care about Snapshot vs envelop...
# help
a
I updated to
v2.0.0-alpha.163.10+2a13c0d6
for my envelope, as it includes https://github.com/toitlang/toit/commit/08b379eb4de139f10c29f6a97bb9cf49bee3c3ed that I need, and i dont want to have the random line floating around in my own fork or something etc. However trying to flash now using a freshly built envelope I see the following
Copy code
) jag flash build/esp32c3/firmware.envelope
Error: Snapshot was built by SDK v2.0.0-alpha.163, but envelope is for SDK v2.0.0-alpha.163.10+2a13c0d6.
Error: exit status 1
I don't see a way to make jag flash ignore this error? is it possible?
One part of thee answer here is that the custom envelope build outputs a command using esptool to flash the FW onto the device using this (and not using jag) has the side affect of not including the wifi creds out of the box, but at least the code flashes
f
If you have Toit checked out, then I recommend to work with it directly: - set
JAG_TOIT_REPO_PATH
to the path of the SDK. -
make
in the Jaguar repository. This will then direct Jaguar to build and use the SDK from the checked out repository.
a
I seem to be back in this situation, but entirely inversed? 😄
Copy code
~/dev/github/toitlang/jaguar (main) ./build/jag flash --chip esp32c6
Error: Snapshot was built by SDK v2.0.0-alpha.188.14+ffc3b1be, but envelope is for SDK v2.0.0-alpha.178.
Error: exit status 1
I have
JAG_TOIT_REPO_PATH
set and am using it, and gather thats where the
v2.0.0-alpha.188.14+ffc3b1be
part is coming from Just need to figure out the
v2.0.0-alpha.178
part?
f
I think I also screwed up some dependency in the build system.
You might need to erase the sdk dir, or maybe just
make rebuild-cmake
The envelope is the version of the firmware (what is installed on the device).
a
in jaguar or toit?
f
Toit
a
after remake cbuild and make of jag
Copy code
~/dev/github/toitlang/jaguar (main) ./build/jag flash --chip esp32c6
Error: Snapshot was built by SDK v2.0.0-alpha.188, but envelope is for SDK v2.0.0-alpha.178.
Error: exit status 1
f
Start by figuring out what the toit version is.
a
Copy code
~/dev/github/toitlang/toit ((HEAD detached at v2.0.0-alpha.188))
f
Ok. That indicates that you haven't yet flashed the new firmware.
a
Right, but the command Im trying to run is the
flash
?
f
or
firmware update
.
ah. right. Now I see the
flash
.
Ok step back. You need 4 things to work together:
a
so at a guess this is the jaguar envelope being the wrong version for this jag and toit version?
f
1. the sdk binary (toit.
build/host/sdk/bin/toit version
) 2. the compiled snapshot (jaguar.
build/jag.snapshot
?) 3. the envelope (toit.
build/esp32/firmware.envelope
) 4. the installed firmware.
2 needs 1. 4 needs 3.
When
JAG_TOIT_REPO_PATH
is set, Jaguar tries to use the envelope from that directory.
I can see that you are using
esp32c6
, so you might need to explicitly
make esp32c6
in the toit repository.
I think Jaguar has a way to build all envelopes but that's probably not worth it.
in your case it would then be
build/esp32c6/firmware.envelope
for item 3.
a
Copy code
~/dev/github/toitlang/jaguar (main) ./build/jag toit tool firmware show -e ${JAG_TOIT_REPO_PATH}/build/esp32
c6/firmware.envelope
Envelope format version: 8
Kind: esp32
SDK version: v2.0.0-alpha.178
Chip: esp32c6
Containers:
  system:
    Kind: snapshot
    Id: 5d36ae78-ef49-4250-458b-b98b6db7cbdb
    Size: 167204
    Flags:
      - trigger=boot
      - critical
f
What I mentioned above: if the sdk has a bad version (and I think it might not be visible with
toit version
) then the
jag.snapshot
thinks that it is compiled for the wrong firmware. So if
jag.snapshot
claims that it isn't the version of
toit
even though you just compiled it, then you want to rebuild the sdk (either clear it, or try with
make rebuild-cmake
)
Yep. that looks like you need to build the esp32c6 firmware.
a
back to a classic
Copy code
'/home/adam/.espressif/python_env/idf5.4_py3.10_env/bin/python' is currently active in the environment while the project was configured with '/home/adam/.espressif/python_env/idf5.3_py3.10_env/bin/python'. Run 'idf.py fullclean' to start again.
Right, the makefile of toit just uses
python$(EXE_SUFFIX)
f
Sounds like you sourced the
export.sh
yourself.
I always let the buildscript do that, so that I don't run into this situation.
unless this is part of your custom firmware (which sounds likely now).
In that case,
idf.py fullclean
sounds like the right solution.
a
so, in a new shell session,
make esp32c6
results in the python env issue again running
./third_party/esp-idf/install.sh
and
make esp32c6
again results in the same Doing
/home/adam/.espressif/python_env/idf5.4_py3.10_env/bin/python ./third_party/esp-idf/tools/idf.py fullclean
in either python env resulted in telling me there was nothing to clean / it refused
rm -rf /home/adam/dev/github/toitlang/toit/build
was the golden ticket After this
make esp32c6
seemed to work > unless this is part of your custom firmware (which sounds likely now). I have no custom FW right now, this is just the plain
v2.0.0-alpha.188
toit branch, with only a couple of modifications in the
jaguar
repo
./build/jag flash --chip esp32c6
works great now!
f
hmm. Interesting.
Actually. Makes sense now.
I think you would need to run the fullclean inside the toolchain directory.
It's just easier if you remove the build/esp32c6 directory.
If you have ccache recompilation is super fast anyway. (and if you don't you should install it).
a
@floitsch last question down this rabbit hole, So i changed some of the .toit files in the jaguar repo, and want that to end up on my device I think thats the makefile target
assets
? However doing
make assets
results in
Copy code
Unhandled error: Get "https://github.com/toitware/registry/info/refs?service=git-upload-pack": dial tcp: lookup github.com on 10.255.255.254:53: read udp 10.255.255.254:56319->10.255.255.254:53: i/o timeout
Whats it doing with github? 😛
f
I have a
$JAG_TOIT_REPO_PATH/build/host/sdk/bin/toit compile -O2 -o build/jag.snapshot src/jaguar.toit
(or something like that) in my shell history.
You should be able to find the correct command in the Makefile.
I guess the github is to download dependent packages.
(toitware/registry is where the official registry is located).