Is there a way to set the upload offset? The main.py (user\.platformio\platforms\espressif32\builder)
script implies that ESP32_APP_OFFSET should be set by upload.offset_address but line 166 defaults it to 0x10000.
I changed the line to read:
ESP32_APP_OFFSET=board.get(“upload.offset_address”, “0x10000”),
which lets me set the offset from platformio.ini (or the board file) as expected but I figured there was a proper way to change the offset without editing the platform files.
[edit] in case it wasnt clear, i am defining the offset_address in platformio.ini (though I also tried in the board .json file to similar effect)
Yes, that is what I would expect as well. However, main.py has the value hard coded and does not read offset_address. The only way I was able to make it work was to modify the main.py build script to read the value (line 166 as indicated above).
Setting upload protocol to custom in platformio.ini and defining my own build command also seems to have no effect (it always defaults to “esptool” protocol).
I assume I am just doing it wrong but I cant quite figure out what it is.
[edit] Thanks for your time, it is appreciated [/edit]
[edit] removed my ini as all of it wasnt germane [/edit]
; C:\Users\[user]]\.platformio\platforms\espressif32\builder\main.py line 166 needs to be modified to the following
;
; ESP32_APP_OFFSET=board.get("upload.offset_address", "0x10000"),
;
; working on a better solution
;
board_upload.offset_address = 0x210000
;this doesnt work either
;board_upload.protocol = custom
;board_upload.command = "$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS 0x210000 $SOURCE
However, that might be going down the wrong path entirely – are you 100% sure you don’t need to use partition tables to describe your upload address? Changing the offset_address directly was only needed by me because I was writing a, basically, minimal bootloader application.
Thanks for the great feedback! The esp-prog using it is the only reason I knew there was an offset_address to begin with and I found it odd it didnt grab it for esptool.
I like your replace method as a better work around. I will check to make sure I have the most up to date platform scripts as its odd that my line 166 doesn’t match yours (though I probably added or removed an empty line in my fiddling so maybe not that odd).
And yes, we have a firmware file at 0x10000 that interfaces with some test equipment but our main build goes to an OTA partition at 0x210000. Ideally I could do a build target that would build both of these binaries but for debugging its good enough that just the OTA partition gets loaded.