Skip to content

Add option for --factory #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dcmcshan opened this issue Jan 20, 2025 · 3 comments
Open

Add option for --factory #266

dcmcshan opened this issue Jan 20, 2025 · 3 comments

Comments

@dcmcshan
Copy link

I'd like to have a factory partition in addition to ota_0 and ota_1. Is this something you'd like to add as command line option, or should I hack builder/esp32.py?

@kdschlosser
Copy link
Collaborator

the partitions are broken up as

For an ota setup you have the following partitions.
nvs
otadata
phy_init
ota_0
ota_1
vfs

and without OTA you have the following..
nvs
phy_init
factory
vfs

Those are only names.

nvs = data
otadata = data
phy_init = data
ota_0 = app
ota_1= app
vfs = data

nvs = data
phy_init = data
factory = app
vfs = data

so with an ota setup you are 2 partitions that are "factory" partitions.

app partitions cannot be loaded inside of MicroPython. The data that is written to them can only be done when flashing. They do not contain a file system so you would not be able to access the information that is on it if you add it. There really is no point to having it. You cannot write data to it other than when it is flashed.

I already built in a feature that you can use. Compile the firmware the way you want and then go into the lib/micropython/ports/esp32/build-* folder then locate the folder config and go into that. send me the sdkconfig.h file.

I also need to know what your build command is. Once I have those things I will set you up with a way to make all kinds of custom changes without needing to modify anything in the build routine.

@dcmcshan
Copy link
Author

So the idea in having the "factory" partition is that it is a "factory tested" firmware that customer can always revert to, if ota corrupts in some fashion. I have sufficient flash to do this, and seems like a useful thing. I am currently running a script that sed's into the builder/esp32.py file to make some modifications (spiffs, etc) so I can just add factory to that, but thought it might be a useful command line option.

@kdschlosser
Copy link
Collaborator

with an OTA update that's what the second OTA partition is for. It automatically plays round robin between the 2 partitions in case of a failure when flashing it can always revert back to the last known good state.

You want a 3rd partition for the purposes of actually holding the original firmware that came with the device.
As I have said I made a modification that will allow you to do this. it is the --custom-board-path build argument. I am still working on the documentation for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants