Long time Arduino user, now getting my feet wet in ESP32. I'm unsure about this topic of storing different pieces of sketches in separate flash ICs (based on some specific self-imposed limitations) and am looking for some help to lead me in the right direction!
The reason for looking into this isn't because the code or data is too large to store on one chip; It's more about separating the code into two buckets of functionality: a) the application-specific functionality (e.g. sensor, LED strip) and b) the communication functionality.
Consider the example of a simple IoT button sensor:
Flash Device 1 would contain communication logic and libraries, e.g. WiFi or MQTT libraries, WiFi credentials, functions for connecting/reconnecting, functions defining how data is transmitted, etc.
Flash Device 2 would contain the application-specific libraries and data, i.e. "what" the device is actually supposed to do. For the button sensor example, this would contain functions like waiting for button presses, what GPIO pin the ESP32 is expected to monitor for the button press, how often, and of course computation of data to then be transmitted by the ESP32, etc.
An important note is that this isolation of the two different code functionalities is only necessary for new devices (i.e. when the device first powers up). Upon device initialization, the two separate files can be combined and stored onto one flash IC, which then can be compiled and executed with one RAM device (e.g. ESP32's native PSRAM).
The use case of my end goal is for the hypothetical scenario of replacing a broken ESP32 with a new ESP32 within a device application (e.g. the button sensor) so that you just need to power up the new ESP32, it reads the communication methods from its onboard flash IC, and automatically understands that its a button sensor from a separate flash IC on the device side. Without any configuration, this new ESP32 would know exactly what to do.
It seems overly complicated, but again - I'm curious if/how this could work but didn't find too much info online yet.
Thanks so much in advance for any help! Looking forward to hearing your take on how this can be done