rusefi-1/misc/encedo_hex2dfu
Andrey G e3be563b27
Openblt (#3430)
* Makefile: define BOOTLOADER=1 for linker in case of OpenBLT too

This will reserve first 32K of flash for bootloader.

* OpenBLT: include into build

* board: subaru eg33: add OpenBLT board code

* board: subaru eg33: use OpenBLT

* Board: Subaru EG33: OpenBLT: reuse HAL and CMSIS from OpenBLT submodule

* Board: Subaru EG33: OpenBLT: reuse linker file from OpenBLT too

* OpenBLT for MRE

* OpenBLT: MRE: adjust LD memory map for smallest variat of MCU on MRE

* OpenBLT: enable for MRE

* OpenBLT: disable CRC check of user application

This allows us to use DFU tool to flash main application too.

* hex2dfu: fresh binary for linux

* OpenBLT: extract common part of OpenBLT makefiles to openblt.mk

* OpenBLT: enable CRC check of user application for MRE and EG33

CRC (actually just a summ) of few first vectors is stored at 0x1c
offset. This is reserved vector for Cortex-M3, M4 and M7

* common_make: append OpenBLT CRC to dfu files

This should allow to use DFU to do main application update when
when OpenBLT is used as bootloader. hex2dfu will store same
styled CRC as OpenBLT expects to see in user app.

* OpenBLT reorganization

Move common stuff to hw_layer/ports/

* OpenBLT: proteus

* Proteus: enable OpenBLT for F4 and F7

Compilation tested only
2021-11-05 19:28:55 -04:00
..
LICENSE
README.md fresh binary 2021-11-02 09:48:47 -04:00
compile_win.bat hex2dfu helper script 2021-11-05 11:51:21 -04:00
hex2dfu.bin Openblt (#3430) 2021-11-05 19:28:55 -04:00
hex2dfu.exe fresh Windows binary 2021-11-05 11:51:32 -04:00

README.md

(this tool would not compile as is so my changes are at https://github.com/rusefi/hex2dfu) (use gcc hex2dfu.c -o hex2dfu.exe to compile) (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 :)