Page 1 of 1
Add new function to ESP32 program memory?
Posted: Wed Feb 23, 2022 5:50 am
by thatlittleidiot
I have a project where the majority of the code should stay the same, and only a small section of the program, a few functions, should be changed regularly.
Basically, a bunch of unchanging code that calls some small functions that I want to change/add/remove while the board is running, without restarting the whole board/re-uploading all of the code. Is there a way to do this on the ESP32?
Re: Add new function to ESP32 program memory?
Posted: Wed Feb 23, 2022 8:49 am
by ESP_Sprite
Not trivially. Could you elaborate a bit more about your use case? Perhaps there are other ways to accomplish this.
Re: Add new function to ESP32 program memory?
Posted: Wed Feb 23, 2022 9:23 am
by thatlittleidiot
Essentially, I'm looking to create a field-programmable audio effects processor using the ESP32-A1S. Audio input, audio output, wireless communication for the programming of the processor, among other processes, won't be changed during typical use cases. A list of functions would be applied to samples and would constitute the DSP section of the program. The DSP section is the only part of the program that will be regularly changing, and having to upload mostly the same code over and over again, and having to reboot the board, seems like overkill. But is an understandable limitation. Is it best to let my fantasies remain fantasies?
Re: Add new function to ESP32 program memory?
Posted: Wed Feb 23, 2022 10:36 am
by ESP_Sprite
Hm. If your functions were entirely standalone (as in: no internal global variables, no calls out) you could technically load it in RAM and execute it. That's not something that's widely supported, so I don't have any docs to point you at.
Perhaps as an alternative, you can implement some fixed DSP utilities (lowpass, highpass, etc) in the app, then use configuration to tie all of those together?
Re: Add new function to ESP32 program memory?
Posted: Wed Feb 23, 2022 11:16 am
by thatlittleidiot
I was already considering a block-programming style interface for programming the effects processor, so perhaps your proposed alternative is the ideal way to go. Having a preset number of function blocks and chaining them together through function pointers, I suppose. If you wanted to code your own blocks in C++ you would then have to upload a new sketch to access them.
Thank you for your help, I don't know why I didn't consider this option earlier.