Custom Build - newbie questions

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Affinite
Normal user
Posts: 152
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Custom Build - newbie questions

#1 Post by Affinite » 31 Dec 2024, 18:57

OK so Ive used ESPEASY for years with standard builds but not ventured into custom builds until now.
Ive setup the Platform IO build environment on my laptop and I can build a simple custom ESP32 bin but I can only define a couple of plugins in Custom.h
If I try to define more than 2 or 3 plugins or add a couple of controllers, the build process fails.

What am I missing ?

My second question is what does
3) define USE_CUSTOM_H as a build flags. ie : export PLATFORMIO_BUILD_FLAGS="'-DUSE_CUSTOM_H'"
in Custom.h mean? Should I be doing something here ?

Third question - how to I include a recently released plugin such as P176. Simply defining it in Custom.h doesn't wok.

The above is very frustrating as my PC is very slow to build/compile and I have to wait 45 minutes for a build to complete (or fail) :(

Thanks and Happy New Year to all.

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Custom Build - newbie questions

#2 Post by Ath » 31 Dec 2024, 20:16

Affinite wrote: 31 Dec 2024, 18:57 OK so Ive used ESPEASY for years with standard builds but not ventured into custom builds until now.
Ive setup the Platform IO build environment on my laptop and I can build a simple custom ESP32 bin but I can only define a couple of plugins in Custom.h
If I try to define more than 2 or 3 plugins or add a couple of controllers, the build process fails.

What am I missing ?
For starters, I hope (assume?) you have used this Development guide (just start reading at the top, and work your way down, if you didn't already), including creating a fork in your own Github account?
What exact Custom environment are you trying to build?

Part of the process (though optional) is creating your own Custom.h file, by copying Custom-sample.h, in the same folder, and adjusting that Custom.h. Especially for an ESP32 (either 4MB, 8MB or 16MB Flash) should leave ample room for a couple of dozen plugins.
Affinite wrote: 31 Dec 2024, 18:57 My second question is what does
3) define USE_CUSTOM_H as a build flags. ie : export PLATFORMIO_BUILD_FLAGS="'-DUSE_CUSTOM_H'"
in Custom.h mean? Should I be doing something here ?
That instruction is part of the Arduino IDE manual, that's also written down in some of the source files. That should be ignored when using VSCode/PlatformIO (I'll see if I can remove that from the source code).
Affinite wrote: 31 Dec 2024, 18:57 Third question - how to I include a recently released plugin such as P176. Simply defining it in Custom.h doesn't wok.
Enabling a plugin should be the simple process of enabling (or adding if that's missing) a #define USES_P176 on a separate line of the Custom.h file (I've corrected that omission in an open PR that will be merged soon)
Affinite wrote: 31 Dec 2024, 18:57 The above is very frustrating as my PC is very slow to build/compile and I have to wait 45 minutes for a build to complete (or fail) :(
Hm, what kind of laptop do you use? If it's Windows, be sure to exclude the folder with the ESPEasy source code from any Anti-virus action, as the number of files opened during the build process is heavily crippled by all Windows AV products (and partially by Windows itself). With a fittingly capable computer you could possibly configure for using WSL (Windows Subsystem for Linux, also described in that documentation), that should reduce build-times by up to 50%. On my current Windows laptop with an AMD Ryzen 7 5000 series mobile CPU an ESP32 MAX build takes ~6.5 minutes in Windows, and less than 4 minutes when using WSL.
Keeping the laptop on net-power instead of running from the battery will also improve (shorten) the build-time.
Affinite wrote: 31 Dec 2024, 18:57 Thanks and Happy New Year to all.
Thanks, the same to you and your loved ones :D
/Ton (PayPal.me)

Affinite
Normal user
Posts: 152
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Custom Build - newbie questions

#3 Post by Affinite » 01 Jan 2025, 17:10

Thanks for the advice ton,
I removed/disabled the AV software on my build laptop and the build worked first time :D
(Still took 45 minutes but I don't care - I'm not in a production environment like you.)

I now want to add fonts to P95 (Id like to include roboto)
Should I follow the advice you gave here
viewtopic.php?p=70748&hilit=fonts#p70621
to enable the fonts ? and do I need to #define PLUGIN_USES_ADAFRUITGFX // Used by Display plugins using Adafruit GFX library in Custom.h ?
Edit: No need to reply - I went ahead and enabled the fonts as per link above and it worked

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Custom Build - newbie questions

#4 Post by TD-er » 01 Jan 2025, 19:24

Building in Windows on my core i5 laptop also takes 40 - 50 minutes to make a single ESP32-xx build. (ESP8266 takes much less time)
On the same laptop using WSL2 (or native using Ubuntu) it takes about 10 minutes for a single build.

On my Ryzen9 desktop PC it takes 10 - 15 minutes on Windows and 2 - 3 minutes on the same computer using WSL2 (building on Linux file system)

Building on Windows is for some reason extremely slow.

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Custom Build - newbie questions

#5 Post by Ath » 01 Jan 2025, 21:51

TD-er wrote: 01 Jan 2025, 19:24 Building on Windows is for some reason extremely slow.
What AV package do you have installed?
My Windows Defender allows to exclude the folder where I 'git cloned' the repository.
Storage is on (NVME)SSD here, I sort of assume that's also true for your system?

Windows build for the rather slow tool chain of ESP32-S3 takes between 6:30 and 7 minutes when on net-power, and around 8 to 9 minutes when running from battery (and not in power-saving mode, below 20% charge).

Or is the 'trick' that I only build a single environment ('Project Task' in VSCode terms)...? :o as I never build the complete project locally :)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Custom Build - newbie questions

#6 Post by TD-er » 01 Jan 2025, 22:10

I have F-secure installed, but even with the virusscanner disabled it takes quite long to build on Windows.

Got the impression that accessing lots of files in parallel is dealt with by serializing its access.
So effectively rendering multi-thread builds useless as it is causing threads to wait for eachother.

I got 12 cores, 24 threads on my Ryzen9.

And I always build only a single PIO env.

N.B. building using WSL2 is done on exactly the same hardware on top of Windows.
But then I'm using an ext4 file system of WSL2 and thus not the filesystem overhead of Windows itself, which is about 3x - 5x faster compared to building on Windows itself.
When building using WSL2 on a 'mapped' Windows drive via /mnt/c/... it is 3x - 5x slower than natively on Windows.

User avatar
chromo23
Normal user
Posts: 1004
Joined: 10 Sep 2020, 16:02
Location: germany

Re: Custom Build - newbie questions

#7 Post by chromo23 » 01 Jan 2025, 22:27

On my MacBook it takes around 2 minutes for the S3 and 1,5 Minutes for a ESP32 classic... :P

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Custom Build - newbie questions

#8 Post by Ath » 01 Jan 2025, 22:31

TD-er wrote: 01 Jan 2025, 22:10 Got the impression that accessing lots of files in parallel is dealt with by serializing its access.
So effectively rendering multi-thread builds useless as it is causing threads to wait for eachother.
I can only assume this is the actual (big) flaw in Windows, caused by the AV still being active, even when it's turn "off". The only way to avoid AV interference is by having no AV installed at all, but that's currently not possible on Windows, as Defender can't be uninstalled AFAIK. The low-level file system drivers that do the inspection probably aren't ever disabled, causing the behavior you describe.
Once they (MS) would bother to rebuild the AV scanning to be multi-threaded, this should become less of an issue.
chromo23 wrote: 01 Jan 2025, 22:27 On my MacBook it takes around 2 minutes for the S3 and 1,5 Minutes for a ESP32 classic... :P
There are too many Windows dependencies for me to switch to a Macbook... :? WSL2 is probably the closest I can get to a Macbook (as it's essentially running a form of Linux (Minix))
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Custom Build - newbie questions

#9 Post by TD-er » 01 Jan 2025, 22:50

Yep, Mac does use the same kind (as in similar approach) of file system I/O and process scheduling as Linux does.

I am now using WSL2 do most of the Windows issues are now no longer an issue for me (e.g. also the max. path length, which is often an issue on Windows too)

Smotek7
Normal user
Posts: 222
Joined: 01 Aug 2020, 16:18
Location: SK

Re: Custom Build - newbie questions

#10 Post by Smotek7 » 13 Feb 2025, 17:03

I'll use this topic so I don't start another one.
The Arduino IDE manual says version 1.8.13.
Does it work the same in v2.xx? Because when creating a portable version, it has a different structure of ardesars.

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Custom Build - newbie questions

#11 Post by TD-er » 13 Feb 2025, 17:22

Where is a manual telling you to use Arduino IDE?
We strongly advice against using Arduino IDE but use VS code + PlatformIO instead

Smotek7
Normal user
Posts: 222
Joined: 01 Aug 2020, 16:18
Location: SK

Re: Custom Build - newbie questions

#12 Post by Smotek7 » 13 Feb 2025, 17:32

I started with this:
https://espeasy.readthedocs.io/en/lates ... noIDE.html

I use Arduino IDE for simple things.
I didn't want to get into VScode

TD-er
Core team member
Posts: 9882
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Custom Build - newbie questions

#13 Post by TD-er » 13 Feb 2025, 17:58

Well technically it should be possible to use Arduino IDE, but I haven't tried it myself for years.
Also the build process does include some quite specific PlatformIO/PIOArduino build stuff, so it is possible you need to make changes to make it build using Arduino IDE.

I strongly advice against using Arduino IDE as it will be a lot of work to setup to compile ESPEasy with it.

If you have a Linux environment (or Ubuntu running in WSL2), you can also build it using command line as you probably only want to include/exclude some plugins/controllers.

For building in Linux, see: https://github.com/letscontrolit/ESPEas ... ESPeasy.sh

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 18 guests