What's actually here
Everything that knows about the chip lives in board/, so a program stays
readable as just the program. Write yours in src/main.c, include
esp32s3.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 |
|---|---|
src/main.c |
Your program. A skeleton: boot the chip, then stop |
examples/ |
One runnable program per peripheral — see its own README |
include/ |
The headers: the whole API surface |
board/esp32s3.c |
board_init() — zero .bss, disable watchdogs, raise the clock |
board/esp32s3_clock.c |
CPU clock: read it, switch to 160 MHz, ungate peripherals |
board/esp32s3_console.c |
Text over USB-Serial-JTAG |
board/esp32s3_delay.c |
Busy-wait timing |
board/esp32s3_gpio.c |
Digital pins, and the GPIO matrix peripherals reach them through |
board/esp32s3_uart.c |
Hardware serial ports |
board/esp32s3_i2c.c |
I2C master |
board/esp32s3_spi.c |
SPI master on GP-SPI2 |
board/esp32s3_pwm.c |
PWM on the LEDC peripheral |
board/esp32s3_watchdog.c |
Disable the ROM's watchdogs |
board/led.c |
Addressable RGB LED (WS2812) bit-banging driver |
board/esp32s3.ld |
Where the two segments land in SRAM |
Makefile |
Compile, link, convert to a flash image, flash it |
src/main.c holds only board_init() and a halt. A program that does
something is still just:
#include "esp32s3.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 |
|---|---|
src/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.