view components/aci-classic @ 516:1ed9de6c90bd

src/g23m-gsm/sms/sms_for.c: bogus malloc removed The new error handling code that was not present in TCS211 blob version contains a malloc call that is bogus for 3 reasons: 1) The memory allocation in question is not needed in the first place; 2) libc malloc is used instead of one of the firmware's proper ways; 3) The memory allocation is made inside a function and then never freed, i.e., a memory leak. This bug was caught in gcc-built FreeCalypso fw projects (Citrine and Selenite) because our gcc environment does not allow any use of libc malloc (any reference to malloc produces a link failure), but this code from TCS3.2 is wrong even for Magnetite: if this code path is executed repeatedly over a long time, the many small allocations made by this malloc call without a subsequent free will eventually exhaust the malloc heap provided by the TMS470 environment, malloc will start returning NULL, and the bogus code will treat it as an error. Because the memory allocation in question is not needed at all, the fix entails simply removing it.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 22 Jul 2018 06:04:49 +0000
parents 78d1df0b8487
children afcb1115b9b3
line wrap: on
line source

# Building the classic TCS211 version of aci.lib

CFLAGS="-me -mt -o -pw2 -x -mw"
CPPFLAGS=

make_version aci
cfile_plain aci_version.c

# Defines

CPPFLAGS=-DCCDTABLES_EXTERN
CPPFLAGS="$CPPFLAGS -DOPTION_MULTITHREAD"
CPPFLAGS="$CPPFLAGS -DNEW_FRAME"
CPPFLAGS="$CPPFLAGS -DNEW_ENTITY"
CPPFLAGS="$CPPFLAGS -D_TARGET_"
CPPFLAGS="$CPPFLAGS -DSHARED_VSI"
CPPFLAGS="$CPPFLAGS -DALR"
CPPFLAGS="$CPPFLAGS -DFF_HOMEZONE"
CPPFLAGS="$CPPFLAGS -DFF_MMI_SAT_ICON"
CPPFLAGS="$CPPFLAGS -DFF_MMI_SMS_DYNAMIC"
CPPFLAGS="$CPPFLAGS -DFF_CPHS"
CPPFLAGS="$CPPFLAGS -D_TMS470"
CPPFLAGS="$CPPFLAGS -DUART"
CPPFLAGS="$CPPFLAGS -DFF_ATI"
CPPFLAGS="$CPPFLAGS -DNWARN"
CPPFLAGS="$CPPFLAGS -DFF_EM_MODE"
CPPFLAGS="$CPPFLAGS -DVOCODER_FUNC_INTERFACE"
CPPFLAGS="$CPPFLAGS -DAT_INTERPRETER"
CPPFLAGS="$CPPFLAGS -DUSE_L1FD_FUNC_INTERFACE"

if [ "$SRVC" != 0 ]
then
	CPPFLAGS="$CPPFLAGS -DFAX_AND_DATA"
	if [ "$SRVC" = 1 ]
	then
		CPPFLAGS="$CPPFLAGS -DFF_FAX"
	fi
	CPPFLAGS="$CPPFLAGS -DUSE_L2FD_FUNC_INTERFACE"
fi

CPPFLAGS="$CPPFLAGS -DSRVC=$SRVC"
CPPFLAGS="$CPPFLAGS -DMMI=$MMI"

if [ "$MMI" = 0 ]
then
	CPPFLAGS="$CPPFLAGS -DACI"
elif [ "$MMI" = 2 ]
then
	CPPFLAGS="$CPPFLAGS -DMFW"
fi

CPPFLAGS="$CPPFLAGS -DPHONEBOOK_EXTENSION"

if [ "$GPRS" = 1 ]
then
	CPPFLAGS="$CPPFLAGS -DGPRS"
fi

CPPFLAGS="$CPPFLAGS -DSMS_PDU_SUPPORT"
CPPFLAGS="$CPPFLAGS -DSIM_TOOLKIT"
CPPFLAGS="$CPPFLAGS -DDTI2"
CPPFLAGS="$CPPFLAGS -DDTI"
CPPFLAGS="$CPPFLAGS -DUART"
CPPFLAGS="$CPPFLAGS -DFF_ATI"

# Includes

CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/inc"
CPPFLAGS="$CPPFLAGS -I$SRC/$GPF/inc"
CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/include"
CPPFLAGS="$CPPFLAGS -I../../$CDGINC"

if [ "$MMI" = 2 ]
then
	CPPFLAGS="$CPPFLAGS -I$SRC/aci2/mfw"
fi

CPPFLAGS="$CPPFLAGS -I$SRC/aci2/ksd"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/ati_ext"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/aci"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/aci_ext"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/aci_dti_mng"
CPPFLAGS="$CPPFLAGS -I../../$CDGPRIM"
CPPFLAGS="$CPPFLAGS -I.."
CPPFLAGS="$CPPFLAGS -I../config"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/riviera"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_app"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/abb"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/armio"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/clkm"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/conf"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/dma"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/dsp_dwnld"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/inth"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/memif"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/rhea"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/security"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/spi"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/timer"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/uart"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/ulpd"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/system"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/include"
CPPFLAGS="$CPPFLAGS -I$SRC/cs/services"

# ACI source modules

SRCDIR=$SRC/aci2/aci

# ATI stuff
cfile_str2ind $SRCDIR/ati_sat.c
cfile_str2ind $SRCDIR/ati_src_sat.c
cfile_str2ind $SRCDIR/ati_pdu.c
cfile_str2ind $SRCDIR/ati_bas.c
cfile_str2ind $SRCDIR/ati_cc.c
cfile_str2ind $SRCDIR/ati_cmd.c
cfile_str2ind $SRCDIR/ati_csc.c
cfile_str2ind $SRCDIR/ati_err.c

if [ "$SRVC" != 0 ]
then
	cfile_str2ind $SRCDIR/ati_fd.c
fi

cfile_str2ind $SRCDIR/ati_io.c
cfile_str2ind $SRCDIR/ati_mm.c
cfile_str2ind $SRCDIR/ati_phb.c
cfile_str2ind $SRCDIR/ati_prs.c
cfile_str2ind $SRCDIR/ati_ret.c
cfile_str2ind $SRCDIR/ati_sim.c
cfile_str2ind $SRCDIR/ati_sms.c
cfile_str2ind $SRCDIR/ati_ss.c

if [ "$GPRS" = 1 ]
then
	cfile_str2ind $SRCDIR/ati_gprs.c
fi

cfile_str2ind $SRCDIR/ati_mmi.c
cfile_str2ind $SRCDIR/ati_em.c
cfile_str2ind $SRCDIR/ati_em_ret.c
cfile_str2ind $SRCDIR/ati_cphs.c
cfile_str2ind $SRCDIR/ati_dti.c

cfile_str2ind $SRCDIR/ati_src_rvt.c
cfile_str2ind $SRCDIR/ati_omcompat.c
cfile_str2ind $SRCDIR/ati_audio.c
cfile_str2ind $SRCDIR/ati_fchg.c

# ACI stuff
cfile_str2ind $SRCDIR/aci_aci.c
cfile_str2ind $SRCDIR/aci_mem.c
cfile_str2ind $SRCDIR/aci_csf.c
cfile_str2ind $SRCDIR/aci_pei.c
cfile_str2ind $SRCDIR/aci_tim.c
cfile_str2ind $SRCDIR/aci_util.c
cfile_str2ind $SRCDIR/aci_lst.c
cfile_str2ind $SRCDIR/dti_cntrl_mng.c
cfile_str2ind $SRCDIR/phb.c
cfile_str2ind $SRCDIR/aoc.c
cfile_str2ind $SRCDIR/aci_mfw.c
cfile_str2ind $SRCDIR/aci_slock.c
cfile_str2ind $SRCDIR/aci_em.c

if [ "$GPRS" = 1 ]
then
	cfile_str2ind $SRCDIR/gaci_srcc.c
	cfile_str2ind $SRCDIR/gaci.c
	cfile_str2ind $SRCDIR/gaci_ret.c
fi

cfile_str2ind $SRCDIR/hl_audio_drv.c

# ATISRC stuff
cfile_str2ind $SRCDIR/ati_src_uart.c
cfile_str2ind $SRCDIR/ati_src_uart_io.c

# CMH stuff (part 1)
cfile_str2ind $SRCDIR/cmh_sats.c
cfile_str2ind $SRCDIR/cmh_satr.c
cfile_str2ind $SRCDIR/cmh_satq.c

# CMH stuff (part 2)
if [ "$SRVC" = 0 ]
then
	cfile_str2ind $SRCDIR/cmh_ccf.c
	cfile_str2ind $SRCDIR/cmh_ccq.c
	cfile_str2ind $SRCDIR/cmh_ccr.c
	cfile_str2ind $SRCDIR/cmh_ccs.c
	cfile_str2ind $SRCDIR/cmh_dmy.c
	cfile_str2ind $SRCDIR/cmh_f.c
	cfile_str2ind $SRCDIR/cmh_mmf.c
	cfile_str2ind $SRCDIR/cmh_mmir.c
	cfile_str2ind $SRCDIR/cmh_mmis.c
	cfile_str2ind $SRCDIR/cmh_mmit.c
	cfile_str2ind $SRCDIR/cmh_mmiq.c
	cfile_str2ind $SRCDIR/cmh_mmq.c
	cfile_str2ind $SRCDIR/cmh_mmr.c
	cfile_str2ind $SRCDIR/cmh_mms.c
	cfile_str2ind $SRCDIR/cmh_mmt.c
	cfile_str2ind $SRCDIR/cmh_phbf.c
	cfile_str2ind $SRCDIR/cmh_ssq.c
	cfile_str2ind $SRCDIR/cmh_ssr.c
	cfile_str2ind $SRCDIR/cmh_sss.c
	cfile_str2ind $SRCDIR/cmh_phbq.c
	cfile_str2ind $SRCDIR/cmh_phbs.c
	cfile_str2ind $SRCDIR/cmh_phbt.c
	cfile_str2ind $SRCDIR/cmh_phbr.c
	cfile_str2ind $SRCDIR/cmh_simf.c
	cfile_str2ind $SRCDIR/cmh_simq.c
	cfile_str2ind $SRCDIR/cmh_simr.c
	cfile_str2ind $SRCDIR/cmh_sims.c
	cfile_str2ind $SRCDIR/cmh_smsf.c
	cfile_str2ind $SRCDIR/cmh_smsq.c
	cfile_str2ind $SRCDIR/cmh_smsr.c
	cfile_str2ind $SRCDIR/cmh_smss.c
	cfile_str2ind $SRCDIR/cmh_ssf.c
	cfile_str2ind $SRCDIR/cmh_tsts.c
	cfile_str2ind $SRCDIR/cmh_uartf.c
    	cfile_str2ind $SRCDIR/cmh_uartr.c
	cfile_str2ind $SRCDIR/cmh_uarts.c
fi

cfile_str2ind $SRCDIR/cmh_emq.c
cfile_str2ind $SRCDIR/cmh_emr.c

# CMH stuff (part 3)
if [ "$SRVC" != 0 ]
then
	cfile_str2ind $SRCDIR/cmh_ccf.c
	cfile_str2ind $SRCDIR/cmh_ccq.c
	cfile_str2ind $SRCDIR/cmh_ccr.c
	cfile_str2ind $SRCDIR/cmh_ccs.c
	cfile_str2ind $SRCDIR/cmh_dmy.c
	cfile_str2ind $SRCDIR/cmh_f.c
	cfile_str2ind $SRCDIR/cmh_l2rf.c
	cfile_str2ind $SRCDIR/cmh_l2rq.c
	cfile_str2ind $SRCDIR/cmh_l2rr.c
	cfile_str2ind $SRCDIR/cmh_l2rs.c
	cfile_str2ind $SRCDIR/cmh_mmf.c
	cfile_str2ind $SRCDIR/cmh_mmir.c
	cfile_str2ind $SRCDIR/cmh_mmis.c
	cfile_str2ind $SRCDIR/cmh_mmit.c
	cfile_str2ind $SRCDIR/cmh_mmiq.c
	cfile_str2ind $SRCDIR/cmh_mmq.c
	cfile_str2ind $SRCDIR/cmh_mmr.c
	cfile_str2ind $SRCDIR/cmh_mms.c
	cfile_str2ind $SRCDIR/cmh_mmt.c
	cfile_str2ind $SRCDIR/cmh_phbf.c
	cfile_str2ind $SRCDIR/cmh_phbq.c
	cfile_str2ind $SRCDIR/cmh_ssq.c
	cfile_str2ind $SRCDIR/cmh_ssr.c
	cfile_str2ind $SRCDIR/cmh_sss.c
	cfile_str2ind $SRCDIR/cmh_phbs.c
	cfile_str2ind $SRCDIR/cmh_phbt.c
	cfile_str2ind $SRCDIR/cmh_phbr.c
	cfile_str2ind $SRCDIR/cmh_raf.c
	cfile_str2ind $SRCDIR/cmh_rar.c
	cfile_str2ind $SRCDIR/cmh_ras.c
	cfile_str2ind $SRCDIR/cmh_simf.c
	cfile_str2ind $SRCDIR/cmh_simq.c
	cfile_str2ind $SRCDIR/cmh_simr.c
	cfile_str2ind $SRCDIR/cmh_sims.c
	cfile_str2ind $SRCDIR/cmh_smsf.c
	cfile_str2ind $SRCDIR/cmh_smsq.c
	cfile_str2ind $SRCDIR/cmh_smsr.c
	cfile_str2ind $SRCDIR/cmh_smss.c
	cfile_str2ind $SRCDIR/cmh_ssf.c

	if [ "$SRVC" = 1 ]
	then
		cfile_str2ind $SRCDIR/cmh_t30f.c
		cfile_str2ind $SRCDIR/cmh_t30r.c
		cfile_str2ind $SRCDIR/cmh_t30s.c
		cfile_str2ind $SRCDIR/cmh_t30q.c
	fi

	cfile_str2ind $SRCDIR/cmh_tsts.c
	cfile_str2ind $SRCDIR/cmh_uartf.c
	cfile_str2ind $SRCDIR/cmh_uartr.c
	cfile_str2ind $SRCDIR/cmh_uarts.c
fi

# CMH stuff (part 4)
# all WAP/TCPIP/SATE stuff - not in FreeCalypso

# CMH stuff (part 5)
if [ "$GPRS" = 1 ]
then
	cfile_str2ind $SRCDIR/cmh_gmmf.c
	cfile_str2ind $SRCDIR/cmh_gmmq.c
	cfile_str2ind $SRCDIR/cmh_gmmr.c
	cfile_str2ind $SRCDIR/cmh_gmms.c
	cfile_str2ind $SRCDIR/cmh_gpppf.c
	cfile_str2ind $SRCDIR/cmh_gpppr.c
	cfile_str2ind $SRCDIR/cmh_gppps.c
	cfile_str2ind $SRCDIR/cmh_snds.c
	cfile_str2ind $SRCDIR/cmh_sndr.c
	cfile_str2ind $SRCDIR/cmh_smf.c
	cfile_str2ind $SRCDIR/cmh_smq.c
	cfile_str2ind $SRCDIR/cmh_smr.c
	cfile_str2ind $SRCDIR/cmh_sms.c
	cfile_str2ind $SRCDIR/cmh_smt.c
fi

# CMH stuff (part 6)
cfile_str2ind $SRCDIR/cmh_cphs.c
cfile_str2ind $SRCDIR/cmh_dti.c

# PSA stuff
cfile_str2ind $SRCDIR/psa_satf.c
cfile_str2ind $SRCDIR/psa_satp.c
cfile_str2ind $SRCDIR/psa_sats.c
cfile_str2ind $SRCDIR/cmh_satf.c

cfile_str2ind $SRCDIR/psa_ccf.c
cfile_str2ind $SRCDIR/psa_ccp.c
cfile_str2ind $SRCDIR/psa_ccs.c
cfile_str2ind $SRCDIR/psa_f.c

if [ "$SRVC" != 0 ]
then
	cfile_str2ind $SRCDIR/psa_l2rf.c
	cfile_str2ind $SRCDIR/psa_l2rp.c
	cfile_str2ind $SRCDIR/psa_l2rs.c
fi

cfile_str2ind $SRCDIR/psa_mmf.c
cfile_str2ind $SRCDIR/psa_mmif.c
cfile_str2ind $SRCDIR/psa_mmip.c
cfile_str2ind $SRCDIR/psa_mmis.c
cfile_str2ind $SRCDIR/psa_mmp.c
cfile_str2ind $SRCDIR/psa_mms.c

if [ "$SRVC" != 0 ]
then
	cfile_str2ind $SRCDIR/psa_raf.c
	cfile_str2ind $SRCDIR/psa_rap.c
	cfile_str2ind $SRCDIR/psa_ras.c
fi

cfile_str2ind $SRCDIR/psa_simf.c
cfile_str2ind $SRCDIR/psa_simp.c
cfile_str2ind $SRCDIR/psa_sims.c
cfile_str2ind $SRCDIR/psa_smsf.c
cfile_str2ind $SRCDIR/psa_smsp.c
cfile_str2ind $SRCDIR/psa_smss.c
cfile_str2ind $SRCDIR/psa_ssf.c
cfile_str2ind $SRCDIR/psa_ssp.c
cfile_str2ind $SRCDIR/psa_sss.c

if [ "$SRVC" = 1 ]
then
	cfile_str2ind $SRCDIR/psa_t30f.c
	cfile_str2ind $SRCDIR/psa_t30p.c
	cfile_str2ind $SRCDIR/psa_t30s.c
fi

cfile_str2ind $SRCDIR/psa_util.c
cfile_str2ind $SRCDIR/psa_uartp.c
cfile_str2ind $SRCDIR/psa_uarts.c

if [ "$SRVC" != 0 ]
then
	cfile_str2ind $SRCDIR/psa_tras.c
	cfile_str2ind $SRCDIR/psa_trap.c
fi

cfile_str2ind $SRCDIR/psa_mtst.c

if [ "$GPRS" = 1 ]
then
	cfile_str2ind $SRCDIR/psa_gmmf.c
	cfile_str2ind $SRCDIR/psa_gmmp.c
	cfile_str2ind $SRCDIR/psa_gmms.c
	cfile_str2ind $SRCDIR/psa_gpppf.c
	cfile_str2ind $SRCDIR/psa_gpppp.c
	cfile_str2ind $SRCDIR/psa_gppps.c
	cfile_str2ind $SRCDIR/psa_sndp.c
	cfile_str2ind $SRCDIR/psa_snds.c
	cfile_str2ind $SRCDIR/psa_smf.c
	cfile_str2ind $SRCDIR/psa_smp.c
	cfile_str2ind $SRCDIR/psa_sms.c
fi

# miscellaneous stuff
cfile_str2ind $SRCDIR/sap_dti.c

if [ "$GPRS" = 1 ]
then
	cfile_str2ind $SRCDIR/sap_ppp.c
fi

cfile_str2ind $SRCDIR/sap_em.c
cfile_str2ind $SRCDIR/conc_sms.c
cfile_str2ind $SRCDIR/cphs.c
cfile_str2ind $SRCDIR/cphs_aci.c
cfile_str2ind $SRCDIR/line_edit.c
cfile_str2ind $SRCDIR/line_split.c
cfile_str2ind $SRCDIR/dcm_f.c

# KSD sourceset, new defines

CPPFLAGS=-DCCDTABLES_EXTERN
CPPFLAGS="$CPPFLAGS -DOPTION_MULTITHREAD"
CPPFLAGS="$CPPFLAGS -DNEW_FRAME"
CPPFLAGS="$CPPFLAGS -DNEW_ENTITY"
CPPFLAGS="$CPPFLAGS -D_TARGET_"
CPPFLAGS="$CPPFLAGS -DSHARED_VSI"
CPPFLAGS="$CPPFLAGS -DALR"
CPPFLAGS="$CPPFLAGS -DFF_HOMEZONE"
CPPFLAGS="$CPPFLAGS -DFF_MMI_SAT_ICON"
CPPFLAGS="$CPPFLAGS -DFF_MMI_SMS_DYNAMIC"
CPPFLAGS="$CPPFLAGS -DFF_CPHS"
CPPFLAGS="$CPPFLAGS -D_TMS470"
CPPFLAGS="$CPPFLAGS -DUART"
CPPFLAGS="$CPPFLAGS -DFF_ATI"
CPPFLAGS="$CPPFLAGS -DNWARN"
CPPFLAGS="$CPPFLAGS -DFF_EM_MODE"
CPPFLAGS="$CPPFLAGS -DAT_INTERPRETER"
CPPFLAGS="$CPPFLAGS -DUSE_L1FD_FUNC_INTERFACE"

if [ "$SRVC" != 0 ]
then
	CPPFLAGS="$CPPFLAGS -DFAX_AND_DATA"
	if [ "$SRVC" = 1 ]
	then
		CPPFLAGS="$CPPFLAGS -DFF_FAX"
	fi
	CPPFLAGS="$CPPFLAGS -DUSE_L2FD_FUNC_INTERFACE"
fi

CPPFLAGS="$CPPFLAGS -DSRVC=$SRVC"
CPPFLAGS="$CPPFLAGS -DMMI=$MMI"

if [ "$MMI" = 0 ]
then
	CPPFLAGS="$CPPFLAGS -DACI"
elif [ "$MMI" = 2 ]
then
	CPPFLAGS="$CPPFLAGS -DMFW"
fi

CPPFLAGS="$CPPFLAGS -DPHONEBOOK_EXTENSION"

if [ "$GPRS" = 1 ]
then
	CPPFLAGS="$CPPFLAGS -DGPRS"
fi

CPPFLAGS="$CPPFLAGS -DSMS_PDU_SUPPORT"
CPPFLAGS="$CPPFLAGS -DSIM_TOOLKIT"

# New includes

CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/inc"
CPPFLAGS="$CPPFLAGS -I$SRC/$GPF/inc"
CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/include"
CPPFLAGS="$CPPFLAGS -I../../$CDGINC"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/aci"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/ksd"
CPPFLAGS="$CPPFLAGS -I../../$CDGPRIM"

# KSD source modules

SRCDIR=$SRC/aci2/ksd

cfile_str2ind $SRCDIR/ksd.c
cfile_str2ind $SRCDIR/ksd_utl.c

# ati_ext sourceset, new defines

CPPFLAGS=-DCCDTABLES_EXTERN
CPPFLAGS="$CPPFLAGS -DOPTION_MULTITHREAD"
CPPFLAGS="$CPPFLAGS -DNEW_FRAME"
CPPFLAGS="$CPPFLAGS -DNEW_ENTITY"
CPPFLAGS="$CPPFLAGS -D_TARGET_"
CPPFLAGS="$CPPFLAGS -DSHARED_VSI"
CPPFLAGS="$CPPFLAGS -DALR"
CPPFLAGS="$CPPFLAGS -DFF_HOMEZONE"
CPPFLAGS="$CPPFLAGS -DFF_MMI_SAT_ICON"
CPPFLAGS="$CPPFLAGS -DFF_MMI_SMS_DYNAMIC"
CPPFLAGS="$CPPFLAGS -DFF_CPHS"
CPPFLAGS="$CPPFLAGS -D_TMS470"
CPPFLAGS="$CPPFLAGS -DUART"
CPPFLAGS="$CPPFLAGS -DFF_ATI"
CPPFLAGS="$CPPFLAGS -DNWARN"
CPPFLAGS="$CPPFLAGS -DFF_EM_MODE"
CPPFLAGS="$CPPFLAGS -DAT_INTERPRETER"
CPPFLAGS="$CPPFLAGS -DUSE_L1FD_FUNC_INTERFACE"

if [ "$SRVC" != 0 ]
then
	CPPFLAGS="$CPPFLAGS -DFAX_AND_DATA"
	if [ "$SRVC" = 1 ]
	then
		CPPFLAGS="$CPPFLAGS -DFF_FAX"
	fi
	CPPFLAGS="$CPPFLAGS -DUSE_L2FD_FUNC_INTERFACE"
fi

CPPFLAGS="$CPPFLAGS -DSRVC=$SRVC"
CPPFLAGS="$CPPFLAGS -DMMI=$MMI"

if [ "$MMI" = 0 ]
then
	CPPFLAGS="$CPPFLAGS -DACI"
elif [ "$MMI" = 2 ]
then
	CPPFLAGS="$CPPFLAGS -DMFW"
fi

CPPFLAGS="$CPPFLAGS -DPHONEBOOK_EXTENSION"

if [ "$GPRS" = 1 ]
then
	CPPFLAGS="$CPPFLAGS -DGPRS"
fi

CPPFLAGS="$CPPFLAGS -DSMS_PDU_SUPPORT"
CPPFLAGS="$CPPFLAGS -DSIM_TOOLKIT"

# New includes

CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/inc"
CPPFLAGS="$CPPFLAGS -I$SRC/$GPF/inc"
CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/include"
CPPFLAGS="$CPPFLAGS -I../../$CDGINC"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/aci"
CPPFLAGS="$CPPFLAGS -I$SRC/aci2/ati_ext"
CPPFLAGS="$CPPFLAGS -I../../$CDGPRIM"

# ati_ext source modules

SRCDIR=$SRC/aci2/ati_ext

cfile_str2ind $SRCDIR/ati_ext_mech.c