esptool-js icon indicating copy to clipboard operation
esptool-js copied to clipboard

Add firmware image checksum generation

Open jp-bennett opened this issue 1 year ago • 0 comments

Checklist

  • [X] Checked the issue tracker for similar issues to ensure this is not a duplicate.
  • [X] Described the feature in detail and justified the reason for the request.
  • [X] Provided specific use cases and examples.

Feature description

While the esptool-js library has a checksum function, there isn't a way to generate a checksum of an entire flashable image, the way esptool image_info does. It would be very useful to have such a function, to generate the firmware image checksum before flashing.

Use cases

The most common use case would be to check for a valid checksum before flashing a firmware.bin to a device. In my exact use case, I'm trying to modify firmware to replace an internal string just before flashing. I've confirmed this works using sed and then manually updating the checksum with a hex editor, but haven't found a way to do so automatically in the browser.

Alternatives

There's not really an alternative to make this work. To support the feature, more code needs to be ported from esptool.py to esptool-js.

Additional context

Specifically this is for the Meshtastic project. We're putting a placeholder string in the firmware, and would like to replace it with a timezone string during the flashing process. There are quite a few other use cases we'd like to explore, but the timezone was an easy place to start.

jp-bennett avatar Oct 06 '24 21:10 jp-bennett