https://toitlang.org/ logo
Can I separate compile and install?
# help
a
1. I can compile on windows 11:
C:\Users\lenovo\.cache\jaguar\sdk\bin\toit.compile.exe -o esp32_binary .\hello_world.toit
This ^^^ compile to windows os and arch. [--os ] // Cross-compilation system target. [--arch ] // Cross-compilation architecture target. Can I set these ^^^ options somehow to compile for esp32? 2. If 1. above work, I can copy the esp32_binary output file and the jag_linux_arm.tgz to a router with openwrt OS. Can I run "jag scan" on the router to detect the esp32 behind router, and run "jag container install ..." to install the compiled esp32_binary? I don't wan't to run "toit.compile" on openwrt (if possible). My developer laptop is not on the same wifi network as the target esp32. I have no experience. Is this scenario possible? Or any better idea?
f
I'm not 100% certain it's possible, but if not then it's just an oversight that can be easily fixed. When compiling for the esp32 we want to get a "snapshot" (with the
--snapshot
option of
toit compile
).
As long as that snapshot comes from the same SDK as the version that is running on the device you can then send the bytecodes to the device.
It could be that
jag
(the executable) doesn't support that yet, but internally it itself compiles to a snapshot first, so adding support for it would just require to add a new command (or check) that skips the compilation and takes the snapshot you provide.
I can check in a few minutes
a
Thanks for the answer, this --snapshot option for toit.compile seems to be great. jag container install help this command not have snapshot option
f
I just looked at the sources: I think
jag container install
just looks at the file you give and verifies if it is already a snapshot: https://github.com/toitlang/jaguar/blob/6550830ca6904fed2c8fb368a6be3407b6e4d52a/cmd/jag/commands/run.go#L257
Also: I would recommend to start using
toit compile
instead of
toit.compile
. we are planning to phase out (or at least hide) the
toit.xxx
binaries.
a
"I just looked at the sources: I think jag container install just looks at the file you give and verifies if it is already a snapshot" If I understand you well, jag container install accept: - a source code file, and compile with toit compile - or accept a compiled snapshot file and use it without compilation
f
Correct