How does spark compile (CLI) work under the hood?

I am able to flash code into my Spark Core via USB by doing the following:

$spark compile blink --saveTo blink/blink.bin
$spark flash --usb blink/blink.bin

My understanding is that spark flash uses dfu_util to upload the firmware.

But what does spark compile do? Is it getting whatever files necessary from the cloud to build the firmware? Does it do any kind of caching to speed up the process? It’s still quite quick, and this whole process is much faster than cloud based uploading.

Thanks

But what does spark compile do? Is it getting whatever files necessary from the cloud to build the firmware?

It sends the blink directory to the compile server, which builds it and returns back the compiled binary.

The OTA update process is a little slower than flashing locally due to network latency (which doesn't come into play when flashing locally). We are taking steps to speed that up. On the Photon, OTA updates will be very quick for small programs!

1 Like

OK. Does Spark have any official documentation for building the firmware locally?

Thanks

This might be useful: https://community.spark.io/t/local-development-and-gdb-debugging-with-netbeans-a-step-by-step-guide/7829

Start here:

It is a standard gcc toolchain with makefiles.

These instructions apply to the current firmware compile-server2 branch but the HAL branch is way ahead for photon work.

1 Like

Thanks!