2020-07-09 07:27:20 -07:00
|
|
|
#!/bin/bash
|
2020-01-02 15:58:28 -08:00
|
|
|
|
2020-07-05 19:44:45 -07:00
|
|
|
# file gen_config_board.sh
|
2023-12-19 17:32:24 -08:00
|
|
|
# for example ./gen_config_board.sh config/boards/hellen/hellen128 hellen128
|
2023-12-13 15:00:35 -08:00
|
|
|
# ./gen_config_board.sh config/boards/hellen/hellen-honda-k hellen-honda-k
|
2023-10-25 07:47:43 -07:00
|
|
|
# or ./gen_config_board.sh config/boards/atlas atlas
|
2023-11-13 22:02:20 -08:00
|
|
|
# ./gen_config_board.sh config/boards/proteus proteus_f7
|
2023-12-03 07:58:58 -08:00
|
|
|
# ./gen_config_board.sh config/boards/hellen/uaefi uaefi
|
2023-12-17 13:48:37 -08:00
|
|
|
# ./gen_config_board.sh config/boards/hellen/small-can-board small-can-board
|
2023-12-06 11:32:30 -08:00
|
|
|
# ./gen_config_board.sh config/boards/f407-discovery f407-discovery
|
2023-12-18 13:07:14 -08:00
|
|
|
# ./gen_config_board.sh config/boards/nucleo_f767 nucleo_f767
|
2020-07-05 19:44:45 -07:00
|
|
|
|
2021-03-03 04:50:53 -08:00
|
|
|
set -e
|
2020-01-02 15:58:28 -08:00
|
|
|
|
2020-07-05 19:39:55 -07:00
|
|
|
echo "This script reads rusefi_config.txt and produces firmware persistent configuration headers"
|
|
|
|
echo "the storage section of rusefiXXX.ini is updated as well"
|
2020-01-02 15:58:28 -08:00
|
|
|
|
2024-02-17 13:38:10 -08:00
|
|
|
BOARD_DIR=${1:-$BOARD_DIR}
|
|
|
|
SHORT_BOARD_NAME=${2:-$SHORT_BOARD_NAME}
|
2024-02-24 07:27:30 -08:00
|
|
|
INI=${3:-"rusefi_$SHORT_BOARD_NAME.ini"}
|
2023-12-01 15:05:42 -08:00
|
|
|
|
|
|
|
if [ -z "$BOARD_DIR" ]; then
|
2024-02-26 19:18:56 -08:00
|
|
|
echo "Board dir parameter expected"
|
2020-01-02 15:58:28 -08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-01-30 04:53:27 -08:00
|
|
|
if [ -z "$SHORT_BOARD_NAME" ]; then
|
2024-02-26 19:18:56 -08:00
|
|
|
echo "Short board name parameter expected"
|
2023-12-01 15:05:42 -08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-01-30 04:53:27 -08:00
|
|
|
echo "BOARD_DIR=${BOARD_DIR} SHORT_BOARD_NAME=${SHORT_BOARD_NAME}"
|
2020-06-28 10:39:09 -07:00
|
|
|
|
2024-04-24 14:55:09 -07:00
|
|
|
shopt -s expand_aliases
|
|
|
|
if which grealpath >/dev/null 2>&1; then alias realpath='grealpath'; fi
|
2024-02-26 19:18:56 -08:00
|
|
|
FDIR=$(realpath $(dirname "$0"))
|
|
|
|
BOARD_DIR=$(realpath --relative-to "$FDIR" "$BOARD_DIR")
|
|
|
|
|
2024-02-26 20:15:05 -08:00
|
|
|
cd "$FDIR"
|
2024-02-26 19:18:56 -08:00
|
|
|
|
2021-10-23 09:48:49 -07:00
|
|
|
source gen_config_common.sh
|
|
|
|
echo "Using COMMON_GEN_CONFIG [$COMMON_GEN_CONFIG]"
|
|
|
|
|
2024-03-18 07:16:04 -07:00
|
|
|
JAVA_REMOTE_DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"
|
|
|
|
|
2022-04-11 08:43:35 -07:00
|
|
|
# in rare cases order of arguments is important - '-tool' should be specified before '-definition'
|
2024-03-18 07:16:04 -07:00
|
|
|
#java $JAVA_REMOTE_DEBUG \
|
2022-08-16 13:49:06 -07:00
|
|
|
java \
|
2022-04-11 08:47:59 -07:00
|
|
|
$COMMON_GEN_CONFIG_PREFIX \
|
|
|
|
-tool gen_config.sh \
|
2021-10-23 09:48:49 -07:00
|
|
|
$COMMON_GEN_CONFIG \
|
2023-08-21 20:09:52 -07:00
|
|
|
-enumInputFile controllers/algo/rusefi_hw_stm32_enums.h \
|
2023-08-21 17:06:54 -07:00
|
|
|
-enumInputFile controllers/algo/rusefi_hw_adc_enums.h \
|
2024-01-30 04:53:27 -08:00
|
|
|
-c_defines controllers/generated/rusefi_generated_${SHORT_BOARD_NAME}.h \
|
|
|
|
-c_destination controllers/generated/engine_configuration_generated_structures_${SHORT_BOARD_NAME}.h
|
2020-07-05 21:29:30 -07:00
|
|
|
|
2023-02-06 04:37:17 -08:00
|
|
|
[ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for ${BOARD_DIR}"; exit 1; }
|
2020-01-02 15:58:28 -08:00
|
|
|
|
2024-03-19 18:49:01 -07:00
|
|
|
|
2024-01-30 04:53:27 -08:00
|
|
|
echo "Happy ${SHORT_BOARD_NAME}!"
|
2020-01-02 15:58:28 -08:00
|
|
|
exit 0
|