Navigate in core firmware directory?

I am still a beginner… I’d like to understand the firmware source at https://github.com/spark/core-firmware/tree/master/src

Any documentation on what file does what? In particular, at which place the connection to the cloud is made?

Hi @mwei1us

Boy you picked just about the hardest thing for a beginner to understand!

You probably want to start in spark_utilities.cpp. That is were the Spark.variable() and Spark.function() etc live.

You then need to go on to the spark/core-communication-lib/ directory.

1 Like

Thank you. Could you point to me where the connection to spark cloud is made? And where data is encrypted? I’d like to understand the security aspect of Spark…

You are pretty much going to have read through the spark/communication-lib directories. I would start in spark/communication-lib/src/spark_protocol.cpp.

In a nutshell my understanding is that there are preloaded RSA keys, a public key for the cloud and a private key for each core plus a device id that are used to negotiate an AES session key used in CBC mode for further messages. A new AES key is used each time the you initialize the cloud connection, which can be at start up or after a deep sleep or a lost connection etc. A standard open-source crypto library (tropicssl) is used.

There is a way to update the RSA keys over USB using the Spark CLI and/or dfu-util.