Arduino uses a **C/C++ compiler** behind the scenes, and the specific compiler it uses is part of the **GNU Compiler Collection (GCC)**. The exact compiler depends on the type of Arduino board you are using. Let's break it down in a detailed and clear way so everyone can understand:
---
### 1. **Arduino UNO and other AVR-based boards**
For classic Arduino boards like:
* **Arduino UNO**
* **Arduino Nano**
* **Arduino Mega**
* **Arduino Leonardo**
These are based on the **AVR microcontrollers** (like the ATmega328P). They use:
> **AVR-GCC (GNU Compiler Collection for AVR)**
* **Compiler name**: `avr-gcc`
* This is a standard, open-source compiler used to compile C/C++ code for AVR microcontrollers.
* It takes your Arduino code (written in a simplified form of C++) and converts it into machine code that the AVR chip can run.
---
### οΈ 2. **Arduino Due**
* The Arduino Due is based on an **ARM Cortex-M3 processor**.
* It uses:
> **arm-none-eabi-gcc (ARM GCC Toolchain)**
* **Compiler name**: `arm-none-eabi-gcc`
* This toolchain is used for compiling C/C++ code for ARM-based microcontrollers.
* It's a different compiler than the one used for AVR boards because the architecture of the chip is completely different.
---
### β‘ 3. **Arduino boards based on other chips**
* **Arduino Zero**, **MKR series**, **Nano 33 series**, and other modern boards use **ARM Cortex-M0+, M4**, or even **ESP32** chips.
Depending on the chip architecture, Arduino uses:
#### For ARM-based boards:
> **arm-none-eabi-gcc**
#### For ESP32 or ESP8266 boards:
> **Xtensa GCC toolchain** (from Espressif)
* For **ESP8266**: `xtensa-lx106-elf-gcc`
* For **ESP32**: `xtensa-esp32-elf-gcc`
These compilers are tailored to the special processors made by Espressif (the company that makes ESP8266 and ESP32 chips).
---
### How Arduino Makes It Easy
You donβt have to worry about which compiler is being used because the **Arduino IDE** (Integrated Development Environment) handles this for you automatically. Here's what happens:
1. You write code in the Arduino IDE.
2. The IDE **translates your sketch** into standard C++ behind the scenes.
3. The appropriate GCC compiler for your board is **selected automatically**.
4. The IDE compiles your code and uploads the binary to your board.
---
### Summary Table
| Arduino Board | Chip Type | Compiler Used |
| ----------------------- | ----------------- | ---------------------- |
| Arduino UNO, Mega, Nano | AVR (ATmega) | `avr-gcc` |
| Arduino Due | ARM Cortex-M3 | `arm-none-eabi-gcc` |
| Arduino Zero, MKR | ARM Cortex-M0+/M4 | `arm-none-eabi-gcc` |
| ESP8266-based boards | Xtensa (ESP8266) | `xtensa-lx106-elf-gcc` |
| ESP32-based boards | Xtensa (ESP32) | `xtensa-esp32-elf-gcc` |
---
If you're curious and want to explore more, you can turn on **verbose output** in the Arduino IDE settings, and it will show you the exact compiler commands being used during compilation.
Would you like an example of how a sketch is compiled and uploaded step by step?