i am trying to get the libraries used by my project at a fixed location in the binary.
The reason is, as the binary has a size of 2MB i want to be able to cut off parts of the binary which wont change and only flash the part of the application that is changing. Since i am flashing over CAN every byte less is useful.
I tried to write a linker script and place all static libraries inside of that section
} > iram0_2_seg
The section appears inside the map file but the binary isnt changing at all.
I am thrilled to hear other opinions.
If a new firmware uses any new Arduino functions at all and you only send / update the new “application” part of the firmware, this will crash horribly.
i know, in that case i would flash the whole image.
This will get really complicated really fast. Essentially you must freeze the current
frameworkArduino.a library and for future builds only link against that (and not rebuild it from source), because addresses within
frameworkArduino.a for each function will also slightly change with every rebuild. Even worse, the Arduino core is the one that calls into setup() and loop() of the main sketch, so it will need to know these addresses in advance, meaning the application’s setup and loop functions must also be placed at fixed known addresses. It’s essentially becoming a small bootloader at this point.
What looks way more promising is to use existing ESP-IDF functionality: https://github.com/espressif/idf-extra-components/tree/master/esp_delta_ota seems to implement delta updates. This would significantly reduce the size of the update binary, at the cost of a more complicated update process. If anyone has ever attempted that with Arduino-ESP32, I don’t know.
i will look into that, but as far the binary is changing with one simple modification like
led on / led off → 80% of the binary changes, it will probably stay with a full flash.
Thanks for your time and help.
I implemented your suggestion with delta updates. They are working perfectly, thanks for the advise.
i thought since the binary is changing so much with a simple modification the delta update would be not much smaller than the original image. But the delta update binary with just 30KB is really small in comparison to the binary with a size of 1.6MB.