diff --git a/BLHeli_S SiLabs/MakeHexfiles.sh b/BLHeli_S SiLabs/MakeHexfiles.sh new file mode 100755 index 00000000..e8afc100 --- /dev/null +++ b/BLHeli_S SiLabs/MakeHexfiles.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# Created by: Englebert +# Date: Wed 16 Jun 15:12:37 +08 2021 +# Description: This is to compile the hex in linux environment. My environment is UBUNTU 21.04 +LOGFILE=MakeHex_Result.log +OUTPUT_PATH=Output +HEXFILES_PATH=${OUTPUT_PATH}/Hex +REVISION=REV16_7 +##KEILPATH=~/Applications/SimplicityStudio_v5/developer/toolchains/keil_8051/9.60/BIN +KEILPATH=/home/englebert/.wine/drive_c/Keil_v5/C51/BIN +WINE=/usr/bin/wine + +if [ -e ${LOGFILE} ]; +then + rm -f ${LOGFILE} +fi + +### Adapt settings to your environment +if [ -d ${OUTPUT_PATH} ]; +then + rm -rf ${OUTPUT_PATH} +fi + +# Recreate the path +mkdir -p ${HEXFILES_PATH} + +echo "Revision: ${REVISION}" >> ${LOGFILE} +echo "Path for Keil toolchain: ${KEILPATH}" >> ${LOGFILE} +echo "Starting compilation...." >> ${LOGFILE} + +#### Common Functions #### START +compile() { + VAL="0 5 10 15 20 25 30 40 50 70 90" + + for REPEAT in ${VAL} + do + FETON_DELAY=${REPEAT} + ESCNAME=${ESC}${FETON_DELAY} + echo "F: $FETON_DELAY" + compile_code + done +} + +compile_code() { + echo "Compiling ${ESCNAME}" | tee -a ${LOGFILE} + echo "********************************************************************" | tee -a ${LOGFILE} + echo "${ESCNAME}" | tee -a ${LOGFILE} + echo "********************************************************************" | tee -a ${LOGFILE} + ### Not sure some of the exe are in capital and some in small letters. Just following what I am having in the system. + ${WINE} ${KEILPATH}/AX51.exe "BLHeli_S.asm" "DEFINE(ESCNO=${ESCNO})" "DEFINE(MCU_48MHZ=${MCU_48MHZ})" "DEFINE(FETON_DELAY=${FETON_DELAY})" "OBJECT(${OUTPUT_PATH}/${ESCNAME}_${REVISION}.OBJ)" "DEBUG" "MACRO" "NOMOD51" "COND" "SYMBOLS" "PAGEWIDTH(120)" "PAGELENGTH(65)" | tee -a ${LOGFILE} + ### ${WINE} ${KEILPATH}/AX51.exe "BLHeli_S.asm" "DEFINE(ESCNO=${ESCNO})" "DEFINE(MCU_48MHZ=${MCU_48MHZ})" "DEFINE(FETON_DELAY=${FETON_DELAY})" "OBJECT(${OUTPUT_PATH}/${ESCNAME}_${REVISION}.OBJ)" "PAGEWIDTH(120)" "PAGELENGTH(65)" | tee -a ${LOGFILE} + ${WINE} ${KEILPATH}/LX51.exe ${OUTPUT_PATH}/${ESCNAME}_${REVISION}.OBJ TO ${OUTPUT_PATH}/${ESCNAME}_${REVISION}.OMF 'PAGEWIDTH(120)' 'PAGELENGTH(65)' | tee -a ${LOGFILE} + ${WINE} ${KEILPATH}/Ohx51.exe "${OUTPUT_PATH}/${ESCNAME}_${REVISION}.OMF" "HEXFILE (${OUTPUT_PATH}/Hex/${ESCNAME}_${REVISION}.HEX)" "H386" | tee -a ${LOGFILE} +} + +#### Common Functions #### END +ESC_TYPES="A B C D E F G H I J K L M N O P Q R S T U V W Z" +ESCNO=0 + +for ESC_TYPE in ${ESC_TYPES} +do + if [[ "${ESC_TYPE}" == "W" ]]; + then + ESCNO=$((ESCNO + 3)) + else + ESCNO=$((ESCNO + 1)) + fi + + ESC=${ESC_TYPE}_L_ + MCU_48MHZ=0 + compile + + ESC=${ESC_TYPE}_H_ + MCU_48MHZ=1 + compile +done