ESP32- idf partition table offset override not set in pio script : proposition to edit espidf.py & board.json

Hello folks
i was trying recently to increase bootloader size by increasing partition table offset, this is noted in IDF documentation but flashing with platformio had made overlap, and doesnt work,
i looked up the script and found that the partition table offset and app offset is always fixed no matter what is set in menuconfig,
so i propose this : in the espidf.py :
line 1067 :

          FLASH_EXTRA_IMAGES=[
            ("0x1000", os.path.join("$BUILD_DIR", "bootloader.bin")),
            (board.get("build.partition_table_offset", "0x8000"), os.path.join("$BUILD_DIR", "partitions.bin")),
        ],
    )

so in the board discription json we can add / or not

“partition_table_offset”: “0x9000”,

then we have to update manually app partition offset , which is set to 0x10000 fixed in main.py

elif upload_protocol == “esptool”:

env.Replace(

    UPLOADER=join(

        platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"),

    UPLOADERFLAGS=[

        "--chip", mcu,

        "--port", '"$UPLOAD_PORT"',

        "--baud", "$UPLOAD_SPEED",

        "--before", "default_reset",

        "--after", "hard_reset",

        "write_flash", "-z",

        "--flash_mode", "${__get_board_flash_mode(__env__)}",

        "--flash_freq", "${__get_board_f_flash(__env__)}",

        "--flash_size", "detect"

    ],

    UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE'

)

for image in env.get("FLASH_EXTRA_IMAGES", []):

    env.Append(UPLOADERFLAGS=[image[0], env.subst(image[1]) ,])

env.Append(UPLOADERFLAGS=board.get("build.factory_app_offset", "0x10000"))

i am working with Wrover board all the time , i need to raise a notice that the debug server doesn’t work properly with the wrover kit : i had to replace the openocd to the latest version released by espressif, and replace the deprecated board script by this one esp32-wrover-kit-3.3v instead of “esp32-wrover.cfg”
and the debug works just fine after that
nevertheless, with this being said , i found that the upload command using ftdi and jtag doesn’t work in this way … i hope this can be fixed ?

any idea to push these fixes to the next pio update ?
thanks

also i added a line to replace the spiffs ( deprecated ) with littleFS : since its not supported by pio
main.py :
111: if p['type'] == "data" and (p['subtype'] == "spiffs" or p['subtype'] == "littlefs"):

165: MKLITTLEFSTOOL=“mklittlefs”, # mklittlefs.exe is copied to the /tool-mkspiffs directory

193: action=env.VerboseAction(" “.join([
'”$MKLITTLEFSTOOL"',
“-c”, “$SOURCES”,
“-p”, “$SPIFFS_PAGE”,
“-b”, “$SPIFFS_BLOCK”,
“-s”, “$SPIFFS_SIZE”,
“$TARGET”
])

is it possible also to push this ?

Already fixed in ESP32-Pico-V3 fails to upload/debug using esp-prog - #20 by ivankravets and will be included in the next platform-espressif32 release.

This sounds exactly the same like PlatformIO not recognising CONFIG_PARTITION_TABLE_OFFSET for debugger and upload · Issue #403 · platformio/platform-espressif32 · GitHub which was already fixed in the development version of the platform.

If it still doesn’t work or need some clarifications, open an issue there.

The code you’re talking about is in GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO so you can submit a pull request and have the developers review your code.

1 Like

in this https://github.com/platformio/platform-espressif32/issues/403 issue
i can see how they did, appreciated , i pulled the dev branch , and indeed the partition offset is fixed, but nevertheless, the fw app partition offset is not fixed nor added as an option … (always set to 0x10000)
i am gonna try to fix that and make pull request