### Wire Placement Example Source: https://docs.wokwi.com/diagram-format This example demonstrates the syntax for the wire placement mini-language, specifying vertical and horizontal movements for both source and target pins. ```json ["v10", "h5", "*", "v-15", "h10"] ``` -------------------------------- ### Install Wokwi CLI on Windows (PowerShell) Source: https://docs.wokwi.com/wokwi-ci/cli-installation Execute this command in PowerShell to install the Wokwi CLI on Windows. ```powershell iwr https://wokwi.com/ci/install.ps1 -useb | iex ``` -------------------------------- ### Manage Libraries with libraries.txt Source: https://docs.wokwi.com/guides/libraries The libraries.txt file lists all installed libraries. You can install specific versions by appending '@' followed by the version number to the library name. ```plaintext # Sample libraries.txt file: Servo FastLED # Install a specific version of a library: MySensors@2.3.0 ``` -------------------------------- ### Install Wokwi CLI on Linux/macOS Source: https://docs.wokwi.com/wokwi-ci/cli-installation Use this command to download and execute the installation script for the Wokwi CLI on Linux and macOS systems. ```shell curl -L https://wokwi.com/ci/install.sh | sh ``` -------------------------------- ### Install ESP-IDF Wokwi Extension Source: https://docs.wokwi.com/wokwi-ci/cli-installation Install the Wokwi extension for ESP-IDF to enable access from `idf.py`. This command uses pip for installation. ```python pip install idf-wokwi ``` -------------------------------- ### Set Temporary Breakpoint and Continue Source: https://docs.wokwi.com/gdb-debugging Use 'tbreak setup' to set a temporary breakpoint at the beginning of the 'setup()' function and 'c' to continue execution until that breakpoint is hit. ```gdb (gdb) tbreak setup Temporary breakpoint 1 at 0x2ca: file sketch.ino, line 28. (gdb) c Continuing. Temporary breakpoint 1, setup () at sketch.ino:28 28 pinMode(LED_BUILTIN, OUTPUT); (gdb) ``` -------------------------------- ### Arduino Code Example for LED Ring Source: https://docs.wokwi.com/parts/wokwi-led-ring Initializes an Adafruit NeoPixel ring with a specified number of pixels and pin, then sets all LEDs to green. This snippet is useful for basic setup and testing of the LED ring. ```Arduino #include #define RING_PIN 2 #define NUM_PIXELS 16 Adafruit_NeoPixel ring(NUM_PIXELS, RING_PIN, NEO_GRB + NEO_KHZ800); void setup() { ring.begin(); for (int i = 0; i < NUM_PIXELS; i++) { ring.setPixelColor(i, ring.Color(0, 150, 0)); // Green } ring.show(); } void loop() { delay(10); } ``` -------------------------------- ### Install Library on Wokwi Simulator Source: https://docs.wokwi.com/vscode/vscode-micropython Installs a MicroPython 'mip' package library, such as 'ssd1306', onto the Wokwi simulator. The simulator must be connected via its serial port. ```bash mpremote connect port:rfc2217://localhost:4000 mip install ssd1306 ``` -------------------------------- ### Install mpremote with Specific Version Source: https://docs.wokwi.com/vscode/vscode-micropython Install a specific version of the mpremote software that matches your MicroPython firmware version to avoid compatibility issues. This example uses pip. ```bash pip install mpremote==1.23 ``` -------------------------------- ### Start GDB Session Prompt Source: https://docs.wokwi.com/gdb-debugging This is the initial prompt you will see when a GDB session is ready in Wokwi. You can then enter GDB commands. ```gdb 0x00000000 in __vectors () (gdb) ``` -------------------------------- ### Initialize LCD1602 with LiquidCrystal Library Source: https://docs.wokwi.com/parts/wokwi-lcd1602 This example demonstrates how to initialize the LiquidCrystal library for a 16x2 LCD display using specific Arduino pin assignments for the standard configuration. Ensure the pin numbers in the code match your hardware setup. ```Arduino #include LiquidCrystal lcd(12, 11, 10, 9, 8, 7); void setup() { lcd.begin(16, 2); // you can now interact with the LCD, e.g.: lcd.print("Hello World!"); } void loop() { // ... } ``` -------------------------------- ### Set Up GPIO Pin Watcher Source: https://docs.wokwi.com/chips-api/gpio Example of setting up a watcher for a GPIO pin to trigger a callback on a falling edge. Ensure the `chip_pin_change` function is defined and the `pin` variable is initialized. ```c const pin_watch_config_t watch_config = { .edge = FALLING, .pin_change = chip_pin_change, .user_data = chip, }; pin_watch(pin, &watch_config); ``` -------------------------------- ### Complete Custom Chip JSON Example Source: https://docs.wokwi.com/chips-api/chip-json This is a comprehensive example of a custom chip definition JSON file, including name, author, pins, and controls. ```json { "name": "My Custom Chip", "author": "Your Name", "pins": ["VCC", "GND", "SCL", "SDA", "OUT"], "controls": [ { "id": "temperature", "label": "Temperature (°C)", "type": "range", "min": -40, "max": 125, "step": 0.1 } ] } ``` -------------------------------- ### UART Callbacks and Configuration Example Source: https://docs.wokwi.com/chips-api/uart Defines callbacks for UART data reception and transmission completion, and initializes a UART configuration struct with these callbacks, pins, and baud rate. ```c static void on_uart_rx_data(void *user_data, uint8_t byte) { // `byte` is the byte received on the "RX" pin } static uint8_t on_uart_write_done(void *user_data) { // You can write the chunk of data to transmit here (by calling uart_write). } // ... const uart_config_t uart1 = { .tx = pin_init("TX", INPUT_PULLUP), .rx = pin_init("RX", INPUT), .baud_rate = 115200, .rx_data = on_uart_rx_data, .write_done = on_uart_write_done, .user_data = chip, }; ``` -------------------------------- ### Delay Step Example Source: https://docs.wokwi.com/wokwi-ci/automation-scenarios Introduces a delay into the automation scenario. The 'value' parameter requires units like 'ms'. ```yaml delay: 30ms ``` -------------------------------- ### HX711 Arduino Code Example Source: https://docs.wokwi.com/parts/wokwi-hx711 An example of how to use the HX711 component with the Arduino IDE, including initialization and reading values. ```APIDOC ## Arduino Code Example ### Description This example demonstrates how to initialize the HX711 scale and read its units periodically using the Arduino IDE. ### Setup - Include the `HX711.h` library. - Create an `HX711` object named `scale`. - In `setup()`: - Initialize serial communication at 9600 baud. - Print an initialization message. - Call `scale.begin()` with the DT and SCK pin assignments (e.g., A1, A0). ### Loop - In `loop()`: - Print the current scale units to the serial monitor, formatted to 1 decimal place. - Wait for 1000 milliseconds before the next reading. ### Code ```cpp #include "HX711.h" HX711 scale; void setup() { Serial.begin(9600); Serial.println("Initializing the scale"); scale.begin(A1, A0); } void loop() { Serial.println(scale.get_units(), 1); delay(1000); } ``` ``` -------------------------------- ### Run Wokwi Simulation Source: https://docs.wokwi.com/wokwi-ci/cli-usage Execute a simulation for your Wokwi project. The CLI will start the simulation and display serial output, automatically exiting after 30 seconds. ```bash wokwi-cli ``` -------------------------------- ### Serial Monitor over UART Example Source: https://docs.wokwi.com/parts/wokwi-pi-pico Example code for using Serial Monitor over UART. Initialize Serial1 with the desired baud rate and use Serial1.println() for messages. ```arduino void setup() { Serial1.begin(115200); Serial1.println("Hello, world!"); } void loop() { } ``` -------------------------------- ### I2C Device Initialization and Callbacks Source: https://docs.wokwi.com/chips-api/i2c Example demonstrating how to define I2C callbacks and configure an I2C device using `i2c_init`. The callbacks handle connection, read, write, and disconnect events. This configuration should only be called from `chip_init()`. ```c bool on_i2c_connect(void *user_data, uint32_t address, bool read) { // `address` parameter contains the 7-bit address that was received on the I2C bus. // `read` indicates whether this is a read request (true) or write request (false). return true; // true means ACK, false NACK } uint8_t on_i2c_read(void *user_data) { return 0; // The byte to be returned to the microcontroller } bool on_i2c_write(void *user_data, uint8_t data) { // `data` is the byte received from the microcontroller return true; // true means ACK, false NACK } void on_i2c_disconnect(void *user_data) { // This method is optional. Useful if you need to know when the I2C transaction has concluded. } static const i2c_config_t i2c1 { .address = 0x22, .scl = pin_init("SCL", INPUT_PULLUP), .sda = pin_init("SDA", INPUT_PULLUP), .connect = on_i2c_connect, .read = on_i2c_read, .write = on_i2c_write, .disconnect = on_i2c_disconnect, .user_data = chip, }; ``` -------------------------------- ### Define a Red LED Part Source: https://docs.wokwi.com/diagram-format Example of defining a 'wokwi-led' part with specific attributes like color and position. Ensure each part has a unique 'id'. ```json { "id": "led1", "type": "wokwi-led", "left": 100, "top": 50, "attrs": { "color": "red" } } ``` -------------------------------- ### Specify CircuitPython Libraries with requirements.txt Source: https://docs.wokwi.com/guides/circuitpython Create a 'requirements.txt' file to list the Adafruit CircuitPython libraries needed for your project. Wokwi automatically installs these libraries. ```text # requirements.txt example adafruit_display_text adafruit_dht ``` -------------------------------- ### spi_start Source: https://docs.wokwi.com/chips-api/spi Starts an SPI transaction, sending and receiving a specified number of bytes to/from a buffer. ```APIDOC ## void spi_start(spi_dev_t spi, uint8_t *buffer, uint32_t count) ### Description Starts an SPI transaction, sending and receiving `count` bytes to/from the given `buffer`. This function is typically called when a CS (chip select) pin goes low. ### Parameters #### Path Parameters - **spi** (spi_dev_t) - Required - The SPI device interface. - **buffer** (uint8_t *) - Required - The buffer to send and receive data. - **count** (uint32_t) - Required - The number of bytes to transfer. ``` -------------------------------- ### Arduino 4x4 Keypad Example Source: https://docs.wokwi.com/parts/wokwi-membrane-keypad Demonstrates how to use the Keypad library with a 4x4 membrane keypad. It initializes the keypad with custom key mappings and prints pressed keys to the serial monitor. ```c++ #include const uint8_t ROWS = 4; const uint8_t COLS = 4; char keys[ROWS][COLS] = { { '1', '2', '3', 'A' }, { '4', '5', '6', 'B' }, { '7', '8', '9', 'C' }, { '*', '0', '#', 'D' } }; uint8_t colPins[COLS] = { 5, 4, 3, 2 }; // Pins connected to C1, C2, C3, C4 uint8_t rowPins[ROWS] = { 9, 8, 7, 6 }; // Pins connected to R1, R2, R3, R4 Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS); void setup() { Serial.begin(9600); } void loop() { char key = keypad.getKey(); if (key != NO_KEY) { Serial.println(key); } } ``` -------------------------------- ### Define Chip with GPIO Pins Source: https://docs.wokwi.com/chips-api/gpio Example of a chip.chip.json file defining a chip with four GPIO pins: OUT, IN, VCC, and GND. ```json { "name": "Inverter", "author": "Uri Shaked", "pins": ["OUT", "IN", "VCC", "GND"] } ``` -------------------------------- ### Custom Chip Configuration Source: https://docs.wokwi.com/vscode/project-config Load custom chips into the simulation by defining a [[chip]] section in wokwi.toml. This example loads a chip from 'chips/inverter.chip.wasm' and makes it available as 'chip-inverter' in the diagram. ```toml [[chip]] name = 'inverter' # To use the chip in diagram.json, add a part with "chip-inverter" type. binary = 'chips/inverter.chip.wasm' ``` -------------------------------- ### Arduino NeoPixel Basic Control Source: https://docs.wokwi.com/parts/wokwi-neopixel This example demonstrates how to initialize and set the color of a single NeoPixel LED using the Adafruit_NeoPixel library. Ensure the LED_PIN is correctly defined. ```Arduino #include #define LED_PIN 6 Adafruit_NeoPixel pixel(1, LED_PIN, NEO_GRB + NEO_KHZ800); void setup() { pixel.begin(); pixel.setPixelColor(0, pixel.Color(150, 0, 0)); // Red pixel.show(); } void loop() { delay(100); } ``` -------------------------------- ### Successful Wokwi CLI Test Output Source: https://docs.wokwi.com/wokwi-ci/automation-scenarios Example output indicating a successful Wokwi CLI test run, including simulation connection, firmware messages, and matched expected text. ```text Wokwi CLI v0.18.3 (786fa8e49d9c) Connected to Wokwi Simulation API 1.0.0-20251028-g60747fe2 Starting simulation... ets Jul 29 2019 12:21:46 [DHT22 Sensor Test (ESP32)] Expected text matched: "ets Jul 29 2019 12:21:46" rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:1156 load:0x40078000,len:11456 ho 0 tail 12 room 4 load:0x40080400,len:2972 entry 0x400805dc DHT22 test! [DHT22 Sensor Test (ESP32)] Expected text matched: "DHT22 test!" Humidity: 45.80% Temperature: 23.50°C [DHT22 Sensor Test (ESP32)] Expected text matched: "Humidity: 45.80% Temperature: 23.50°C" Humidity: 45.80% Temperature: 23.50°C [DHT22 Sensor Test (ESP32)] Expected text matched: "Humidity: 45.80% Temperature: 23.50°C" Humidity: 66.90% Temperature: 21.50°C [DHT22 Sensor Test (ESP32)] Expected text matched: "Humidity: 66.90% Temperature: 21.50°C" [DHT22 Sensor Test (ESP32)] Scenario completed successfully ``` -------------------------------- ### Python Serial Connection Example Source: https://docs.wokwi.com/vscode/project-config Connect to the simulated serial port using PySerial's RFC2217 support. Ensure the simulator tab is visible in VS Code for uninterrupted serial output. ```python import serial ser = serial.serial_for_url('rfc2217://localhost:4000', baudrate=115200) ser.write(b'hello') ``` -------------------------------- ### List Files on microSD Card with SdFat Library Source: https://docs.wokwi.com/parts/wokwi-microsd-card This Arduino code example uses the SdFat library to initialize the microSD card and print a list of all files present on it. Ensure the correct SPI pins and CS pin are defined for your Arduino board. ```Arduino #include "SdFat.h" #define SPI_SPEED SD_SCK_MHZ(4) #define CS_PIN 10 SdFat sd; void setup() { Serial.begin(115200); if (!sd.begin(CS_PIN, SPI_SPEED)) { if (sd.card()->errorCode()) { Serial.println("SD initialization failed."); } else if (sd.vol()->fatType() == 0) { Serial.println("Can't find a valid FAT16/FAT32 partition."); } else { Serial.println("Can't determine error type"); } return; } Serial.println("Files on card:"); Serial.println(" Size Name"); sd.ls(LS_R | LS_SIZE); } void loop() { } ``` -------------------------------- ### Initialize Wokwi Project Source: https://docs.wokwi.com/wokwi-ci/cli-usage Use the `init` command to set up your project for Wokwi. This command generates necessary configuration files like `wokwi.toml` and `diagram.json`. ```bash wokwi-cli init ``` -------------------------------- ### Zephyr Default Workspace Tree Source: https://docs.wokwi.com/vscode/migrating This shows a partial default workspace tree for Zephyr projects. Follow the Zephyr getting started and application development documentation for project preparation. ```plaintext ├── bootloader │   └── mcuboot ├── modules │   ├── bsim_hw_models │   ├── crypto │   ├── debug │   ├── fs │   ├── hal │   ├── lib │   └── tee ├── tools │   ├── edtt │   └── net-tools ├── .west │   └── config └── zephyr ├── arch ├── boards ... ├── zephyr-env.cmd └── zephyr-env.sh ``` -------------------------------- ### Arduino TVout Circle Example Source: https://docs.wokwi.com/parts/wokwi-tv Draws a circle on the Wokwi TV using the TVout library. Connect SYNC to Arduino pin 9 and IN to Arduino pin 7. Ensure the TVout library is installed and configured for PAL output. ```arduino #include TVout TV; void setup() { TV.begin(PAL, 120, 96); TV.clear_screen(); TV.draw_circle(60, 48, 32, WHITE); } void loop() { } ``` -------------------------------- ### Initialize Wokwi Configuration with CLI Source: https://docs.wokwi.com/vscode/migrating Generate the `wokwi.toml` configuration file using the Wokwi CLI. This command is useful when setting up a local VS Code environment for a Wokwi project. ```bash wokwi-cli init ``` -------------------------------- ### Arduino NeoPixel LED Strip Control Source: https://docs.wokwi.com/parts/wokwi-led-strip This example demonstrates how to initialize and control a WS2812 NeoPixel compatible LED strip using the Adafruit_NeoPixel library. It sets all LEDs to red and displays the color. Ensure the STRIP_PIN and NUM_PIXELS are defined correctly for your setup. ```Arduino #include #define STRIP_PIN 2 #define NUM_PIXELS 8 Adafruit_NeoPixel strip(NUM_PIXELS, STRIP_PIN, NEO_GRB + NEO_KHZ800); void setup() { strip.begin(); for (int i = 0; i < NUM_PIXELS; i++) { strip.setPixelColor(i, strip.Color(150, 0, 0)); // Red } strip.show(); } void loop() { delay(10); } ``` -------------------------------- ### Basic wokwi.toml Configuration Source: https://docs.wokwi.com/vscode/project-config A fundamental wokwi.toml file structure. Ensure firmware paths are relative to the wokwi.toml file and use forward slashes for cross-platform compatibility. ```toml [wokwi] version = 1 firmware = 'path-to-your-firmware.hex' elf = 'path-to-your-firmware.elf' ``` -------------------------------- ### Upload main.py to Wokwi Simulator Source: https://docs.wokwi.com/vscode/vscode-micropython Uploads the 'main.py' file to the Wokwi simulator's filesystem using mpremote. Ensure the simulator is running and accessible via the specified RFC2217 serial port. ```bash mpremote connect port:rfc2217://localhost:4000 fs cp main.py :main.py ``` -------------------------------- ### Navigate to Part Directory Source: https://docs.wokwi.com/wokwi-ci/automation-scenarios Changes the current directory to the specific part's test directory, in this case, wokwi-dht22/dht22-esp32. ```bash cd wokwi-dht22/dht22-esp32 ``` -------------------------------- ### Create mpremote Wokwi Shortcut Source: https://docs.wokwi.com/vscode/vscode-micropython Creates a shortcut for connecting to the Wokwi simulator on Unix-based systems. This allows connecting with a simpler command. ```bash mkdir -p ~/.config/mpremote echo 'config={"wokwi": "connect port:rfc2217://localhost:4000"}' > ~/.config/mpremote/config.py ``` -------------------------------- ### List Files on Wokwi Simulator Source: https://docs.wokwi.com/vscode/vscode-micropython Lists all files currently present in the Wokwi simulator's filesystem. This is useful for verifying uploads. ```bash mpremote connect port:rfc2217://localhost:4000 ls ``` -------------------------------- ### Arduino 74HC595 LED Blink Example Source: https://docs.wokwi.com/parts/wokwi-74hc595 This example demonstrates how to use the 74HC595 shift register with an Arduino to control 8 LEDs. It requires connecting the DS, SHCP, and STCP pins to specific Arduino digital pins. The code outputs an 8-bit pattern that inverts every 500 milliseconds. ```arduino const int dataPin = 2; /* DS */ const int clockPin = 3; /* SHCP */ const int latchPin = 4; /* STCP */ void setup() { pinMode(dataPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(latchPin, OUTPUT); } int pattern = 0b10101010; void loop() { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, pattern); digitalWrite(latchPin, HIGH); delay(500); pattern = ~pattern; // Invert the pattern } ``` -------------------------------- ### ESP-IDF Support Configuration Source: https://docs.wokwi.com/vscode/project-config Configure wokwi.toml for ESP-IDF projects by setting the firmware to 'build/flasher_args.json'. This automatically loads the complete application, including the bootloader and partition table. ```toml [wokwi] version = 1 firmware = 'build/flasher_args.json' elf = 'build/example_app.elf' ``` -------------------------------- ### Clone Wokwi Part Tests Repository Source: https://docs.wokwi.com/wokwi-ci/automation-scenarios Clones the wokwi-part-tests GitHub repository to access example parts and test scenarios. ```bash git clone https://github.com/wokwi/wokwi-part-tests ``` -------------------------------- ### Basic ESP-IDF Simulation with Wokwi Source: https://docs.wokwi.com/wokwi-ci/idf-wokwi-usage Set the WOKWI_CI_TOKEN environment variable and then build and run a simulation for your ESP-IDF project using idf.py. This is the fundamental workflow for Wokwi simulation. ```bash export WOKWI_CI_TOKEN="your-token-here" # Build and simulate idf.py build idf.py wokwi ``` -------------------------------- ### Initialize and Print with TinyDebug Source: https://docs.wokwi.com/parts/wokwi-attiny85 Use the TinyDebug library to print messages to Wokwi's Serial Monitor. Ensure 'TinyDebug.h' is included and 'libraries.txt' contains 'TinyDebug'. ```cpp #include void setup() { Debug.begin(); Debug.println(F("Hello, TinyDebug!")); } void loop() { /* Sprinkle some magic code here */ } ``` -------------------------------- ### Test Firmware with Wokwi CI Action Source: https://docs.wokwi.com/wokwi-ci/github-actions Add this step to your GitHub Actions workflow to build and test your project's firmware using Wokwi CI. Ensure the WOKWI_CLI_TOKEN secret is configured in your repository. ```yaml - name: Test with Wokwi uses: wokwi/wokwi-ci-action@v1 with: token: ${{ secrets.WOKWI_CLI_TOKEN }} path: / # directory with wokwi.toml, relative to repo's root expect_text: 'Hello, world!' # optional ``` -------------------------------- ### Define Pi Pico Part in diagram.json Source: https://docs.wokwi.com/parts/wokwi-pi-pico Example of how to define the Raspberry Pi Pico part with an ID of 'pico' in your diagram.json file. ```json "parts": [ { "type": "wokwi-pi-pico", "id": "pico", ... }, ... ] ``` -------------------------------- ### Animate Custom Character Source: https://docs.wokwi.com/parts/wokwi-lcd1602 Animates the display of a custom character by revealing it line by line. This example modifies the loop() function from the previous snippet. ```arduino void loop() { uint8_t heart2[8] = {0}; for (int i = 0; i < 8; i++) { heart2[i] = heart[i]; lcd.createChar(3, heart2); delay(100); } delay(500); } ``` -------------------------------- ### Basic Touch Release Scenario Source: https://docs.wokwi.com/wokwi-ci/automation-scenarios A simple scenario to simulate a touch release on a specific part. ```yaml touch-release: part-id: esp32s3box ``` -------------------------------- ### Serial Monitor Collapsed by Default Source: https://docs.wokwi.com/guides/serial-monitor Configure the Serial Monitor to be collapsed by default when the simulation starts by setting the `collapse` property to `true` in diagram.json. ```json "serialMonitor": { "collapse": true } ``` -------------------------------- ### Compile Chip using Wokwi CLI Source: https://docs.wokwi.com/guides/custom-chips-to-wasm Use the wokwi-cli to compile your C source files into a WASM binary. The CLI automatically fetches the toolchain and SDK. You can specify multiple source files or an output file name. ```bash wokwi-cli chip compile main.c ``` ```bash wokwi-cli chip compile main.c utils.c ``` ```bash wokwi-cli chip compile main.c -o my_chip.wasm ``` ```bash wokwi-cli chip makefile -n my_chip [source_files ...] ``` -------------------------------- ### Get Simulator Time in Nanoseconds Source: https://docs.wokwi.com/chips-api/time Retrieves the current virtual time within the simulator in nanoseconds. This can be used to calculate time in microseconds or milliseconds. ```c uint64_t get_sim_nanos() ``` -------------------------------- ### Compile WASM Locally with Clang Source: https://docs.wokwi.com/guides/custom-chips-to-wasm Compile a WASM binary locally using clang. Ensure you have wasi-libc and the necessary clang runtime library installed. ```bash clang --target=wasm32-unknown-wasi -nostartfiles -Wl,--import-memory -Wl,--export-table -Wl,--no-entry -Werror -o dist/chip.wasm src/main.c ``` -------------------------------- ### VS Code Launch Configuration for Wokwi Debugging Source: https://docs.wokwi.com/vscode/debugging Create a `.vscode/launch.json` file with this template to configure VS Code for debugging Wokwi simulations. Ensure the `program` path points to your firmware's ELF file and `miDebuggerPath` to your GDB executable. ```json { "version": "0.2.0", "configurations": [ { "name": "Wokwi GDB", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/your-firmware.elf", "cwd": "${workspaceFolder}", "MIMode": "gdb", "miDebuggerPath": "/usr/local/bin/xtensa-esp32-elf-gdb", "miDebuggerServerAddress": "localhost:3333" } ] } ``` -------------------------------- ### Configure Chip in wokwi.toml Source: https://docs.wokwi.com/guides/custom-chips-to-wasm Add a [[chip]] key to your wokwi.toml file to specify the name and binary for your custom chip. Ensure the JSON pinout file matches the WASM binary name. ```toml [[chip]] name = 'inverter' # To use the chip in diagram.json, add a part with "chip-inverter" type. binary = 'chips/inverter.chip.wasm' ``` -------------------------------- ### List Files in CircuitPython Project Source: https://docs.wokwi.com/guides/circuitpython Use the 'os' module to list all files and directories in the root of the CircuitPython project's flash filesystem. ```python import os print(os.listdir('/')) ```