Debugging ESP32 programs on Linux using an "ESP32 Emulator Library"
Posted: Sun Dec 18, 2016 5:15 pm
As I build out ESP32 applications by editing source in Eclipse, compiling it with the ESP32 ESP-IDF framework and then deploying it and watching the console ... I found myself a little frustrated at the lag between edit, compile, test -> repeat. Obviously if I was a better programmer I would get it right first time
It then dawned on me that the majority of what I am working on is literal C code with a large chunk of POSIX API supplied by the "newlib" functions and a relatively small set of functions provided by ESP-IDF. At this point my light-bulb started glowing (at about 25 watts) and I said "What if I didn't develop ON the ESP32 but instead developed and test on Linux?". Sound pretty obvious ... but the down side is that there are "enough" functions that I am using in ESP32 ... GPIO, NVS, VFS, WiFi etc etc that my code would become cumbersome to maintain two sets or even one set with lots of #ifdefs. And this is where the notion of a Linux based "ESP32" emulator library comes into the picture. What if we developed a set of libraries that exposed the same public APIs as those exposed by ESP-IDF but instead ran on Linux? For example, a GPIO read/write would be visible and controlled on a browser based dash board to emulate a signal change, SPI/I2C would be logged and visualized as a signal analytics chart, WiFi would be mapped to the local network with the dashboard able to show "what was requested" and to generate interesting events. The majority of functions we will get for free because of POSIX compatibility.
Now obviously, I can't be even close to the first person to consider this notion so before I run away with myself and start planning and designing and coding ... I wanted to see if anyone has started such a project already (in which case I'll try and join) or maybe Espressif has this today and would be willing to share. If the answer to these is not yet ... then if anyone sees merit in it, post here and we can start a collaborative project to start breaking it up and "get er done".
It then dawned on me that the majority of what I am working on is literal C code with a large chunk of POSIX API supplied by the "newlib" functions and a relatively small set of functions provided by ESP-IDF. At this point my light-bulb started glowing (at about 25 watts) and I said "What if I didn't develop ON the ESP32 but instead developed and test on Linux?". Sound pretty obvious ... but the down side is that there are "enough" functions that I am using in ESP32 ... GPIO, NVS, VFS, WiFi etc etc that my code would become cumbersome to maintain two sets or even one set with lots of #ifdefs. And this is where the notion of a Linux based "ESP32" emulator library comes into the picture. What if we developed a set of libraries that exposed the same public APIs as those exposed by ESP-IDF but instead ran on Linux? For example, a GPIO read/write would be visible and controlled on a browser based dash board to emulate a signal change, SPI/I2C would be logged and visualized as a signal analytics chart, WiFi would be mapped to the local network with the dashboard able to show "what was requested" and to generate interesting events. The majority of functions we will get for free because of POSIX compatibility.
Now obviously, I can't be even close to the first person to consider this notion so before I run away with myself and start planning and designing and coding ... I wanted to see if anyone has started such a project already (in which case I'll try and join) or maybe Espressif has this today and would be willing to share. If the answer to these is not yet ... then if anyone sees merit in it, post here and we can start a collaborative project to start breaking it up and "get er done".