@@ -19,7 +19,7 @@ python -m esptool --chip esp32c3 write_flash 0x0 micro-rustscript-esp32-c3.facto
1919The boot order is fixed:
2020
21211 . ` /rustscript/main.vmbc ` on an SD card connected with CS on GPIO 7.
22- 2 . The dedicated 64 KiB ` rustscript ` flash partition at ` 0x0b0000 ` .
22+ 2 . The dedicated 64 KiB ` rustscript ` flash partition at ` 0x110000 ` .
23233 . The serial VMBC REPL at 115200 baud.
2424
2525An absent, unreadable, or missing SD script automatically falls through to the flash partition.
@@ -36,6 +36,8 @@ use framework::gpio as gpio;
3636use framework :: i2c as i2c;
3737use framework :: mcu as mcu;
3838use framework :: serial as serial;
39+ use framework :: wifi as wifi;
40+ use framework :: bluetooth as bluetooth;
3941
4042let ok : bool = gpio :: configure (8 , 1 );
4143let written : bool = gpio :: digital_write (8 , true );
@@ -49,6 +51,10 @@ i2c::close();
4951mcu :: delay_ms (100 );
5052let free_heap : int = mcu :: free_heap ();
5153serial :: write_line (" ready" );
54+
55+ let started : bool = wifi :: connect (" ssid" , " password" );
56+ let address : string = wifi :: local_ip ();
57+ let ble_ready : bool = bluetooth :: enable ();
5258```
5359
5460### GPIO
@@ -78,6 +84,18 @@ serial::write_line("ready");
7884` flash_size ` , ` random ` , ` restart ` , and ` deep_sleep_us ` . ` serial ` exports ` write_line ` , ` available ` ,
7985and ` read_bytes ` .
8086
87+ ### Wi-Fi and Bluetooth LE
88+
89+ The ` wifi ` API exports ` connect ` , ` disconnect ` , ` is_connected ` , ` rssi ` , and ` local_ip ` . ` connect `
90+ returns whether ESP-IDF accepted the asynchronous connection request; poll ` is_connected ` before
91+ using ` rssi ` or ` local_ip ` . The ` bluetooth ` API exports BLE-controller lifecycle operations:
92+ ` enable ` , ` disable ` , and ` is_enabled ` . Both use ESP-IDF APIs and are registered only on supported
93+ ESP targets.
94+
95+ ` wifi ` and ` bluetooth ` are independent Cargo/PlatformIO features. ESP release targets enable both
96+ by default through ` custom_rust_features ` ; removing either feature also removes its ESP-IDF includes
97+ and RSS host exports. The host ` arduino ` target exports neither API.
98+
8199The private host ABI lives in ` firmware/host_framework.cpp ` ; the public RSS modules live under
82100` programs/framework/ ` . This keeps script-facing APIs namespaced while allowing the VM to dispatch a
83101compact static function table.
@@ -132,6 +150,8 @@ export PATH=/mnt/TEMP/platformio/bin:$PATH
132150
133151pio run -e esp32-c3-devkitm-1
134152pio run -e arduino
153+ ci/install-esp-idf-s31.sh
154+ pio run -e esp32s31
135155.pio/build/arduino/program
136156```
137157
@@ -144,19 +164,25 @@ Outputs:
144164.pio/generated/esp32-blinky.vmbc
145165.pio/generated/rustscript.partition.bin
146166dist/micro-rustscript-esp32-c3.factory.bin
167+ dist/micro-rustscript-esp32-s31.factory.bin
147168```
148169
149170The factory image merges the ESP32 boot components, application, and default script partition. The
150171release includes the factory image, ELF, VMBC, packed script partition, flash helpers, partition CSV,
151172and SHA-256 checksums.
152173
174+ The ` esp32s31 ` target uses pinned ESP-IDF master preview support. ESP-IDF source, Python environment,
175+ toolchains, caches, Rust target artifacts, generated files, and build output are all kept under
176+ ` /mnt/TEMP ` ; only source and build configuration live in the repository.
177+
153178The ` arduino ` environment links ` pd-vm-nostd ` through an Arduino-compatible GPIO, delay, serial,
154179and allocator bridge. It runs the bridge and compiled VMBC program on the host before a board is
155180connected. A successful simulation ends with ` rss:status=0 ` .
156181
157182## ESP32 image size
158183
159- The ESP32 partition table uses a 640 KiB factory application slot and a 64 KiB VMBC slot. OTA data
184+ The ESP32 partition table uses a 1 MiB factory application slot and a 64 KiB VMBC slot. OTA data
160185and SPIFFS partitions are omitted because this image is flashed directly and script updates use the
161- dedicated VMBC partition. The measured factory image is 722,391 bytes, down from 2,164,183 bytes
162- (66.62%), while retaining SD boot, the flash script, and the serial VMBC REPL.
186+ dedicated VMBC partition. With ` wifi ` and ` bluetooth ` enabled, the measured factory image is
187+ 1,115,607 bytes, down from 2,164,183 bytes (48.45%), while retaining SD boot, the flash script,
188+ and the serial VMBC REPL.
0 commit comments