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 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 (or your chosen name)
Create a new folder, e.g. sparrow_shell_i2c_scan and add the standard layout:
sparrow_shell_i2c_scan/ CMakeLists.txt prj.conf src/main.c boards/esp32c6_devkitc_esp32c6_hpcore.overlay
Use a prj.conf that enables:
Put your known-good configuration here:
<PASTE YOUR WORKING Lab 1 prj.conf HERE>
Checklist (ensure these are enabled in some form):
CONFIG_SERIAL=yCONFIG_CONSOLE=yCONFIG_UART_CONSOLE=yCONFIG_SHELL=yCONFIG_SHELL_BACKEND_SERIAL=yCONFIG_I2C=yYour overlay must:
Place your working overlay:
<PASTE YOUR WORKING Lab 1 overlay HERE>
Your src/main.c should:
Place your working code:
<PASTE YOUR WORKING Lab 1 main.c HERE>
Build:
west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
Flash:
west flash
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
Copy Lab 1 project to a new folder, e.g. sparrow_shell_lfs.
Enable:
Place your known-good configuration:
<PASTE YOUR WORKING Lab 2 prj.conf HERE>
Checklist (ensure these are enabled in some form):
CONFIG_FILE_SYSTEM=yCONFIG_FILE_SYSTEM_LITTLEFS=yCONFIG_FLASH=yCONFIG_FLASH_MAP=yCONFIG_FLASH_PAGE_LAYOUT=y (often required)CONFIG_FS_SHELL=y (or equivalent in your tree)If your Zephyr tree provides a separate Kconfig symbol for file system shell, keep it enabled as in your working setup.
Your overlay must define a partition in flash. Example concept:
storage_partition labellabel = “storage”Important: The partition address/size depends on the board’s flash layout.
Place your working overlay:
<PASTE YOUR WORKING Lab 2 overlay HERE>
Your main.c should:
fs_mount_t with:/lfs)storagefs_mount()Place your working code:
<PASTE YOUR WORKING Lab 2 main.c HERE>
Build:
west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
Flash:
west flash
Test in shell:
fs (to see available fs commands)ls /ls /lfs (if mounted at boot)cd /lfspwdExpected: you can navigate the mount point and list directory contents.
storage_partition labelstorage partition exists in build/zephyr/zephyr.dtsCONFIG_FS_SHELL (and any related symbols) are enabledBuild a webserver that:
http:<device-ip>:<port>/
==== Important performance note (ESP32 Wi‑Fi memory) ====
Wi‑Fi + TLS stacks can be memory hungry. For a simple HTTP server:
* keep responses small
* avoid allocating large buffers repeatedly
* limit concurrent connections (1 client at a time is fine for a lab)
==== Step 1: Create the project ====
Create a new folder, e.g. sparrow_web_bme680 using the standard layout.
==== Step 2: Kconfig settings (prj.conf) ====
Enable:
* networking core
* sockets
* DHCPv4
* Wi‑Fi mgmt
* logging
* sensor subsystem + BME680 driver
Place your working configuration:
<code>
<PASTE YOUR WORKING Lab 3 prj.conf HERE>
</code>
Checklist (ensure these are enabled in some form):
* CONFIG_NETWORKING=y
* CONFIG_NET_IPV4=y
* CONFIG_NET_DHCPV4=y
* CONFIG_NET_SOCKETS=y
* CONFIG_NET_TCP=y
* CONFIG_WIFI=y
* CONFIG_NET_L2_WIFI_MGMT=y
* CONFIG_SENSOR=y
* CONFIG_BME680=y
* CONFIG_I2C=y
==== Step 3: Wi‑Fi credentials configuration ====
If your app uses custom Kconfig symbols for SSID/password, include your working Kconfig file and the prj.conf entries.
Place your working Kconfig:
<code>
<PASTE YOUR WORKING Lab 3 Kconfig HERE>
</code>
In prj.conf, you will typically have:
<code>
<PASTE YOUR WORKING SSID/PASSWORD Kconfig assignments HERE>
</code>
> Security tip: Avoid committing real credentials to version control.
==== Step 4: Devicetree overlay (I2C + BME680) ====
Your overlay must:
* configure I2C pins for Sparrow
* define the BME680 node with the proper I2C address (commonly 0x76 or 0x77)
Place your working overlay:
<code>
<PASTE YOUR WORKING Lab 3 overlay HERE>
</code>
==== Step 5: main.c (Wi‑Fi + DHCP + HTTP + sensor sampling) ====
Your application should:
* register Wi‑Fi and IPv4 events (optional but very helpful)
* trigger scan/connect
* start DHCP when Wi‑Fi link is up
* poll BME680 and store last sample in a global struct
* run a simple HTTP server thread:
* accept connection
* respond with a plain text or JSON payload
Place your working code:
<code>
<PASTE YOUR WORKING Lab 3 main.c HERE>
</code>
==== Step 6: Build, flash, test ====
Build:
<code bash>
west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
</code>
Flash:
<code bash>
west flash
</code>
Open serial output and note the printed IP address.
From a machine on the same LAN, open:
* http:<device-ip>:<port>/Expected:
For each lab, record:
i2c_scan outputls /lfs and pwdOptional: include a short README in each project with:
rm -rf build west build -b esp32c6_devkitc/esp32c6/hpcore -p auto .
After build:
build/zephyr/zephyr.dtsSearch for:
flash0partitionsstorage partitionAfter build:
build/zephyr/.configSearch for:
CONFIG_SHELLCONFIG_FILE_SYSTEMCONFIG_WIFICONFIG_NET_SOCKETS