# HG changeset patch # User Mychaela Falconia # Date 1531690496 0 # Node ID f10cbd8a51c4edf45eb5d22a694568168899b1b3 # Parent e825175be40d737e0c727a3c6d00237943734db4 scripts: pruned import from Magnetite diff -r e825175be40d -r f10cbd8a51c4 scripts/cfg-template --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/cfg-template Sun Jul 15 21:34:56 2018 +0000 @@ -0,0 +1,93 @@ +[board.cfg] + +BOARD 41 +DSAMPLE_FULL_COLOR var + +[chipset.cfg] + +ANLG_FAM 2 +ANLG_PG 0 +CHIPSET var + +[debug.cfg] + +TI_NUC_MONITOR 0 +TI_PROFILER 0 + +[dio.cfg] + +DIOIL_CONFIG 0 + +[ffs.cfg] + +TARGET 1 +_RVF 1 + +[l1sw.cfg] + +AMR var +CUST 0 +DCO_ALGO 0 +IDS var +L1_12NEIGH 1 +L1_EOTD 0 +L1_EOTD_QBIT_ACC 0 +L1_GPRS var +L1_GTT 0 +L1_MIDI 0 +L1_VOICE_MEMO_AMR var +MELODY_E2 var +OP_L1_STANDALONE 0 +OP_RIV_AUDIO 1 +ORDER2_TX_TEMP_CAL 1 +RAZ_VULSWITCH_REGAUDIO 0 +SECURITY 0 +SPEECH_RECO var +TESTMODE 1 +TRACE_TYPE 4 +VCXO_ALGO 1 + +[r2d.cfg] + +R2D_ASM 0 +R2D_LCD_TEST 0 + +[rf.cfg] + +RF var +RF_FAM var +RF_PA var +RF_PG var + +[rv.cfg] + +RVTOOL 0 +TEST 0 +_GSM 1 + +[swconfig.cfg] + +ALR 1 +BT 0 +DP 0 +DWNLD 1 +GSMLITE 0 +L1_DYN_DSP_DWNLD var +LONG_JUMP 3 +MOVE_IN_INTERNAL_RAM 1 +OP_WCP 0 +PMODE var +RVDATA_INTERNALRAM 0 +SRVC var +TR_BAUD_CONFIG var +WCP_PROF 0 + +[sys.cfg] + +DSP var +STD 6 + +[trace.cfg] + +LAYER_DBG 0xFFFFFFFF +TRACE_LEVEL_FILTER 5 diff -r e825175be40d -r f10cbd8a51c4 scripts/config-headers.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/config-headers.sh Sun Jul 15 21:34:56 2018 +0000 @@ -0,0 +1,177 @@ +#!/bin/sh + +if [ -z "$TARGET" ] +then + echo "Error: TARGET= must be passed via environment" 1>&2 + exit 1 +fi + +if [ -z "$BUILD_DIR" ] +then + echo "Error: BUILD_DIR= must be passed via environment" 1>&2 + exit 1 +fi + +# The following vars will already be set when this script is invoked +# from configure.sh in a production build, but the following defaulting logic +# helps with manual invokation during development. + +if [ -z "$CHIPSET" ] +then + CHIPSET=10 +fi +export CHIPSET + +if [ -z "$DSP" ] +then + DSP=36 +fi +export DSP + +if [ -z "$RF" ] +then + RF=12 +fi +export RF + +if [ -z "$AMR" ] +then + AMR=1 +fi +export AMR + +if [ -z "$L1_DYN_DSP_DWNLD" ] +then + L1_DYN_DSP_DWNLD=1 +fi +export L1_DYN_DSP_DWNLD + +if [ -z "$L1_VOICE_MEMO_AMR" ] +then + L1_VOICE_MEMO_AMR=1 +fi +export L1_VOICE_MEMO_AMR + +if [ -z "$MELODY_E2" ] +then + MELODY_E2=1 +fi +export MELODY_E2 + +if [ -z "$SPEECH_RECO" ] +then + SPEECH_RECO=1 +fi +export SPEECH_RECO + +if [ -z "$GPRS" ] +then + GPRS=1 +fi +export GPRS + +if [ -z "$SRVC" ] +then + SRVC=1 +fi +export SRVC + +if [ -z "$ATP_STATE" ] +then + ATP_STATE=0 +fi +export ATP_STATE + +if [ -z "$FCHG_STATE" ] +then + FCHG_STATE=1 +fi +export FCHG_STATE + +if [ -z "$LCC_STATE" ] +then + LCC_STATE=0 +fi +export LCC_STATE + +if [ -z "$MKS_STATE" ] +then + MKS_STATE=0 +fi +export MKS_STATE + +if [ -z "$PWR_STATE" ] +then + PWR_STATE=0 +fi +export PWR_STATE + +if [ -z "$R2D_STATE" ] +then + R2D_STATE=1 +fi +export R2D_STATE + +if [ -z "$DSAMPLE_FULL_COLOR" ] +then + DSAMPLE_FULL_COLOR=1 +fi +export DSAMPLE_FULL_COLOR + +if [ -z "$TR_BAUD_CONFIG" ] +then + TR_BAUD_CONFIG=TR_BAUD_115200 +fi +export TR_BAUD_CONFIG + +# Derived settings only for the generation of *.cfg headers + +case "$RF" in + 10) + RF_FAM=10 + RF_PA=0 + RF_PG=0 + ;; + 12) + RF_FAM=12 + RF_PA=2 + RF_PG=2 + ;; + *) + echo "Error: RF=$RF setting not understood" 1>&2 + exit 1 +esac +export RF_FAM RF_PA RF_PG + +case "$GPRS" in + 0) + L1_GPRS=0 + PMODE=1 + ;; + 1) + L1_GPRS=1 + PMODE=2 + ;; + *) + echo "Error: GPRS=$GPRS setting not understood" 1>&2 + exit 1 +esac +export L1_GPRS PMODE + +if [ "$SRVC" != 0 ] +then + IDS=1 +else + IDS=0 +fi +export IDS + +# do it! + +set -e + +rm -rf $BUILD_DIR/config +mkdir $BUILD_DIR/config +helpers/cfg-hdr-gen scripts/cfg-template $BUILD_DIR/config +scripts/make-rv-swe-hdr.sh > $BUILD_DIR/config/rv_swe.h +cp targets/$TARGET.h $BUILD_DIR/config/fc-target.cfg diff -r e825175be40d -r f10cbd8a51c4 scripts/make-rv-swe-hdr.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/make-rv-swe-hdr.sh Sun Jul 15 21:34:56 2018 +0000 @@ -0,0 +1,48 @@ +#!/bin/sh + +echo '#ifndef __RV_SWE_H__' +echo '#define __RV_SWE_H__' +echo + +if [ "$ATP_STATE" = 1 ] +then + echo '#define RVM_ATP_SWE' +fi + +echo '#define RVM_AUDIO_SWE' +echo '#define RVM_ETM_SWE' +echo '#define RVM_DAR_SWE' +echo '#define RVM_SPI_SWE' +echo '#define RVM_LLS_SWE' +echo '#define RVM_KPD_SWE' + +if [ "$FCHG_STATE" = 1 ] +then + echo '#define RVM_FCHG_SWE' +fi + +if [ "$LCC_STATE" = 1 ] +then + echo '#define RVM_LCC_SWE' +fi + +if [ "$PWR_STATE" = 1 ] +then + echo '#define RVM_PWR_SWE' +fi + +if [ "$R2D_STATE" = 1 ] +then + echo '#define RVM_R2D_SWE' +fi + +if [ "$MKS_STATE" = 1 ] +then + echo '#define RVM_MKS_SWE' +fi + +echo '#define RVM_RTC_SWE' +echo '#define RVM_FFS_SWE' + +echo +echo '#endif /* __RV_SWE_H__ */' diff -r e825175be40d -r f10cbd8a51c4 scripts/make-version.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/make-version.sh Sun Jul 15 21:34:56 2018 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ $# != 1 ] +then + echo "usage: $0 component-name" 1>&2 + exit 1 +fi + +echo "static char *verstring_$1 = \"$1 FreeCalypso Magnetite\";" +echo +echo "char *$1_version(void)" +echo '{' +echo " return verstring_$1;" +echo '}' diff -r e825175be40d -r f10cbd8a51c4 scripts/mk-component.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/mk-component.sh Sun Jul 15 21:34:56 2018 +0000 @@ -0,0 +1,157 @@ +#!/bin/sh + +if [ $# -lt 1 -o $# -gt 2 ] +then + echo "usage: $0 component-lib [flavor]" 1>&2 + exit 1 +fi + +LIBNAME="$1" + +if [ -n "$2" ] +then + recipe_file="components/$1-$2" +else + recipe_file="components/$1" +fi + +if [ ! -f "$recipe_file" ] +then + echo "Error: $recipe_file not found" 1>&2 + exit 1 +fi + +if [ -z "$BUILD_DIR" ] +then + echo "Error: BUILD_DIR= must be passed via environment" 1>&2 + exit 1 +fi + +set -e + +mkdir -p $BUILD_DIR/$LIBNAME + +# beginning of the Makefile +echo "all: $LIBNAME.lib" > $BUILD_DIR/$LIBNAME/Makefile +echo >> $BUILD_DIR/$LIBNAME/Makefile + +# shell functions to be used in the recipes + +make_version() { + case $# in + 1) + echo "$1_version.c:" >> $BUILD_DIR/$LIBNAME/Makefile + echo " ../../scripts/make-version.sh $1 > $1_version.c" \ + >> $BUILD_DIR/$LIBNAME/Makefile + ;; + 2) + echo "$2_version.c:" >> $BUILD_DIR/$LIBNAME/Makefile + echo " ../../scripts/make-version.sh $1 > $2_version.c" \ + >> $BUILD_DIR/$LIBNAME/Makefile + ;; + *) + echo "Error: make_version takes 1 or 2 arguments" 1>&2 + exit 1 + ;; + esac + echo >> $BUILD_DIR/$LIBNAME/Makefile +} + +asm_file() { + if [ $# != 1 ] + then + echo "Error: asm_file takes 1 argument" 1>&2 + exit 1 + fi + objname=`basename "$1" .s`.obj + helpers/makeline dep $objname "$1" >> $BUILD_DIR/$LIBNAME/Makefile + helpers/makeline cmd ../../toolwrap/asm470 ${ASMFLAGS} "$1" '$@' \ + >> $BUILD_DIR/$LIBNAME/Makefile + echo >> $BUILD_DIR/$LIBNAME/Makefile + OBJS="$OBJS $objname" +} + +cfile_plain() { + if [ $# != 1 ] + then + echo "Error: cfile_plain takes 1 argument" 1>&2 + exit 1 + fi + objname=`basename "$1" .c`.obj + helpers/makeline dep $objname "$1" >> $BUILD_DIR/$LIBNAME/Makefile + case "$objname" in + *[A-Z]*) + helpers/makeline cmd rm -f '$@' \ + >> $BUILD_DIR/$LIBNAME/Makefile + ;; + esac + helpers/makeline cmd ../../toolwrap/cl470 -q -c ${CFLAGS} ${CPPFLAGS} \ + "$1" >> $BUILD_DIR/$LIBNAME/Makefile + case "$objname" in + *[A-Z]*) + objname_lc=`echo $objname | tr A-Z a-z` + helpers/makeline cmd mv $objname_lc $objname \ + >> $BUILD_DIR/$LIBNAME/Makefile + ;; + esac + echo >> $BUILD_DIR/$LIBNAME/Makefile + OBJS="$OBJS $objname" +} + +cfile_str2ind() { + if [ $# != 1 ] + then + echo "Error: cfile_str2ind takes 1 argument" 1>&2 + exit 1 + fi + if [ "$USE_STR2IND" = 1 ] + then + objname=`basename "$1" .c`.obj + pp_name=`echo $1 | sed -e 's/\.c$/.pp/' | tr A-Z a-z` + pp__name=`echo $1 | sed -e 's/\.c$/.pp_/' | tr A-Z a-z` + helpers/makeline dep $objname "$1" \ + >> $BUILD_DIR/$LIBNAME/Makefile + case "$objname" in + *[A-Z]*) + helpers/makeline cmd rm -f '$@' \ + >> $BUILD_DIR/$LIBNAME/Makefile + ;; + esac + helpers/makeline cmd ../../toolwrap/cl470 -q -po -p? -x \ + ${CPPFLAGS} "$1" >> $BUILD_DIR/$LIBNAME/Makefile + helpers/makeline cmd ../../toolwrap/str2ind -a \ + -t ../str2ind.tab -l ../str2ind.log \ + -f "$pp_name" >> $BUILD_DIR/$LIBNAME/Makefile + helpers/makeline cmd ../../toolwrap/cl470 -q -c ${CFLAGS} \ + "$pp__name" >> $BUILD_DIR/$LIBNAME/Makefile + helpers/makeline cmd @rm -f "$pp_name" \ + >> $BUILD_DIR/$LIBNAME/Makefile + helpers/makeline cmd @rm -f "$pp__name" \ + >> $BUILD_DIR/$LIBNAME/Makefile + case "$objname" in + *[A-Z]*) + objname_lc=`echo $objname | tr A-Z a-z` + helpers/makeline cmd mv $objname_lc $objname \ + >> $BUILD_DIR/$LIBNAME/Makefile + ;; + esac + echo >> $BUILD_DIR/$LIBNAME/Makefile + OBJS="$OBJS $objname" + else + cfile_plain "$1" + fi +} + +# invoke the recipe + +SRC=../../src +OBJS= +. "$recipe_file" + +# finish the Makefile + +helpers/makeline dep $LIBNAME.lib ${OBJS} >> $BUILD_DIR/$LIBNAME/Makefile +echo ' ../../toolwrap/ar470 r $@ $^' >> $BUILD_DIR/$LIBNAME/Makefile +echo >> $BUILD_DIR/$LIBNAME/Makefile +echo 'clean:' >> $BUILD_DIR/$LIBNAME/Makefile +echo ' rm -f *.obj *.lib *.c' >> $BUILD_DIR/$LIBNAME/Makefile diff -r e825175be40d -r f10cbd8a51c4 scripts/ti/make_cmd.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/ti/make_cmd.pl Sun Jul 15 21:34:56 2018 +0000 @@ -0,0 +1,93 @@ +#!perl + +# generate a dynamic Linker command file +# PARAMETER ARE: + +# 0 : Name of the file with the parameters +# 1 : Name of the Linker command file (output) +# 2 : value of the TOOL_CHOICE variable +# 3 : Name of the Linker command file template +# 4 - (n-1) : Name of the libraries + +#$argcount = @ARGV; +my $lnk_opt_file=$ARGV[0]; +my $cmd_file=$ARGV[1]; +my $toolchoice_type = $ARGV[2]; +my $cmd_file_temp=$ARGV[3]; +my %section; + + +open (TMP,$lnk_opt_file)||die "can't open file\n"; + +# parse the parameter file and construct replacement strings +# +# the file contains entries of the following form +# (BSS_LIBS (.bss)) +# or +# (BSS_LIBS (.bss) CONST_LIBS (.text, .const)) +# or +# (BSS_LIBS (.bss)) (BSS_LIBS (.bss) CONST_LIBS (.text, .const)) +# +# the syntax is as follows, white space and line breaks are not significant +# := +# :=
+#
:= +# := ( +# := ) +# := [A-Za-z_]+ +# := [^()]+ +# +# each entry will be linked with one library passed on the command line + +my $line; +my $count; +while ($line=) { + # find + while ($line =~ /\((\s*\w+\s*\([^\(\)]+\))+\)/) { + $line = $'; + $match = $&; + # find + while ($match =~ /\s*(\w+)\s*(\([^\(\)]+\))/ ) { + $match = $'; + $section{"$1"} .= "$ARGV[$count+4] $2\n"; + } + $count++; + } +} + +open (TMP1, ">$cmd_file"); +open (TMP,$cmd_file_temp); +while ($line=) { + my $replaced = 0; + foreach $key (keys(%section)) { + if ($line =~ /\($key\)/g) { + # insert the Libs + $line = $section{$key}; + $replaced = 1; + } + } + # NEW COMPILER MANAGEMENT + # If use of VISUAL LINKER, needs to manage trampoline download. + # Case of: + # - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902 + # - TOOL_CHOICE == 3 => compiler & linker v2.54 + + if ($toolchoice_type == 0) { + $line =~ s(COMMENT1START)(/*); + $line =~ s(COMMENT1END)(*/); + $line =~ s(COMMENT2START)(); + $line =~ s(COMMENT2END)(); + } else { + $line =~ s(COMMENT1START)(); + $line =~ s(COMMENT1END)(); + $line =~ s(COMMENT2START)(/*); + $line =~ s(COMMENT2END)(*/); + } + + if ($replaced || !($line =~ /^\s*\$\(\s*\w+\s*\)\s*$/ )) { + print TMP1 $line; + } +} +close TMP; +close TMP1; +unlink $tmp_file;