ESP-IDF Compiling on Win10 with a twist

mikemoy
Posts: 599
Joined: Fri Jan 12, 2018 9:10 pm

ESP-IDF Compiling on Win10 with a twist

Postby mikemoy » Tue Apr 03, 2018 8:10 pm

!!! Warning, Long in the tooth description, Warning !!!

For those of use not willing to let go of our Win10 boxes, and go full Linux I think I have found an alternate method to compile on a PC.
So far, I know of 3 such methods,
#1) Install a cross compiler on your PC, and other changes.
#2) Install a VM running a Linux Distro.
#3) This possibly new idea that I will try to explain.

Let me fist state that I am learning Linux, and far, far from being useful at it. Thus I hope to see if I can get some help from you smarter guys to see if I can pull this off, because I feel this is would be a good method for PC users. Disclaimer warning: I know one method is not considered good for everyone.

I have been using a VM on my PC which runs Ubuntu to compile for the ESP32. I then Eclipse in there to code for it. As those who have tried this way know this is not the greatest approach. For those that may not know, you can install Ubuntu bash command line in Win10. Its very handy and I use it often to try things I learn for Linux. You can read more about here about that: https://www.microsoft.com/en-us/store/p ... blggh4msv6.
I have been able to do everything in the command window as I can in the real Ubuntu's Terminal window.
Last night I though why dont I try installing the Toolchain for Linux there and see if it works. Quick recap here:
https://espressif-docs.readthedocs-host ... setup.html

It worked just fine, I can run make menuconfig and compile just fine. Now here is the twist/ed part.
On the PC side you can access those Linux files. I.E. root, home and so on. You can read more about that here:
https://www.howtogeek.com/261383/how-to ... e-in-bash/
For example, that location on my box its here:
C:\Users\Mike\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\Mike\esp-idf

I will install eclipse on my PC instead of using it through the VM (so it runs far faster and GUI looks normal) and point Eclipse to that folder location instead. I am so close to accomplishing this with the hello_wold example. I don't have any warnings in eclipse, yet when I build I run into a issue where I hit a Permission denied issue. I tried mucking with permissions and gain and loose success at it, but my limited knowledge even with googles help is keeping me from moving forward.

Should anyone else find that this might be another useful way to do this, and might be willing to throw some suggestions to try let me know and thanks for the time. Below is the last clip of the output from Eclipse when building hello_world example.

Code: Select all

Assembler messages:
Fatal error: can't create src/bootloader_random.o: Permission denied
make[2]: *** [/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/make/component_wrapper.mk:274: src/bootloader_random.o] Error 1
make[2]: Leaving directory '/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/hello_world/build/bootloader/bootloader_support'
make[1]: *** [/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/make/project.mk:453: component-bootloader_support-build] Error 2
make[1]: Leaving directory '/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/components/bootloader/subproject'
make: *** [/c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/esp-idf/components/bootloader/Makefile.projbuild:40: /c/Users/Mike/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/Mike/esp/hello_world/build/bootloader/bootloader.bin] Error 2

14:53:41 Build Finished (took 7s.411ms)

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

Re: ESP-IDF Compiling on Win10 with a twist

Postby kolban » Tue Apr 03, 2018 8:18 pm

Howdy,
I think you are describing the Windows Subsystem for Linux (WSL)?... see also:

viewtopic.php?t=3394

For the majority of work, this will be just fine ... however some reports are coming in of problems / unknown recipes required ... for working with JTAG in this environment.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: ESP-IDF Compiling on Win10 with a twist

Postby fly135 » Tue Apr 03, 2018 8:22 pm

I develop and compile using Windows with the MSYS32 and toolchain downloaded from links provided here...

https://esp-idf.readthedocs.io/en/lates ... index.html

I have used Windows 7, 8.1, and 10. When you do a make also add a -j8, which allows multiple cores to work at once and significantly speeds up the build. Also tell windows defender to exclude your development directories.

I have configured and compiled under Eclipse, but haven't bothered to get fully involved in that env. I use Notepad++ and build in MSYS.

I've used Linux VM's with Oracle VirtualBox but prefer the windows env when I can use it.

mikemoy
Posts: 599
Joined: Fri Jan 12, 2018 9:10 pm

Re: ESP-IDF Compiling on Win10 with a twist

Postby mikemoy » Tue Apr 03, 2018 8:28 pm

Neil,

I sure feel like a idiot now! I read that thread a few weeks ago, and forgot all about it!
Just goes to show how awesome of speaker you are. Took me that huge post, where you did it in a couple paragraphs. ;)

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: ESP-IDF Compiling on Win10 with a twist

Postby Vader_Mester » Wed Apr 04, 2018 5:57 am

fly135 wrote:I develop and compile using Windows with the MSYS32 and toolchain downloaded from links provided here...

https://esp-idf.readthedocs.io/en/lates ... index.html

I have used Windows 7, 8.1, and 10. When you do a make also add a -j8, which allows multiple cores to work at once and significantly speeds up the build. Also tell windows defender to exclude your development directories.

I have configured and compiled under Eclipse, but haven't bothered to get fully involved in that env. I use Notepad++ and build in MSYS.

I've used Linux VM's with Oracle VirtualBox but prefer the windows env when I can use it.
Maaaaaaaan, this is such a useful tip thank you! Gonna try it today!

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

Who is online

Users browsing this forum: Bing [Bot], OSCPUDEV and 92 guests