Jozott00 / wokwi-intellij

An Intellij plugin that integrates the Wokwi simulator into Jetbrains IDEs such as CLion and RustRover.
https://jozott00.github.io/wokwi-intellij/
MIT License
7 stars 0 forks source link

[BUG] Custom partitions not loading #92

Open duevil opened 2 months ago

duevil commented 2 months ago

It seems like the plugin does not support custom partitions. I added a custom partitions.csv to the project's root path, expecting the partitions to show up in the simulation. However, when running the simulation with the code of the ESP32 Custom partition table code example, the default partition is shown.

I am using the plugin v0.10.3 inside CLion 2024.2.2 together with the PlatformIO plugin. When loding the same code on a physical ESP32 the partition is loaded correctly. The same applies when running the code inside the WOKWI online editor.

Serial output when running the simulation inside CLion:

[   472][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[   770][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
Flash size: 8388608 bytes
ESP32 Partition table:

| Type | Sub |  Offset  |   Size   |       Label      |
| ---- | --- | -------- | -------- | ---------------- |
|  01  | 02  | 0x009000 | 0x006000 | nvs              |
|  01  | 01  | 0x00F000 | 0x001000 | phy_init         |
|  00  | 00  | 0x010000 | 0x190000 | factory          |
|  01  | 81  | 0x200000 | 0x1F0000 | vfs              |
|  01  | 03  | 0x3F0000 | 0x010000 | coredump         |
Hello, world!

diagram.json:

{
  "version": 1,
  "author": "Uri Shaked",
  "editor": "wokwi",
  "parts": [ { "type": "wokwi-esp32-devkit-v1", "id": "esp", "top": 0, "left": 0, "attrs": { "flashSize": "8" } } ],
  "connections": [ [ "esp:TX0", "$serialMonitor:RX", "", [] ], [ "esp:RX0", "$serialMonitor:TX", "", [] ] ]
}

main.cpp:

#include <Arduino.h>

void setup() {
    Serial.begin(115200);

    Serial.printf("Flash size: %d bytes\n", spi_flash_get_chip_size());

    Serial.printf("ESP32 Partition table:\n\n");

    Serial.printf("| Type | Sub |  Offset  |   Size   |       Label      |\n");
    Serial.printf("| ---- | --- | -------- | -------- | ---------------- |\n");

    esp_partition_iterator_t pi = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, nullptr);
    if (pi != nullptr) {
        do {
            const esp_partition_t *p = esp_partition_get(pi);
            Serial.printf("|  %02x  | %02x  | 0x%06X | 0x%06X | %-16s |\r\n",
                   p->type, p->subtype, p->address, p->size, p->label);
        } while (pi = (esp_partition_next(pi)));
    } else {
        Serial.printf("No partitions found.\n");
    }

    Serial.println("Hello, world!");
}

void loop() {
    delay(1000);
}

PlatformIO .ini:

[env:adafruit_feather_esp32_v2]
platform = espressif32
board = adafruit_feather_esp32_v2
framework = arduino
upload_speed = 921600
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
board_build.filesystem = littlefs
board_build.partitions = partitions.csv
build_flags =
    -w
    -D SERIAL_BAUD_RATE=${env:adafruit_feather_esp32_v2.monitor_speed}
    -D CUSTOM_LOG_LEVEL=2
    -D CORE_DEBUG_LEVEL=4
lib_deps =