diff --git a/firmware/config/boards/common_make.bat b/firmware/config/boards/common_make.bat new file mode 100644 index 0000000000..b5c7c88cdd --- /dev/null +++ b/firmware/config/boards/common_make.bat @@ -0,0 +1,9 @@ +set script_name=common_make.bat +echo Entering %script_name% + +rem todo: start using env variable for number of threads or for '-r' +maje -j4 -r +if not exist build/rusefi.hex echo FAILED to compile by %script_name% +if not exist build/rusefi.hex exit -1 + +../misc/encedo_hex2dfu/hex2dfu.exe -i build/rusefi.hex -o build/rusefi.dfu \ No newline at end of file diff --git a/firmware/config/boards/nucleo_f746/!compile-stm32f746_nucleo.bat b/firmware/config/boards/nucleo_f746/!compile-stm32f746_nucleo.bat index 14ad399206..96e77ab09f 100644 --- a/firmware/config/boards/nucleo_f746/!compile-stm32f746_nucleo.bat +++ b/firmware/config/boards/nucleo_f746/!compile-stm32f746_nucleo.bat @@ -14,7 +14,6 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F746xx ^ -DEFI_FATAL_ERROR_PIN=GPIOB_14 ^ -DRAM_UNUSED_SIZE=10 -DCCM_UNUSED_SIZE=10 set DEBUG_LEVEL_OPT="-O2" -make -j4 -..\misc\hex2dfu\HEX2DFU.exe build/rusefi.hex -out build/rusefi.dfu +call config/boards/common_make.bat call config/boards/clean_env_variables.bat \ No newline at end of file diff --git a/firmware/config/boards/nucleo_f767/!compile-stm32f767_nucleo.bat b/firmware/config/boards/nucleo_f767/!compile-stm32f767_nucleo.bat index 6991498bb2..e118f0406d 100644 --- a/firmware/config/boards/nucleo_f767/!compile-stm32f767_nucleo.bat +++ b/firmware/config/boards/nucleo_f767/!compile-stm32f767_nucleo.bat @@ -15,10 +15,7 @@ set EXTRA_PARAMS=-DDUMMY -DSTM32F767xx ^ -DEFI_ENABLE_ASSERTS=FALSE ^ -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_TRACE=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE set DEBUG_LEVEL_OPT="-O2" -make -j4 -if not exist build/rusefi.hex echo FAILED to compile nucleo_f767 -if not exist build/rusefi.hex exit -1 -..\misc\hex2dfu\HEX2DFU.exe build/rusefi.hex -out build/rusefi.dfu +call config/boards/common_make.bat call config/boards/clean_env_variables.bat diff --git a/misc/encedo_hex2dfu/LICENSE b/misc/encedo_hex2dfu/LICENSE new file mode 100644 index 0000000000..78b8d1ebad --- /dev/null +++ b/misc/encedo_hex2dfu/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Krzysztof Rutecki + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/misc/encedo_hex2dfu/README.md b/misc/encedo_hex2dfu/README.md new file mode 100644 index 0000000000..56b086d899 --- /dev/null +++ b/misc/encedo_hex2dfu/README.md @@ -0,0 +1,76 @@ +(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 + + +3. EXTRA: Calculated CRC32 of the file and embed meta data at given address + + hex2dfu.exe -i infile.hex -o outfile.dfu -c 0x08011000 + + +4. Code siging: To sign the code ED25519 'secret' need to be provided + + hex2dfu.exe -i infile.hex -o outfile.dfu -c 0x08011000 -S d4411fa9d5cb6f91b7bd18e4ab41e7d03bf37e1d738c12b923ef0f09de90e6cf + + +5. Like above but extra data (-P) are added: + + hex2dfu.exe -i infile.hex -o outfile.dfu -c 0x08011000 -S d4411fa9d5cb6f91b7bd18e4ab41e7d03bf37e1d738c12b923ef0f09de90e6cf -e -P DEADBEEF + + +6. 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 :) + + + + + diff --git a/misc/encedo_hex2dfu/hex2dfu.exe b/misc/encedo_hex2dfu/hex2dfu.exe new file mode 100644 index 0000000000..05e5da9176 Binary files /dev/null and b/misc/encedo_hex2dfu/hex2dfu.exe differ