Problems with firmware generation

Hello,
I have problems generating firmware for D1 mini and also ESP32.
I use ESPHome Current version: 2021.10.3

INFO Reading configuration /config/esphome/pir-2sensor-01.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing pir-2sensor-01 (board: az-delivery-devkit-v4; framework: arduino; platform: espressif32 @ 3.3.2)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 520KB RAM, 16MB Flash
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.0.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <ESPmDNS> 1.0
Compiling /data/pir-2sensor-01/.pioenvs/pir-2sensor-01/src/esphome/components/api/api_connection.cpp.o
Compiling /data/pir-2sensor-01/.pioenvs/pir-2sensor-01/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/pir-2sensor-01/.pioenvs/pir-2sensor-01/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/pir-2sensor-01/.pioenvs/pir-2sensor-01/src/esphome/components/api/api_pb2_service.cpp.o

this is the output on my monitor.
The RasPi 3 then crashes regularly and I have to turn it off and on again.
I do not want to burn the firmware directly to the ESP32 but download it.
Sometimes it works, but this is very rare.
I have already changed the power supply and now use a 5.1V and 3A power supply.
Then I changed a microSD card and now use 64GB A2 type.
What else can I do?

Greetings Juergen

You can try with all other addons stopped. This could reduce the load on the CPU and help compete the compilation.

Increase you swap file size. Search the site for the thread. My rpi3 crashed recently each time I tried to generate new esp firmware until increased swap file size.

thanks for the quick help.
spiro: I have this link:
Link

tested. There was always an error message in the log.
I am probably too stupid…?

sheminasalam:
i stopped all add-ons except deCONZ and ESPHome, that helped. The first time it ran through without interruption and crash.
I will test it some more and hope it stays like this.

Thanks again…

Compile on a computer with more RAM.