Code Space and Factory Reset

How much of the 1M of flash and 128k of RAM are available for user code? The last post I saw on this was from December.

Factory reset currently erases my code and runs a default program. How do I either replace that default program, or remove the factory reset feature altogether? I can’t have it where a user can erase my firmware by holding a button down. Erasing the settings of the firmware would be okay, but not the firmware itself.

Thanks!

Scott =)

[Edited title and message to make it more searchable]

Flash the code that you want the device to run during a erase reset here using :

dfu-util -d 2b04:d006 -a 0 -s 0x80E0000 -D your_file.bin
or
st-flash write your_bin 0x80E0000

Thanks! That will be very useful.

How much code space is there?

Is there a memory map anywhere for the Photon?

Also, is there a way to combine the code space for the reset code and the main code? That would allow me to have a larger program. It would have to not get deleted with the factory reset, though. :wink:

Thanks!

Presently the maximum program size is 128K. It’s not possible to reuse the factory reset region for program code, since this is also used when updating the system via the Cloud.

If you plan to never use the cloud, then in principle you could flash a much larger application there. Are you already running out of program space? How much program space do you need?

We plan to make the bootloader functionalities (safe mode, dfu mode, factory reset etc…) runtime configurable from the user application so that you can disable those that aren’t needed and lock down the device.

For now, simply leaving that sector empty will disable the factory reset functionality.

1 Like

My code space constraints come from two sources. I am using the Photon as a controller for a network of other non-wifi enabled devices. The photon will have to store the firmware for those devices (32K-36K), plus much setup information from those devices (size unknown at present), plus a web based user interface. I have already dumped jQuery (60k gzipped) for something smaller, but my web interface is still currently running 50k.

So, with a lot of stuff still to implement I am running right at about 100k. I am already minifying and gzipping my user interface, so I can’t save a lot more there. I am pretty sure I can do what I need in 256k.

Will factory reset be configurable? I wouldn’t mind using it to set my stuff into a default state.

Thanks!

Scott =)

For larger storage requirements like this I would recommend you go with the P1 rather than a photon, since it has 1MByte external flash (SST25VF080B) included in the package. Alternatively, you add this device to your design if you must go with the Photon.

You can write your own data to the factory reset region. Although keep in mind at present it is overwritten whenever the system receives a system firmware update from the cloud. If the device is not connected to the cloud then you could use this area as additional storage. The region is 0x80E0000, length 128k (1 sector.)

2 Likes

I am not presently connecting this device to the cloud. I don’t have any solid plans about that. Other functionality is much more important for me. I may look into storing my web pages there.

Thanks!