This is an old revision of the document!
This lab walks you through building three Zephyr applications for Sparrow:
Open a terminal in your Zephyr workspace and run:
west --version west boards | grep esp32c6
If the board (ESP32C6 Xiao) is listed and west works, continue.
Tip: If you switch branches or update modules often, use:
> west update
Each lab uses the same basic structure:
<APP_ROOT>/
CMakeLists.txt
prj.conf
src/
main.c
boards/
esp32c6_devkitc_esp32c6_hpcore.overlay
(optional) Kconfig
Build command used in all labs:
west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
Flash:
west flash -d build --runner esp32
Monitor serial output:
screen <your_port_name> 115200
Build a UART shell application that includes standard Zephyr shell commands and adds a custom command:
i2c_scan — scans the I2C bus for responding device addressessparrow$help, kernel, device, log, etc.i2c_scan
Create a new folder, e.g. sparrow_console and unzip the project here.
sparrow_shell_i2c_scan/ CMakeLists.txt prj.conf src/main.c boards/esp32c6_devkitc_esp32c6_hpcore.overlay
Build:
west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
Flash:
west flash -d build --runner esp32
Open the serial console and test:
helpi2c_scanExpected: you see a list of detected I2C addresses or “no devices found”.
Build a shell app that provides a “Linux-like” file navigation experience (as much as Zephyr supports), using:
Typical workflow in shell:
fs mount (or auto-mount at boot)ls /lfscd /lfspwd
Create a new folder, e.g. sparrow_littlefs and unzip the project here.
Build:
west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
Flash:
west flash -d build --runner esp32
Test in shell:
fs (to see available fs commands)ls /ls /lfs (it is mounted at boot)cd /lfspwdfs mkdir /lfs/folder1fs write /lfs/folder1/hello.txt -o 0 48 65 6c 6c 6f 20 57 6f 72 6c 64 21fs cat /lfs/folder1/hello.txtExpected: you can navigate the mount point and list directory contents, create and view files, etc..
storage_partition labelstorage partition exists in build/zephyr/zephyr.dtsCONFIG_FS_SHELL (and any related symbols) are enabledBuild a webserver that:
Wi‑Fi + TLS stacks can be memory hungry. For a simple HTTP server:
Create a new folder, e.g. sparrow_web_bme and unzip the project here.
Build:
west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
Flash:
west flash -d build --runner esp32
Open serial output and note the printed IP address.
From a machine on the same LAN, open http:<device-ip>:<port>''
Expected:
* browser receives a response containing the latest sensor values
==== Troubleshooting ====
* No Wi‑Fi logs:
* raise log level (e.g. default level or module-specific)
* ensure Wi‑Fi mgmt is enabled
* No IP address:
* verify DHCP is enabled
* ensure DHCP is started after link is up
* “memory allocation failed” from Wi‑Fi adapter:
* reduce concurrent HTTP clients
* reduce buffer sizes (HTTP response buffer)
* avoid repeated dynamic allocations in the HTTP thread
* consider increasing heap pool size only if you have flash/RAM headroom
* Browser connects but gets no response:
* verify socket calls are using Zephyr’s socket headers
* verify server binds to INADDR_ANY on the chosen port
* ensure response includes valid HTTP headers and CRLF