I’ve spent a day on this and it’s been fun and confusing.
I started with building the core firmware and flashing with dfu-util. The rest of the day I used spark-cli to build and flash “Over the Air”.
Does the core firmware stay onboard, or is it overwritten with each flash?
I’m assuming it stays onboard and the “spark flash …” cli command writes binaries to a “user” space.
I want to disable the Cloud connection. How do I use dfu-util to flash new binaries to the supposed "user"space.
This ones a little off topic, but can a new String object be created with a char array?
My understanding is that the firmware is overwritten on each flash. There is a second copy of the firmware kept that can be used should you corrupt your firmware, accessed with pressing mode for 10 seconds after simultaneously pushing and releasing the reset button. You will know you have pressed it long enough when the LED goes white
There are a few posts on this. Searching the past posts is a great way to learn. Start with the following link, which will contain a heap of more interesting information. Link Having said that, I would keep the Cloud enabled subject to memory limitations initially since it makes uploading new versions of the code much easier.
1: https://community.spark.io/t/udp-problems-with-include-spark-disable-cloud-h/4443[quote=“ronm, post:1, topic:4991”]
can a new String object be created with a char array
You can convert from a String to a Char Array if needed. The function is toCharArray, and more information can be found on the following link
Hope this helps
@ronm, @vk2tds, though this is not yet documented (mostly because this will change), you can start your core without wifi or cloud by including one or both of these lines in your application:
#include "spark_disable_wlan.h" //Turn off both wifi and cloud
#include "spark_disable_cloud.h" //Turn off cloud only
Then in your code, you can turn wifi on and off using WiFi.on() and WiFi.off() while you can do the same with the cloud connection using Spark.connect() and Spark.disconnect().
There are two pieces of code that run on the Spark Core:
Your custom user application (a collection of C/C++ source code) is compiled along with the Core-Firmware source code to create a final Core-Firmware binary.
The Bootloader is what handles completely overwriting the Core-Firmware either wireless OTA or local DFU mode over USB.
As @vk2tds said, the Bootloader can also restore Factory Core-Firmware that is saved in external non-volatile Flash memory located on the Spark Core.
String new_string1 = String("This is my character array");
String new_string2 = "This is my character array";
Another way to Convert a String to character array is:
char new_char = "";
Thanks for the replies.
So the binaries created by “spark compile” can be loaded with either DFU or OTA. excellent, thanks.
The String creation I’m wondering about is more like:
char oldString=“old c string” ;
String newString = String ( oldString ) ;