What's actually here
A clone has four things in it:
Makefile compile, link, convert to a flash image, flash it
main.c your program
esp32s3/ the support library - the chip and this board
examples/ one runnable program per peripheralexamples/ is reference material, not a dependency. Delete the directory and
make still builds main.c against the library exactly as before.
Everything that knows about the chip lives in esp32s3/, so a program stays
readable as just the program. Write yours in main.c, include board.h
(the umbrella) plus whatever peripheral drivers you need on top — led.h for
the onboard RGB LED — and never touch a register directly.
| File | Job |
|---|---|
main.c |
Your program. A skeleton: boot the chip, then stop |
examples/ |
One runnable program per peripheral — see its own README |
esp32s3/include/ |
The headers: the whole API surface |
esp32s3/src/board.c |
board_init() — zero .bss, disable watchdogs, raise the clock |
esp32s3/src/clock.c |
CPU clock: read it, switch to 160 MHz, ungate peripherals |
esp32s3/src/console.c |
Text over USB-Serial-JTAG |
esp32s3/src/delay.c |
Busy-wait timing |
esp32s3/src/gpio.c |
Digital pins, and the GPIO matrix peripherals reach them through |
esp32s3/src/uart.c |
Hardware serial ports |
esp32s3/src/i2c.c |
I2C master |
esp32s3/src/spi.c |
SPI master on GP-SPI2 |
esp32s3/src/pwm.c |
PWM on the LEDC peripheral |
esp32s3/src/watchdog.c |
Disable the ROM's watchdogs |
esp32s3/src/led.c |
Addressable RGB LED (WS2812) bit-banging driver |
esp32s3/linker.ld |
Where the two segments land in SRAM |
Makefile |
Compile, link, convert to a flash image, flash it |
main.c holds only board_init() and a halt. A program that does
something is still just:
#include "board.h"
#include "led.h"
void _start(void)
{
board_init(); /* .bss, watchdogs, 160 MHz */
led_init(21);
for (;;) {
led_set_color(LED_RED);
delay_ms(500);
led_set_color(LED_OFF);
delay_ms(500);
}
}Sizes, as text in the linked image:
| Program | Size |
|---|---|
main.c — boot and halt |
352 B |
| the blink above | 980 B |
examples/gpio_button.c |
1.4 KB |
| a program using all four buses | 5.4 KB |
Every driver is compiled every time, but --gc-sections drops each one the
program never calls, so an unused bus costs nothing.