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
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
if [ -z " $1 " ] ; then
echo "Board name parameter expected"
exit 1
fi
BOARDNAME = $1
2020-06-28 10:39:09 -07:00
SHORT_BOARDNAME = $2
2021-07-17 18:41:45 -07:00
if [ -n " $3 " ] ; then
INI = " $3 "
else
INI = " rusefi_ ${ SHORT_BOARDNAME } .ini "
fi
2020-01-02 15:58:28 -08:00
2020-06-28 10:39:09 -07:00
echo " BOARDNAME= ${ BOARDNAME } SHORT_BOARDNAME= ${ SHORT_BOARDNAME } "
2021-07-30 14:15:01 -07:00
if [ " ${ SHORT_BOARDNAME } " = "all" ] ; then
SOMETHINGSOMETHING = false
else
SOMETHINGSOMETHING = true
fi
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
2021-07-30 15:14:32 -07:00
PREPEND_FILE = config/boards/${ BOARDNAME } /prepend.txt
2021-07-30 16:39:15 -07:00
BOARD_SPECIFIC_URL = $( cat $PREPEND_FILE | grep MAIN_HELP_URL | cut -d " " -f 3)
2021-07-30 15:14:32 -07:00
2021-07-30 16:33:31 -07:00
echo " BOARD_SPECIFIC_URL=[ $BOARD_SPECIFIC_URL ] for [ $BOARDNAME ] as [ $SHORT_BOARDNAME ] "
2021-07-30 15:14:32 -07:00
if [ "" = " $BOARD_SPECIFIC_URL " ] ; then
BOARD_SPECIFIC_URL = https://rusefi.com/s/wiki
fi
echo " BOARD_SPECIFIC_URL=[ $BOARD_SPECIFIC_URL ] "
2020-07-05 21:29:30 -07:00
# work in progress: migrating to rusefi_${BUNDLE_NAME}.txt
java -DSystemOut.name= gen_config_board \
-jar ../java_tools/ConfigDefinition.jar \
-definition integration/rusefi_config.txt \
2021-07-30 13:54:55 -07:00
-romraider integration \
2020-07-05 21:29:30 -07:00
-tool gen_config.sh \
-ts_destination tunerstudio \
2021-07-30 13:54:55 -07:00
-board ${ BOARDNAME } \
-ts_output_name generated/${ INI } \
2020-07-05 21:48:43 -07:00
-cache ${ SHORT_BOARDNAME } \
2020-07-05 22:01:30 -07:00
-cache_zip_file tunerstudio/generated/cache.zip \
2021-07-30 14:15:01 -07:00
-with_c_defines $SOMETHINGSOMETHING \
-initialize_to_zero $SOMETHINGSOMETHING \
2020-07-05 21:29:30 -07:00
-firing_order controllers/algo/firing_order.h \
2020-07-05 22:01:30 -07:00
-signature tunerstudio/generated/signature_${ SHORT_BOARDNAME } .txt \
2020-07-05 21:29:30 -07:00
-signature_destination controllers/generated/signature_${ SHORT_BOARDNAME } .h \
2021-07-30 13:54:55 -07:00
-java_destination ../java_console/models/src/main/java/com/rusefi/config/generated/Fields.java \
2020-08-14 12:56:59 -07:00
-enumInputFile controllers/algo/rusefi_enums.h \
2021-01-22 09:03:14 -08:00
-enumInputFile controllers/algo/rusefi_hw_enums.h \
2021-07-30 14:15:01 -07:00
-romraider_destination ../java_console/rusefi.xml \
-c_defines controllers/generated/rusefi_generated.h \
-c_destination controllers/generated/engine_configuration_generated_structures.h \
-c_fsio_constants controllers/generated/fsio_enums_generated.def \
-c_fsio_getters controllers/generated/fsio_getters.def \
-c_fsio_names controllers/generated/fsio_names.def \
-c_fsio_strings controllers/generated/fsio_strings.def \
2021-07-30 15:14:32 -07:00
-prepend $PREPEND_FILE
2020-07-05 21:29:30 -07:00
2020-07-01 11:09:01 -07:00
[ $? -eq 0 ] || { echo " ERROR generating TunerStudio config for ${ BOARDNAME } " ; exit 1; }
2020-01-02 15:58:28 -08:00
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
#
2021-07-30 13:07:22 -07:00
hw_layer/mass_storage/create_ini_image.sh ./tunerstudio/generated/${ INI } ./hw_layer/mass_storage/ramdisk_image.h 112 ${ SHORT_BOARDNAME }
hw_layer/mass_storage/create_ini_image_compressed.sh ./tunerstudio/generated/${ INI } ./hw_layer/mass_storage/ramdisk_image_compressed.h 1024 ${ SHORT_BOARDNAME }
2021-03-03 04:50:53 -08:00
2020-01-02 15:58:28 -08:00
exit 0