Flash the Core via WiFi (Without the Cloud)

Hey I need a hint/shortcut :slight_smile:

Am I on the right track?

If I manage (some how) to store my new firmware image at EXTERNAL_FLASH_OTA_ADDRESS defined by
((uint32_t)(EXTERNAL_FLASH_BLOCK_SIZE + EXTERNAL_FLASH_BKP_ADDRESS))
and then start FLASH_Begin(EXTERNAL_FLASH_OTA_ADDRESS); would this work or would this destroy my core and everything attached? :smiley:
Can I count on the factory reset function of the core in case I fail?
Is the plain firmware bin stored at the mentioned address? Or is some other magic done there? I know the answer is inside the code but it takes time to reverse engineer everything ā€“ and I am not the patient guyā€¦
Cheers

1 Like

Hey @TheUser,

We started talking about building a serial firmware loader here that would do what youā€™re describing. Write some firmware to the OTA flash region, and then tell the bootloader that an OTA flash was ready, so it would reset / replace the firmware.

You should be able to rely on the factory reset image if you overwrite your firmware, and you should be able to count on the bootloader if you need to get back into DFU mode (flashing yellow) to load new factory reset firmware if you replace the wrong thing. Unless you delete the bootloader (which is really hard to do without the ST-Link necessary to put it back on again) you should be safe to hack away! :slight_smile:

The factory reset image is stored at 0x20000, so donā€™t overwrite that and you should be fine. :slight_smile:

Thanks,
David

Is still some one interested in having such an OTA Push? If yes I could upload my code to githubā€¦
Right now, I do not have an account. So, if no one is interested, I would avoid to create an account and to spread more of my data over the webā€¦ :slight_smile:

My solution is working. It is pritty simple but nead! Its my first version things like a secure communication channel will follow!

Cheers!

What do you mean? Cloud compile? I would love to see!

Well if you mean by cloud compile that you compile the firmware locally using the provided make script. Then, as a next step, you push the ā€œbinā€ img. directly from your build station via internet/wifi to your core without any cloud or usb connectionā€¦ then yes i mean ā€œcloud compileā€ :slight_smile:

1 Like

TATA: https://github.com/MainEntity/SPARK-CORE-OTAPush

Hey,
there we go! This is my first upload! I will add more description the next daysā€¦
I plan also to upload an example program for the client sideā€¦ but I need to clean it first; at least a littleā€¦
Currently, the connection between your workstation (where you compile your code) and the core is not secured. This is the first thing I will contribute next in the near futureā€¦

So let me know how you use itā€¦
Cheers!

2 Likes

I would love to test it! Could you add more docs to I can learn what is going on?

Good effort :wink:

Sure! But this wont happen until the end of the week - sorry. But till then, you will find some comments inlineā€¦

1 Like

UPDATE:

I have not found the time to come up with new documentation. But i uploaded a small client example.

It is a wild hack and it is written for windows, but it is working. To run it, you need to enter the IP and the name of the imgā€¦ The img. must be inside the very same directory.
I will update the documentation soon.
And a very simple example to add the OTAP the core will also follow!

Hint:

void loop()
{
	OTAP push;
	push.performOTA();
}

ā€¦will do the trick on the core side. (For the example client, this is the only requirement on the core sideā€¦

UPDATE: I added some more documentationā€¦

https://github.com/MainEntity/SPARK-CORE-OTAPush
https://github.com/MainEntity/SPARK-CORE-OTAPush-Client

1 Like

Any possbility of getting this code?

Hi @TheUser

Those links are 404ā€“not found on github.