rusefi-1/misc/encedo_hex2dfu
David Holdeman b4807708c8
Convert jenkins build_extra_bundles scripts to sh (#1554)
* Add checkout

* remove empty with statement

* Actually we do need push depth

* convert build_working_folder

* convert prepare_bundle

* fixed extension

* fixed closing bracket

* fixed comparison and assignments

* no comment

* convert compile_and_upload and clean

* convert build_simulator

* Finish converting build_working_folder

* convert build_java_console

* Add hashbangs

* remove findcyg instruction

* changed paths

* remove call

* add path

* fixed script names

* add prams

* fix cd

* convert clean_env_variables

* convert common_make.sh

* Added linux hex2dfu binary

* add file extension to linux hex2dfu

* add file extension to linux hex2dfu

* remove spurious paren

* fixed board name

* convert compile-frankenso-na6

* convert compile-frankenso-pal

* add hashbang

* convert compile-kinetis

* convert compile-mre-f4

* convert compile-mre-f4-hardware-QC-special-build

* convert compile-mre-f4-slave

* convert compile-mre-f7

* convert compile-mre-f7-test

* switch to underscores

* converting boards to sh

* convert prometheus

* convert proteus

* fixed path

* switch to underscores

* chmod and add extension

* add quotes

* Add check for Windows

* Add chmod

* fix script name

* fix error checking

* quote vars

* remove checking from batch shims

* fix typo

* change error checking to support nix style error codes

* switch to 1 retval

* cd back to firmware

* Add escapes

* change from cd to rel path

* add p flags to mkdir

Co-authored-by: David Holdeman <David Holdeman>
2020-07-01 14:09:01 -04:00
..
LICENSE fail to generate F7 DFU files #696 2019-06-08 20:01:19 -04:00
README.md fail to generate F7 DFU files #696 2019-06-08 20:01:19 -04:00
hex2dfu.bin Convert jenkins build_extra_bundles scripts to sh (#1554) 2020-07-01 14:09:01 -04:00
hex2dfu.exe fail to generate F7 DFU files #696 2019-06-08 20:01:19 -04:00

README.md

(this tool would not compile as is so my changes are at https://github.com/rusefi/hex2dfu) (this comes from https://github.com/encedo/hex2dfu)

hex2dfu

Simple command line tool to convert file format from Intel HEX to STM32 DFU.

Compile

hex2dfu is a single C file application and can be easly compile by any ANSI C compiler. No makefile required. Just type:

gcc hex2dfu.c -o hex2dfu.exe

I`m using mingw32 under Windows, change parameters regards your enviroment.

To enable ED25519 code signing feature, download ED25519 code from https://github.com/encedo/ed25519 or https://github.com/orlp/ed25519 to folder ED25519 and type:

gcc hex2dfu.c ED25519/*.c -o hex2dfu.exe

Using

  1. Simple convertion

    hex2dfu.exe -i infile.hex -o outfile.dfu

  2. Convertion with changing VID/PID

    hex2dfu.exe -i infile.hex -o outfile.dfu -p 0x0483 -v 0xdf11

  3. As before with extra device version included (otherwise 0xFFFF will be placed)

    hex2dfu.exe -i infile.hex -o outfile.dfu -p 0x0483 -v 0xdf11 -d 0x1234

  4. EXTRA: Calculated CRC32 of the file and embed meta data at given address

    hex2dfu.exe -i infile.hex -o outfile.dfu -c 0x08011000

  5. Code siging: To sign the code ED25519 'secret' need to be provided

    hex2dfu.exe -i infile.hex -o outfile.dfu -c 0x08011000 -S d4411fa9d5cb6f91b7bd18e4ab41e7d03bf37e1d738c12b923ef0f09de90e6cf

  6. Like above but extra data (-P) are added:

    hex2dfu.exe -i infile.hex -o outfile.dfu -c 0x08011000 -S d4411fa9d5cb6f91b7bd18e4ab41e7d03bf37e1d738c12b923ef0f09de90e6cf -e -P DEADBEEF

  7. Like above but additional data are public key based on signing secret:

    hex2dfu.exe -i infile.hex -o outfile.dfu -c 0x08011000 -S d4411fa9d5cb6f91b7bd18e4ab41e7d03bf37e1d738c12b923ef0f09de90e6cf -e

Automated CRC32 generation in very usefull when custom bootloader is in use. We can check firmware at every MCU boot and execute only when file ingerrity is authenticated. Otherwise performe failover (e.g. start USB bootloader).

Custom USB Bootloader supporting CRC32 checking during boot will be open sourced soon. Stay tuned :)