[Feature] add GA346 baseline version
Change-Id: Ic62933698569507dcf98240cdf5d9931ae34348f
diff --git a/src/tinysys/medmcu/tools/astyle b/src/tinysys/medmcu/tools/astyle
new file mode 100755
index 0000000..15751d3
--- /dev/null
+++ b/src/tinysys/medmcu/tools/astyle
Binary files differ
diff --git a/src/tinysys/medmcu/tools/build_tinysys.sh b/src/tinysys/medmcu/tools/build_tinysys.sh
new file mode 100755
index 0000000..d252e77
--- /dev/null
+++ b/src/tinysys/medmcu/tools/build_tinysys.sh
@@ -0,0 +1,109 @@
+#!/bin/bash
+###############################################################################
+# This script provides the customer a quick way to build Tiny System from
+# source.
+###############################################################################
+
+PROG=$(basename ${0})
+
+usage() {
+ cat >&2 <<- EOF
+USAGE
+ ${PROG} [-h] [...]
+
+ This script provides a quicker way to build tinysys.
+
+PREREQUISITE
+ The Android environment must be initialize.
+ That is, you need to run those steps at least once:
+ $ cd <ANDROID_ROOT_DIR>
+ $ . buid/envsetup.sh
+ $ lunch
+
+ This script must be executed in Android top directory.
+
+OPTIONS
+ -h Print this help message
+
+Other options for GNU make or build targets can be provided.
+For example:
+ clean Clean up all built directories and objects
+ configheader Generate C header that contains all config options
+ -jN Run N parallel build tasks
+EOF
+
+exit 1
+}
+
+info() {
+ echo "${PROG}: [INFO] ${*}"
+}
+
+error() {
+ echo "${PROG}: [ERROR] ${*}"
+ exit 1
+}
+
+check_Android_env() {
+ if [ -z "${ANDROID_PRODUCT_OUT}" ] || [ -z "${TARGET_PRODUCT}" ] ; then
+ cat >&2 <<- EOF
+[ERROR] Android environment is not ready yet.
+
+Please make sure build/envsetup.sh is sourced and lunch is executed.
+EOF
+ return 1
+ fi
+
+ return 0
+}
+
+run_build_cmd() {
+ echo "Build command: ${*}"
+ eval "${*}" || exit 1
+}
+
+#######################################
+# Main
+#######################################
+TINYSYS_ROOT='tinysys/medmcu'
+TINYSYS_TARGET='tinysys-medmcu'
+#ADSP_TARGET='tinysys-adsp'
+CLEAN_TINYSYS_TARGET="clean-${TINYSYS_TARGET}"
+#CLEAN_ADSP_TARGET="clean-${ADSP_TARGET}"
+TINYSYS_ANDROID_MK="${TINYSYS_ROOT}/Android.mk"
+CLEAN_TARGET=0
+
+# Categorize options
+for i in "${@}"; do
+ case "${i}" in
+ 'clean')
+ KEYWORDS="${KEYWORDS} ${i}"
+ CLEAN_TARGET=1
+ ;;
+ '-h')
+ usage
+ ;;
+ *) CMD_ARGS="${CMD_ARGS} ${i}"
+ esac
+done
+
+check_Android_env || exit 1
+
+# This script must be run in Android root directory
+[ -f 'build/envsetup.sh' ] || \
+ error "Please execute this command in Android top directory"
+
+#######################################
+# Here we build
+#######################################
+BUILD_CMD="ONE_SHOT_MAKEFILE=${TINYSYS_ANDROID_MK} make ${TINYSYS_TARGET} ${CMD_ARGS}"
+CLEAN_CMD="ONE_SHOT_MAKEFILE=${TINYSYS_ANDROID_MK} make ${CLEAN_TINYSYS_TARGET} ${CMD_ARGS}"
+
+
+if [ ${CLEAN_TARGET} -eq 1 ]; then
+ run_build_cmd "${CLEAN_CMD}"
+else
+ run_build_cmd "${BUILD_CMD}"
+fi
+
+exit ${?}
diff --git a/src/tinysys/medmcu/tools/codestyle b/src/tinysys/medmcu/tools/codestyle
new file mode 100755
index 0000000..cea8ed8
--- /dev/null
+++ b/src/tinysys/medmcu/tools/codestyle
@@ -0,0 +1,6 @@
+#!/bin/sh
+current_dir=$(pwd)
+script_dir=$(dirname $0)
+
+$current_dir/$script_dir/astyle --style=kr --indent=spaces=4 --indent-switches --max-code-length=120 --pad-header --pad-oper --convert-tabs --unpad-paren $@
+
diff --git a/src/tinysys/medmcu/tools/link_ld.py b/src/tinysys/medmcu/tools/link_ld.py
new file mode 100755
index 0000000..245a34d
--- /dev/null
+++ b/src/tinysys/medmcu/tools/link_ld.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# coding: UTF-8
+
+import sys, getopt
+import string
+import struct
+import operator
+import re
+import os
+
+exclude_list = []
+exclude_files = ''
+link_ld_content = []
+def usage():
+ print 'link_ld.py -i <input> -o <output>'
+
+def exclude_list_search(inputfile):
+ global exclude_list
+ global exclude_files
+ global link_ld_content
+ fo = open(inputfile,'rb+')
+ line = "gaia"
+ while line:
+ line = fo.readline()
+ m0 = re.findall('\$(.+?\.o[bj]*)\$', line)
+ if m0:
+ exclude_list += m0
+ line = line.replace('$', '')
+ link_ld_content.append(line)
+ fo.close()
+ #print link_ld_content
+ exclude_list = list(dict.fromkeys(exclude_list))
+ #print exclude_list
+ exclude_files += " ".join(exclude_list)
+
+def regen_link_ld(outputfile):
+ global exclude_list
+ global link_ld_content
+ fo = open(outputfile,'w')
+
+ line=link_ld_content.pop(0)
+ while line:
+ m0 = re.match('[ \t]*@\*@\(', line)
+ if m0:
+ line = line.replace(m0.group(0), "*(EXCLUDE_FILE(" + exclude_files +")")
+ #print m0.group(0)
+ #print line
+ fo.write(line)
+ line=link_ld_content.pop(0)
+ fo.close()
+
+def main(argv):
+ inputfile = ''
+ outputfile = ''
+ try:
+ opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
+ for opt, arg in opts:
+ if opt == '-h':
+ usage()
+ sys.exit()
+ elif opt in ("-i", "--ifile"):
+ inputfile = arg
+ elif opt in ("-o", "--ofile"):
+ outputfile = arg
+ print 'intput:', inputfile
+ print 'output:', outputfile
+ exclude_list_search(inputfile)
+ regen_link_ld(outputfile)
+
+if '__main__'==__name__:
+ ret = main(sys.argv[1:])
+ sys.exit(ret)
+