[Info] Building ESP32 applications on Windows using Visual Studio

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Info] Building ESP32 applications on Windows using Visual Studio

Postby kolban » Tue Oct 11, 2016 4:30 am

A recent post asked about using Microsoft Visual Studio to build ESP32 applications as opposed to command line or Eclipse. I thought I'd have a cursory look. I know nothing about Visual Studio as I haven't built Windows native applications in the longest time. There is a free version from Microsoft called "Visual Studio Community" that can be downloaded here.

https://www.visualstudio.com/downloads/

However, before you go down this path, let me cut to the chase as I currently understand it. You won't easily be able to use Visual Studio to build ESP32 applications. My thinking behind this is that Visual Studio is designed to build applications that run on Windows platforms and is probably excellent at that. If I was going to build an app that runs on Windows, IE or against other Microsoft products, it is likely that this is the perfect tool/product. However, our target here is an ESP32 device and not Windows.

To start with, there is only one known compiler that will build ESP32 binaries and that is the cross compiler that is based on "gcc" for the Xtensa architecture. Visual Studio provides its own compilers and doesn't appear to be obviously engineered to interact with others.

Next we have the ESP-IDF build environment. This is based on the "Makefile" concepts along with the "make" tool. While Visual Studio does appear to have a tool called "nmake", that is more of a side nod that a provision of a "make" environment. When we set include directories, libraries and other goodies, those don't appear to touch the make system.

Does that mean that we simply can't use Visual Studio to build ESP32 applications? The answer is no as evidenced by this product:

http://visualgdb.com/

VisualGDB appears to be all the tooling one needs to run Makefiles and cross compilers from within Visual Studio and if I were a developer with a world of experience in working in Visual Studio on a Windows platform and wanted to maintain that investment, then VisualGDB would be a no-brainer. However for a hobbyist, there is a catch. There is a modest ($89) license fee for the product. In the schemes of things, this is dirt cheap/inconsequential ... but if we are not professionals and are paying for the tools out of our own pockets ... one has to really want to use Visual Studio as opposed to command line or Eclipse.
Last edited by kolban on Wed Dec 28, 2016 1:42 am, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Building ESP32 applications on Windows using Visual Studio

Postby WiFive » Tue Oct 11, 2016 5:12 am

You can use visual studio as an ide like eclipse. You can use a free plugin or roll your own if you don't want to use a paid plugin. If you Google for "esp8266 visual studio" and "visual studio GCC" you will see several options.

Scalpel78
Posts: 51
Joined: Sun Feb 26, 2017 7:31 am

Re: [Info] Building ESP32 applications on Windows using Visual Studio

Postby Scalpel78 » Wed May 17, 2017 5:57 pm

Has anyone gained any more experience using Visual Studio with ESP32 since these October-posts? I use VS at work daily, and would love to be able to use it for ESP32 as well.

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: [Info] Building ESP32 applications on Windows using Visual Studio

Postby f.h-f.s. » Wed May 17, 2017 6:57 pm

I was using Visual Studio with VisualGDB. The fact esp-idf isn't updated regularly made me switch to building with esp-idf's make.
Visual Studio Code has GREAT integration for linux, its a bit harder in windows but it all works (idk about mac, but probably).

I can open headers with CTRL+LeftMouse.
Goto definition with F12.
Clang format on save.
Run "make -j8 V=1 flash monitor" from the integrated tasks.
Start OpenOCD as a task.
Specify a specific esp-idf folder as IDF_PATH for every work space.
Output make monitor to the tasks output integrated as a window in vscode.
Run gdb next to openocd integrated in vscode.

I think this works even better than Visual Studio with VisualGDB. Although I miss the programming through JTAG in esp-idf.
I don't know what else I would wish for with this setup :lol: .
I made a template if you wanna try it out.
https://github.com/FHFS/esp-idf-VSCode-template

I tried eclipse too, it kinda worked but it was hard to set up.

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: [Info] Building ESP32 applications on Windows using Visual Studio

Postby Deouss » Mon Apr 02, 2018 1:16 pm

Scalpel78 wrote:Has anyone gained any more experience using Visual Studio with ESP32 since these October-posts? I use VS at work daily, and would love to be able to use it for ESP32 as well.
Same question here.... (Not about Visual GDB - not free)

Who is online

Users browsing this forum: No registered users and 360 guests