Compiling for ESP32

181 views
Skip to first unread message

Ulf Holt

unread,
Oct 5, 2024, 3:22:47 PM10/5/24
to TasmotaUsers
I have successfully been able to compile different kernels for ESP8266, and today I wanted to try ESP32, but so far no luck. Has anybody succeeded and can tell me how to do it? I am using VSCode and PlatformIO on Windows 11 Pro latest update. I have tried to search, but looks like I am on another planet. I was told to edit Platformio_override.ini and include the chip I was using, but got tons of errors - looks like something called ESP-IDE was missing. Tried tio install, but no luck.

All the best from
Ulf

Philip Knowles

unread,
Oct 7, 2024, 5:41:35 AM10/7/24
to Ulf Holt, TasmotaUsers
I'd use TasmoCompiler




From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Ulf Holt <ulf....@gmail.com>
Sent: 05 October 2024 20:22
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Compiling for ESP32
 
I have successfully been able to compile different kernels for ESP8266, and today I wanted to try ESP32, but so far no luck. Has anybody succeeded and can tell me how to do it? I am using VSCode and PlatformIO on Windows 11 Pro latest update. I have tried to search, but looks like I am on another planet. I was told to edit Platformio_override.ini and include the chip I was using, but got tons of errors - looks like something called ESP-IDE was missing. Tried tio install, but no luck.

All the best from
Ulf

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/e9a1cc2b-4058-4a04-ae1e-9d4500ed678dn%40googlegroups.com.

Ulf Holt

unread,
Oct 8, 2024, 2:58:23 AM10/8/24
to TasmotaUsers
Thank you so much for the advice!
I tried to have a look at the link, but I didn't understand much of it - looks like docker is involved?

I have checked platformio.ini and I can see it is much more complicated than what it would be if I start a new project using an ESP32-card from scratch. I am not sure if the card I am using is supported, I am using ESP32-C3-MINI-1 from Epspessif. I cannot find the specific card, but I find 2 cards from Espressif. I migth be able to just try to change the platformio.ini file from Tasmota and use one of the two entries instead, but there migth be more things that should be cahnged.

Best regards

Ulf

Andrew Russell

unread,
Oct 8, 2024, 4:05:55 AM10/8/24
to Ulf Holt, TasmotaUsers
Ulf,
no, you don't need Docker on your system. In fact, you don't need anything on your system. It's all done in the cloud.
It really is very simple, and you should try it.

Try watching this: "Compile and install Tasmota using ONLY a web browser"

I could not find a video on TasmoCompiler, but that is even simpler than the above.
TasmoCompiler is based on the method above, but it's all wrapped in a GUI, so you just tick some boxes and you are done.

Andrew


Justin Adie

unread,
Oct 8, 2024, 4:17:44 AM10/8/24
to Ulf Holt, TasmotaUsers
Esp32c3 is supported by platformio

It is also supported by tasmota but comes with warnings if you read the chat on the topic.  Ensure you are selecting the tasmota2c3.bin binary.  For custom builds the board target will be called espressif generic esp32-C3 ...

I have not had trouble compiling for esp32 variants using platformIO.   To compile, go into the tasks menu and select the build target (tasmota32c3 assuming you don't want Bluetooth). Wait for the menu to be constructed (this takes a long time on my laptops: minutes) and then choose the task you want to perform as you would for an esp8266




ulf....@gmail.com

unread,
Oct 8, 2024, 5:15:56 AM10/8/24
to Andrew Russell, TasmotaUsers

Thank you, Andrew

 

Problem is that the video assumes you know how to set up the environment, which I don't. Tried to have a look, but did not know which options to use.

 

I am definitely not an expert on platformio, but I was able to compile on esp8266 platform and make .bin files that works implementing support for MQTT over SSL + some extra sensors. Now I want to try the same using ESP32. Hoped this could be done by editing the platromio.ini file, but I suppose there must be something missing. It is not enough to change the board to esp32-c3-devkitm-1. It gives me an error:

Error: Unknown board ID 'esp32-c3-devkitm-1'

ulf....@gmail.com

unread,
Oct 8, 2024, 5:21:59 AM10/8/24
to Justin Adie, TasmotaUsers

Thank you, Justin.

 

I suppose my problem is that I do not set up platformio correct. I have downloaded the Tasmota-master, and if I just use a build task on my_user_config.h then I can compile a binary that works on esp8266. Problem is that I want to compile for esp32.

 

As you might understand, I am in swimming in deep water, so I might be asking stupid questions (have been working on customer support for DEC a couple of years, so I know what kind of questions you could get😊)

 

All the best from

 

UIf

 

Fra: Justin Adie <justi...@adieandco.com>
Sendt: 08 October 2024 10:17
Til: Ulf Holt <ulf....@gmail.com>
Kopi: TasmotaUsers <sonof...@googlegroups.com>
Emne: Re: Compiling for ESP32

 

Esp32c3 is supported by platformio

Justin Adie

unread,
Oct 8, 2024, 6:38:03 AM10/8/24
to Ulf Holt, SonoffUsers
Hi 

With platformIO if you run the default task then it does a default action (which may actually compile every single target and take hours) and may not be what you actually want.

You should just run the task you want. The steps are these:

1. download the latest version of the tasmota source code.  
2 open VS Code and click on platformIO (the alien in the screen shot below)
3. wait for the core to initialise.  Press pick a folder
4. select the folder that you downloaded the source code into
5. locate user_config_override.ini and make the overrides that you need.
6. click back on platformIO
7. In the project tasks section locate your build target (see below).  And expand the section.
8. Wait.  A very very very long time.  VS Code and PlatformIO are building the build-target tasks in the background.  On my laptop this takes 15 minutes or more.
9. Plug your board in and make sure it is in download mode.
10. click Upload.
11. Wait ….


Justin


PastedGraphic-1.png

PastedGraphic-2.png

PastedGraphic-3.png

PastedGraphic-4.png

PastedGraphic-5.png

Justin Adie

unread,
Oct 8, 2024, 7:30:10 AM10/8/24
to Ulf Holt, SonoffUsers
Could you check the registry at this key: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlFileSystem

Looking for the value of LongPathsEnabled.  Should be set to 1. 



On 8 Oct 2024, at 12:23, <ulf....@gmail.com> <ulf....@gmail.com> wrote:

Thank you so much.
 
Not sure if I was able to follow you correctly, but I now have a build task called tasmota32c3. When I try to run it I get the following error:
 
riscv32-esp-elf-g++: fatal error: cannot execute 'c:/users/ulfho/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/as.exe': CreateProcess: No such file or directory
 
 
 
Fra: Justin Adie <justi...@adieandco.com> 
Sendt: 08 October 2024 12:38
Til: Ulf Holt <ulf....@gmail.com>
Kopi: SonoffUsers <sonof...@googlegroups.com>
Emne: Re: Compiling for ESP32
 
Hi 
 
With platformIO if you run the default task then it does a default action (which may actually compile every single target and take hours) and may not be what you actually want.
 
You should just run the task you want. The steps are these:
 
1.            download the latest version of the tasmota source code.  
2              open VS Code and click on platformIO (the alien in the screen shot below)
3.            wait for the core to initialise.  Press pick a folder
4.            select the folder that you downloaded the source code into
5.            locate user_config_override.ini and make the overrides that you need.
6.            click back on platformIO
7.            In the project tasks section locate your build target (see below).  And expand the section.
8.            Wait.  A very very very long time.  VS Code and PlatformIO are building the build-target tasks in the background.  On my laptop this takes 15 minutes or more.
9.            Plug your board in and make sure it is in download mode.
10.          click Upload.
11.          Wait ….
 
 
Justin
 
 
image001.png
 
image002.png
 
image003.png
 
image004.png
 
image005.png

Justin Adie

unread,
Oct 8, 2024, 8:16:42 AM10/8/24
to Ulf Holt, SonoffUsers
If you’ve changed the setting then you need to reboot afterwards.  

If you still get the error try these steps:

1. close VS Code
2. in your .platformio folder (a hidden folder in your profile):
a. delete the .cache folder
b. delete packages folder
c. delete platforms folder.


Then open VS Code and open your workspace and wait for the IDE to reinitialise.  Once finished, try the upload task again.



On 8 Oct 2024, at 13:05, <ulf....@gmail.com> <ulf....@gmail.com> wrote:

Maybe I should reinstall vscode and platformio – the registry entry was 0 when I installed.

Philip Knowles

unread,
Oct 8, 2024, 8:27:08 AM10/8/24
to Ulf Holt, TasmotaUsers
A fair way down there is a link to the easy way to use it https://gitpod.io/#https://github.com/benzino77/tasmocompiler You need to enable popups

Sent: 08 October 2024 07:58
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Re: Compiling for ESP32
 

Justin Adie

unread,
Oct 8, 2024, 9:04:17 AM10/8/24
to Ulf Holt, SonoffUsers
Are you able to compile any other target?  Say the standard ESP8266 variant.  

Also check with you have anti-virus software that is monitoring the platform io directories.  That may screw things up. 



On 8 Oct 2024, at 13:52, <ulf....@gmail.com> <ulf....@gmail.com> wrote:

Rebooted after changing the registry settings. Removed the directories you told me to delete. I then started VS Code and waited for the reinitialise, I still get same error.
 
Tried to follow the path using file explorer and it stops at:
C:\Users\ulfho\.platformio\packages\toolchain-riscv32-esp\bin where I find a lot of executables

Ulf Holt

unread,
Oct 12, 2024, 9:06:04 AM10/12/24
to TasmotaUsers
Final update:

Works fine on my dektop after changing the file platformio_override.ini and adding

core_dir = C:.platformio
workspace_dir = C:.pio

under the label [platformio]

Did not have the same success on my laptoop, so I installed Ubuntu and gave it a try. Had to run
sudo apt install python3-venv to be able to install platformio in vscode, but then compilation works like a dream.

The compilation was fastest on Ubuntu, though it's a 5 year old Dell Latitude 5410 - 15 GM RAM and 1 TB SSD disk. My desktop has 64 gb RAM and running with m.2 drives. I recon the problem is
the file system on Windows -. which i dead slow compared to Linux

All the best from

Ulf

Justin Adie

unread,
Oct 12, 2024, 9:24:01 AM10/12/24
to Ulf Holt, TasmotaUsers
Very useful info.  Thanks for sharing Ulf.  

Happy birthday to Fru. Holt!



Reply all
Reply to author
Forward
0 new messages