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
2021-07-21 16:23:17 -07:00
# for example ./gen_config_board.sh hellen/hellen128 hellen128 rusefi_hellen128mercedes.ini
# or ./gen_config_board.sh hellen/hellen128 hellen128
# which is short for ./gen_config_board.sh hellen/hellen128 hellen128 rusefi_hellen128.ini
2020-07-05 19:44:45 -07:00
2024-03-07 22:17:37 -08:00
set -euo pipefail
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
if [ -z " $1 " ] ; then
echo "Board name parameter expected"
exit 1
fi
2023-02-06 04:37:17 -08:00
BOARD_DIR = $1
2020-06-28 10:39:09 -07:00
SHORT_BOARDNAME = $2
2024-03-19 13:06:40 -07:00
INI = " fome_ ${ SHORT_BOARDNAME } .ini "
2020-01-02 15:58:28 -08:00
2023-02-06 04:37:17 -08:00
echo " BOARD_DIR= ${ BOARD_DIR } SHORT_BOARDNAME= ${ SHORT_BOARDNAME } "
2020-06-28 10:39:09 -07:00
2020-07-09 07:27:20 -07:00
bash gen_signature.sh ${ SHORT_BOARDNAME }
2020-01-02 15:58:28 -08:00
2022-08-16 12:34:58 -07:00
PREPEND_FILE = ${ BOARD_DIR } /prepend.txt
2021-07-30 15:14:32 -07:00
2024-03-07 22:31:57 -08:00
# Allow the next command to fail, the board may not have a BOARD_SPECIFIC_URL
set +e
2021-07-30 18:17:10 -07:00
BOARD_SPECIFIC_URL = $( cat $PREPEND_FILE | grep MAIN_HELP_URL | cut -d " " -f 3 | sed -e 's/^"//' -e 's/"$//' )
2024-03-07 22:31:57 -08:00
set -euo pipefail
2021-07-30 15:14:32 -07:00
2023-02-06 04:37:17 -08:00
echo " BOARD_SPECIFIC_URL=[ $BOARD_SPECIFIC_URL ] for [ $SHORT_BOARDNAME ] from [ $BOARD_DIR ] "
2021-07-30 15:14:32 -07:00
if [ "" = " $BOARD_SPECIFIC_URL " ] ; then
2024-03-07 22:31:57 -08:00
BOARD_SPECIFIC_URL = https://wiki.fome.tech/
2021-07-30 15:14:32 -07:00
fi
echo " BOARD_SPECIFIC_URL=[ $BOARD_SPECIFIC_URL ] "
2023-02-21 02:29:22 -08:00
# work in progress: migrating to fome_${BUNDLE_NAME}.txt
2022-08-16 13:49:06 -07:00
java \
2024-03-19 15:23:54 -07:00
-DSystemOut.name= logs/gen_config_${ SHORT_BOARDNAME } \
-jar ../java_tools/ConfigDefinition.jar \
-readfile OUTPUTS_SECTION_FROM_FILE generated/output_channels.ini \
-readfile DATALOG_SECTION_FROM_FILE generated/data_logs.ini \
-readfile LIVE_DATA_MENU_FROM_FILE generated/fancy_menu.ini \
-readfile LIVE_DATA_PANELS_FROM_FILE generated/fancy_content.ini \
-triggerInputFolder ../unit_tests \
-with_c_defines false \
-field_lookup_file generated/value_lookup_generated.cpp generated/value_lookup_generated.md \
-java_destination ../java_console/models/src/main/java/com/rusefi/config/generated/Fields.java \
-initialize_to_zero false \
-signature tunerstudio/generated/signature_${ SHORT_BOARDNAME } .txt \
-signature_destination generated/signature_${ SHORT_BOARDNAME } .h \
2024-03-24 22:49:36 -07:00
-ts_template ./tunerstudio/tunerstudio.template.ini \
2024-03-20 01:29:00 -07:00
-ts_output_name ./tunerstudio/generated/${ INI } \
2024-03-20 01:01:52 -07:00
-board ${ BOARD_DIR } \
-prepend generated/total_live_data_generated.h \
2024-03-19 15:23:54 -07:00
-prepend integration/rusefi_config_shared.txt \
-prepend ${ BOARD_DIR } /prepend.txt \
-definition integration/rusefi_config.txt \
2024-03-20 01:01:52 -07:00
-enumInputFile controllers/algo/engine_types.h \
-enumInputFile controllers/algo/rusefi_enums.h \
2021-01-22 09:03:14 -08:00
-enumInputFile controllers/algo/rusefi_hw_enums.h \
2024-03-19 15:23:54 -07:00
-c_defines generated/rusefi_generated.h \
-c_destination generated/engine_configuration_generated_structures.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
2022-05-10 14:55:47 -07:00
# we generate both versions of the header but only one would be actually included due to conditional compilation see EFI_USE_COMPRESSED_INI_MSD
2021-03-12 19:25:03 -08:00
# todo: make things consistent by
# 0) having generated content not in the same folder with the tool generating content?
# 1) using unique file name for each configuration?
2021-05-07 16:18:43 -07:00
# 2) leverage consistent caching mechanism so that image is generated only in case of fresh .ini. Laziest approach would be to return exit code from java process above
2021-03-12 19:25:03 -08:00
#
2022-04-18 09:21:35 -07:00
hw_layer/mass_storage/create_ini_image.sh ./tunerstudio/generated/${ INI } ./hw_layer/mass_storage/ramdisk_image.h 128 ${ SHORT_BOARDNAME } ${ BOARD_SPECIFIC_URL }
2022-05-14 08:39:45 -07:00
hw_layer/mass_storage/create_ini_image_compressed.sh ./tunerstudio/generated/${ INI } ./hw_layer/mass_storage/ramdisk_image_compressed.h 1088 ${ SHORT_BOARDNAME } ${ BOARD_SPECIFIC_URL }
2021-03-03 04:50:53 -08:00
2023-02-06 04:37:17 -08:00
echo " Happy ${ SHORT_BOARDNAME } ! "
2020-01-02 15:58:28 -08:00
exit 0