Add new function to ESP32 program memory?

thatlittleidiot
Posts: 3
Joined: Wed Feb 23, 2022 5:17 am

Add new function to ESP32 program memory?

Postby thatlittleidiot » Wed Feb 23, 2022 5:50 am

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?

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Add new function to ESP32 program memory?

Postby ESP_Sprite » Wed Feb 23, 2022 8:49 am

Not trivially. Could you elaborate a bit more about your use case? Perhaps there are other ways to accomplish this.

thatlittleidiot
Posts: 3
Joined: Wed Feb 23, 2022 5:17 am

Re: Add new function to ESP32 program memory?

Postby thatlittleidiot » Wed Feb 23, 2022 9:23 am

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?

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Add new function to ESP32 program memory?

Postby ESP_Sprite » Wed Feb 23, 2022 10:36 am

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?

thatlittleidiot
Posts: 3
Joined: Wed Feb 23, 2022 5:17 am

Re: Add new function to ESP32 program memory?

Postby thatlittleidiot » Wed Feb 23, 2022 11:16 am

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.

Who is online

Users browsing this forum: Baidu [Spider] and 105 guests