writing code that can be run on both esp32 and desktop toolchain

willemmerson
Posts: 40
Joined: Mon Mar 18, 2019 12:34 pm

writing code that can be run on both esp32 and desktop toolchain

Postby willemmerson » Tue Nov 05, 2019 10:37 am

This may be more a general embedded programming question than specific to the esp32. I am developing a feature for the esp32 which mostly involves parsing cJson, looping over arrays etc. and isn't actually esp32 specific. I wondered if it's possible to have a source file in the project which can be compiled both by the esp32 toolchain but also by a standard desktop toolchain, in my case linux.
It just seems it would be quicker to develop something if I didn't have to constantly flash it every time I changed it, and it would be easier to write tests.
Actually while writing this I've just realised one way to do this would be to write it as an external component and include it - is this the easiest way?

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: writing code that can be run on both esp32 and desktop toolchain

Postby permal » Tue Nov 05, 2019 10:07 pm

I had the same idea some years back, it grew into a complete framework that can run on *nix and ESP32. for reference, this I/O card/alarm is built on top of Smooth

Depending on your application size and what else you need, writing parts as an external component/library might be enough for you.

Who is online

Users browsing this forum: aapee-jcv, Bing [Bot], Google [Bot] and 456 guests