Merge pull request #11494 from haslinghuis/dshot_gpio
[betaflight.git] / src / utils / make_config_hex.sh
blob23ded14fcc63bfceee4a39d4c9f0f6ca9a33570c
1 #!/bin/bash
3 # Create hex file from custom defaults in order to flash separately
5 # This will only work if the target was built with 'CUSTOM_DEFAULTS_EXTENDED'
7 # Usage: make_config_hex <input file> <output directory> <config area start address>
8 # Choose the config area start address from:
10 # 4.1.0 released with the config area at the following offsets
11 # STM32F405: 0x080FC000
12 # STM32F411: 0x08002808
13 # STM32F7X2: 0x08002808
14 # STM32F745: 0x08002808
15 # STM32F405 uses a separate flash page for its unified config, so if a user flashes STM32F405 without 'Full Chip Erase' the unified target configuration will stay put.
17 INPUT_FILE=$1
18 DESTINATION_DIR=$2
19 TARGET_ADDRESS=$3
21 srec_cat ${INPUT_FILE} -binary -offset ${TARGET_ADDRESS} \
22 -generate '(' -maximum-address ${INPUT_FILE} -binary -maximum-address ${INPUT_FILE} -binary -offset 1 ')' \
23 -constant 0x00 -offset ${TARGET_ADDRESS} \
24 -output ${DESTINATION_DIR}/$(basename ${INPUT_FILE}).hex -intel