#/bin/sh CUR_DIR=$(pwd) # config DEVICE=MSP430G2553 OUT_DIR=$CUR_DIR/out MAIN_FILE=$CUR_DIR/main.c # GCC directorys GCC_DIR=$HOME/ti/gcc GCC_BIN_DIR=$GCC_DIR/bin GCC_ELF_INC=$GCC_DIR/msp430-elf/include GCC_MSP_INC=$GCC_DIR/include GCC_LD=$GCC_MSP_INC/$(echo $DEVICE | tr A-Z a-z).ld # comands CC=$GCC_BIN_DIR/msp430-elf-gcc # optionsh # -O optimizer; -O0: no optimization, -O1: level 1, -O2: level 2, -O3: level 3, -Os: size, -Ofast: speed, -OG: debug experiance # -D [=] define; : the name of the defination, : the value for de definition defaults to 1 # -mmcu= muc name # -g add debug information for GDB # -ffunction-sections a specific optimisation thing # -fdata-sections a specific optimisation thing # -T add linker script (dl file) # -L add source directory for libraries(-l serches for a librarie) # -Wl,--gc-sections enable that specific optimisation thing mansiont by -ffunction-sections and -fdata-sections # -I adds directory to the search list for header files # original cmd # -Os -mmcu=${DEVICE} -g -ffunction-sections -fdata-sections -D __${DEVICE}__ -D DEPRECATED # my version # -Og -mmcu=${DEVICE} -g -D __${DEVICE}__ # original cmd # -T ${GCC_LD} -L ${GCC_MSP_INC} -mmcu=${DEVICE} -g -Wl,--gc-sections # my version # -T ${GCC_LD} -L ${GCC_MSP_INC} -mmcu=${DEVICE} -g # my complete version # -Og -mmcu=${DEVICE} -g -D__${DEVICE}__ -T ${GCC_LD} -L ${GCC_MSP_INC} -I ${GCC_MSP_INC} -I ${GCC_ELF_INC} MYFLAGS="-Og -mmcu=${DEVICE} -g -D__${DEVICE}__ -T ${GCC_LD} -L ${GCC_MSP_INC} -I ${GCC_MSP_INC} -I ${GCC_ELF_INC}" CFLAGS="-Os -D__${DEVICE}__ -mmcu=${DEVICE} -g -ffunction-sections -fdata-sections -DDEPRECATED" LDFLAGS="-T ${GCC_LD} -L ${GCC_MSP_INC} -mmcu=${DEVICE} -g -Wl,--gc-sections" INCLUDES="-I ${GCC_MSP_INC} -I ${GCC_ELF_INC}" # files EXOBJECT=$OUT_DIR/$DEVICE.elf.o EXOUTPUT=$OUT_DIR/$DEVICE.elf.out function execute(){ echo echo ========================== echo execute\> $* $* } execute mkdir -p $OUT_DIR execute $CC $MYFLAGS $MAIN_FILE -o $EXOUTPUT # execute $CC $INCLUDES $CFLAGS -c $MAIN_FILE -o $EXOBJECT # execute $CC $LDFLAGS $EXOBJECT -o $EXOUTPUT # execute mspdebug rf2500 "prog ${EXOUTPUT}" # execute mspdebug rf2500 "run"