view configure.sh @ 600:8f50b202e81f

board preprocessor conditionals: prep for more FC hw in the future This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and all preprocessor conditionals throughout the code base that tested for it, replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These new symbols are specified as follows: CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by Mother Mychaela under the FreeCalypso trademark. This family will include modem products (repackagings of the FCDEV3B, possibly with RFFE or even RF transceiver changes), and also my desired FreeCalypso handset product. CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products (which will be firmware-compatible with the FCDEV3B if they use TI Rita transceiver, or will require a different fw build if we switch to one of Silabs Aero transceivers), but not the handset product. Right now this CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize everything dealing with MCSI. At the present moment the future of FC hardware evolution is still unknown: it is not known whether we will ever have any beyond-FCDEV3B hardware at all (contingent on uncertain funding), and if we do produce further FC hardware designs, it is not known whether they will retain the same FIC modem core (triband), if we are going to have a quadband design that still retains the classic Rita transceiver, or if we are going to switch to Silabs Aero II or some other transceiver. If we produce a quadband modem that still uses Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination, and the current fcdev3b build target will be renamed to fcmodem. OTOH, if that putative quadband modem will be Aero-based, then it will require a different fw build target, the fcdev3b target will stay as it is, and the two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM, but will have different RF_FAM numbers. But no matter which way we are going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B in places like ACI, and the present change clears the way for future evolution.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 01 Apr 2019 01:05:24 +0000
parents f2e752052db5
children 76f09f1bea5d
line wrap: on
line source

#!/bin/sh

set -e

if [ ! -f configure.sh ]
then
	echo "This script needs to be run from the top of the source tree" 1>&2
	exit 1
fi

if [ ! -f helpers/makeline ]
then
	echo "Please run make in the helpers directory first" 1>&2
	exit 1
fi

# start looking at our invokation line

if [ "$1" = --clean ]
then
	clean_flag=1
	shift
else
	clean_flag=0
fi

if [ $# -lt 2 ]
then
	echo "usage: $0 [--clean] target config [vars]" 1>&2
	exit 1
fi

TARGET="$1"
CONFIG="$2"

if [ ! -f "targets/$TARGET.conf" -o ! -f "targets/$TARGET.h" ]
then
	echo "Error: target $TARGET not known" 1>&2
	exit 1
fi

if [ ! -f "configs/$CONFIG" ]
then
	echo "Error: configuration $CONFIG not known" 1>&2
	exit 1
fi

# target defaults that can be overridden by $TARGET.conf

CHIPSET=10
DSP=36
RF=12
DISABLE_SLEEP=0
RVTMUX_ON_MODEM=0
UI_CONFIG=bigcolor

. "targets/$TARGET.conf"

# settings derived from the target-defined DSP version

case "$DSP" in
	33)
		AMR=0
		L1_DYN_DSP_DWNLD=0
		L1_VOICE_MEMO_AMR=0
		MELODY_E2=0
		SPEECH_RECO=0
		;;
	34)
		AMR=1
		L1_DYN_DSP_DWNLD=0
		L1_VOICE_MEMO_AMR=0
		MELODY_E2=0
		SPEECH_RECO=0
		;;
	36)
		AMR=1
		L1_DYN_DSP_DWNLD=1
		L1_VOICE_MEMO_AMR=1
		MELODY_E2=1
		SPEECH_RECO=1
		;;
	*)
		echo "Error: DSP=$DSP setting not understood" 1>&2
		exit 1
esac

# display driver configuration

DSAMPLE_FULL_COLOR=1

# miscellaneous configurable feature settings

ALLOW_CSIM_GSM=1
SERIAL_DYNAMIC_SWITCH=0
TRACEMASK_IN_FFS=0
TR_BAUD_CONFIG=TR_BAUD_115200
USE_STR2IND=0

SUFFIX=

# allow the user to override these defaults

shift
shift
while [ $# != 0 ]
do
	eval "$1"
	shift
done

BUILD_DIR="build-$TARGET-$CONFIG$SUFFIX"

echo "Building configuration $CONFIG for target $TARGET in $BUILD_DIR"

if [ "$clean_flag" = 1 ]
then
	rm -rf $BUILD_DIR
fi
mkdir -p $BUILD_DIR

: > $BUILD_DIR/lcfgen

# shell functions to be used in the configuration recipe

build_lib() {
	if [ $# -lt 1 -o $# -gt 2 ]
	then
		echo "Error: build_lib takes 1 or 2 arguments" 1>&2
		exit 1
	fi
	scripts/mk-component.sh "$1" "$2"
	SUBDIR="$SUBDIR $1"
	current_lib=$1/$1.lib
	LIBS="$LIBS $current_lib"
}

blob_lib_std() {
	if [ $# != 1 ]
	then
		echo "Error: blob_lib_std takes 1 argument" 1>&2
		exit 1
	fi
	current_lib="../blobs/libs/$1.lib"
	LIBS="$LIBS $current_lib"
}

blob_lib_gpf() {
	if [ $# != 1 ]
	then
		echo "Error: blob_lib_gpf takes 1 argument" 1>&2
		exit 1
	fi
	current_lib="../blobs/gpflibs/$1.lib"
	LIBS="$LIBS $current_lib"
}

blob_lib_os() {
	if [ $# != 1 ]
	then
		echo "Error: blob_lib_os takes 1 argument" 1>&2
		exit 1
	fi
	current_lib="../blobs/oslibs/$1.lib"
	LIBS="$LIBS $current_lib"
}

blob_lib_custom() {
	if [ $# != 2 ]
	then
		echo "Error: blob_lib_custom takes 2 arguments" 1>&2
		exit 1
	fi
	if [ -z "$1" ]
	then
		echo "Error: this config is not supported on this target" 1>&2
		exit 1
	fi
	cp $1 $BUILD_DIR/$2.lib
	current_lib=$2.lib
	LIBS="$LIBS $current_lib"
}

lib_link_magic() {
	if [ $# != 1 ]
	then
		echo "Error: lib_link_magic takes 1 argument" 1>&2
		exit 1
	fi
	if [ -z "$current_lib" ]
	then
	  echo "Error: lib_link_magic called before build_lib or blob_lib" 1>&2
	  exit 1
	fi
	SPECIAL_LINK_LIBS="$SPECIAL_LINK_LIBS $current_lib"
	echo "$1" >> $BUILD_DIR/lcfgen
}

# invoke the configuration recipe

export BUILD_DIR TARGET USE_STR2IND
export CHIPSET DSP RF
export AMR L1_DYN_DSP_DWNLD L1_VOICE_MEMO_AMR MELODY_E2 SPEECH_RECO
export DISABLE_SLEEP
export INIT_blob
export DSAMPLE_FULL_COLOR RVTMUX_ON_MODEM UI_CONFIG
export ALLOW_CSIM_GSM SERIAL_DYNAMIC_SWITCH TR_BAUD_CONFIG
export TRACEMASK_IN_FFS

SUBDIR=
LIBS=
SPECIAL_LINK_LIBS=
current_lib=

. "configs/$CONFIG"

# str2ind magic

if [ -z "$str2ind_blobs_used" ]
then
	echo "Error: configs/$CONFIG must set str2ind_blobs_used" 1>&2
	exit 1
fi

if [ "$str2ind_blobs_used" = 1 ]
then
	cp blobs/str2ind.tab $BUILD_DIR
fi

if [ "$str2ind_blobs_used" = 0 -a "$USE_STR2IND" = 0 ]
then
	echo 'char *str2ind_version = "&0";' > $BUILD_DIR/str2ind.c
fi

# generate the top level Makefile!

helpers/makeline def CONFIG_NAME "$CONFIG$SUFFIX" > $BUILD_DIR/Makefile
echo >> $BUILD_DIR/Makefile
helpers/makeline def TARGET $TARGET >> $BUILD_DIR/Makefile
echo >> $BUILD_DIR/Makefile
helpers/makeline def SUBDIR $SUBDIR >> $BUILD_DIR/Makefile
echo >> $BUILD_DIR/Makefile
helpers/makeline def LIBS $LIBS >> $BUILD_DIR/Makefile
echo >> $BUILD_DIR/Makefile
helpers/makeline def SPECIAL_LINK_LIBS $SPECIAL_LINK_LIBS >> $BUILD_DIR/Makefile
echo >> $BUILD_DIR/Makefile
helpers/makeline def LINK_SCRIPT_SRC ../$LINK_SCRIPT_SRC >> $BUILD_DIR/Makefile
echo >> $BUILD_DIR/Makefile

if [ -n "$RAM_LINK_SCRIPT_SRC" ]
then
	helpers/makeline def RAM_LINK_SCRIPT_SRC ../$RAM_LINK_SCRIPT_SRC \
		>> $BUILD_DIR/Makefile
	echo >> $BUILD_DIR/Makefile
fi

helpers/makeline def FLASH_BASE_ADDR $FLASH_BASE_ADDR >> $BUILD_DIR/Makefile
helpers/makeline def FLASH_SECTOR_SIZE $FLASH_SECTOR_SIZE >> $BUILD_DIR/Makefile
echo >> $BUILD_DIR/Makefile

cat makefile-frags/first-part >> $BUILD_DIR/Makefile

if [ "$USE_STR2IND" = 1 ]
then
	cat makefile-frags/str2ind-tab-depend >> $BUILD_DIR/Makefile
fi

if [ "$str2ind_blobs_used" = 1 -o "$USE_STR2IND" = 1 ]
then
	cat makefile-frags/str2ind-c-gen >> $BUILD_DIR/Makefile
fi

cat makefile-frags/link-steps >> $BUILD_DIR/Makefile

case "$TARGET" in
	c11x|c139|j100)
		cat makefile-frags/m0-to-bin-c139 >> $BUILD_DIR/Makefile
		;;
	c155)
		cat makefile-frags/m0-to-bin-c155 >> $BUILD_DIR/Makefile
		;;
	*)
		cat makefile-frags/m0-to-bin-std >> $BUILD_DIR/Makefile
		;;
esac

cat makefile-frags/flash-script-gen >> $BUILD_DIR/Makefile

if [ -n "$RAM_LINK_SCRIPT_SRC" ]
then
	cat makefile-frags/ram-link-steps >> $BUILD_DIR/Makefile
fi

cat makefile-frags/clean-always >> $BUILD_DIR/Makefile
if [ "$str2ind_blobs_used" = 0 ]
then
	echo '	rm -f str2ind.tab str2ind.log' >> $BUILD_DIR/Makefile
fi
if [ "$str2ind_blobs_used" = 1 -o "$USE_STR2IND" = 1 ]
then
	echo '	rm -f str2ind.c' >> $BUILD_DIR/Makefile
fi
echo >> $BUILD_DIR/Makefile
echo 'FRC:' >> $BUILD_DIR/Makefile

# All done!

echo "Run make in $BUILD_DIR to compile the firmware"