From e27dfaf36f53b24a94cc1465f7739ef25674e147 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 2 Sep 2015 01:20:32 +0200 Subject: [PATCH] Update/add files for automatic conversion of HalCoGen output to RPP structure --- halcogen/.gitattributes | 2 ++ halcogen/.gitignore | 4 +++ halcogen/halcogen-cleanup.sh | 48 ++++++++++++++++++++++----- halcogen/tms570_hydctr/.gitattributes | 3 ++ halcogen/tms570_hydctr/Makefile | 15 +++++++++ halcogen/tms570_hydctr/hydctr.dil | 4 +-- 6 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 halcogen/.gitattributes create mode 100644 halcogen/.gitignore create mode 100644 halcogen/tms570_hydctr/.gitattributes create mode 100644 halcogen/tms570_hydctr/Makefile diff --git a/halcogen/.gitattributes b/halcogen/.gitattributes new file mode 100644 index 0000000..84adb46 --- /dev/null +++ b/halcogen/.gitattributes @@ -0,0 +1,2 @@ +/add-pinmux-comments.pl eaton +/halcogen-cleanup.sh eaton diff --git a/halcogen/.gitignore b/halcogen/.gitignore new file mode 100644 index 0000000..ed00aff --- /dev/null +++ b/halcogen/.gitignore @@ -0,0 +1,4 @@ +*/source/ +*/include/ +*/rpp/ +.*.stamp diff --git a/halcogen/halcogen-cleanup.sh b/halcogen/halcogen-cleanup.sh index 30364b9..8201138 100755 --- a/halcogen/halcogen-cleanup.sh +++ b/halcogen/halcogen-cleanup.sh @@ -5,9 +5,18 @@ # # Usage: halcogen-cleanup.sh [...] +DIR="" + +while [ ${1#--} != $1 ]; do + case $1 in + --output|--dir) DIR=$2; shift;; + esac + shift; +done + for i in "$@"; do - unset rename + dst=$i case $(basename $i) in # Do not rename these files *_*) ;; @@ -17,15 +26,24 @@ do dabort.asm) ;; # Rename the rest pinmux.*) - rename="$(dirname $i)/sys_$(basename $i)";; + dst="$(dirname $i)/sys_$(basename $i)";; *) - rename="$(dirname $i)/ti_drv_$(basename $i)";; + dst="$(dirname $i)/ti_drv_$(basename $i)";; + esac + + case $dst in + *.h) dst=include/sys/$(basename $dst);; + *.c) dst=src/sys/$(basename $dst);; + *.asm) dst=src/sys/asm/$(basename $dst);; esac - if test -n "$rename"; then - mv $i $rename - i=$rename + + dst=${DIR}${dst} + mkdir -p $(dirname $dst) + if [ $i != $dst ]; then + cp $i $dst fi - dos2unix "$i" + + dos2unix "$dst" sed --in-place \ -e '/\/\* USER CODE BEGIN/d' \ -e '/\/\* USER CODE END \*\//d' \ @@ -37,5 +55,19 @@ do -e 's/#include "sys_/#include "sys\/sys_/' \ -e 's/#include "\(...\)\.h/#include "sys\/ti_drv_\1.h/' \ -e 's/#include "pinmux.h"/#include "sys\/sys_pinmux.h"/' \ - "$i" + "$dst" + + case "$dst" in + */sys_pinmux.h) + perl -pwi ../add-pinmux-comments.pl $dst + perl -i -pwe 'if (/#include \"sys.reg_pinmux.h\"/) { print "#include \"base.h\"\n"; }' $dst + perl -i -nwe 'print unless /void pinmuxGetConfigValue/' $dst + ;; + */sys_pinmux.c) + perl -i -pwe 's/^\s*$/\n/' $dst + perl -i -pwe 's|#include "sys/reg_system.h"|#include "sys/system.h"|' $dst + # Delete pinmuxGetConfigValue function + perl -i -nwe 'print unless /@fn void pinmuxGetConfigValue/../^}/' $dst + ;; + esac done diff --git a/halcogen/tms570_hydctr/.gitattributes b/halcogen/tms570_hydctr/.gitattributes new file mode 100644 index 0000000..346a40e --- /dev/null +++ b/halcogen/tms570_hydctr/.gitattributes @@ -0,0 +1,3 @@ +/Makefile eaton +/hydctr.dil eaton +/hydctr.hcg eaton diff --git a/halcogen/tms570_hydctr/Makefile b/halcogen/tms570_hydctr/Makefile new file mode 100644 index 0000000..ad3930c --- /dev/null +++ b/halcogen/tms570_hydctr/Makefile @@ -0,0 +1,15 @@ +SRC=$(wildcard include/* source/*) + +all: pinmux + +.cleanup.stamp: $(SRC) ../halcogen-cleanup.sh + ../halcogen-cleanup.sh --output rpp/ $(SRC) + touch $@ + + + +.PHONY: pinmux +pinmux: .cleanup.stamp + cp rpp/include/sys/sys_pinmux.h ../../rpp/include/sys/_$(notdir $(CURDIR)) + cp rpp/include/sys/reg_pinmux.h ../../rpp/include/sys/_$(notdir $(CURDIR)) + cp rpp/src/sys/sys_pinmux.c ../../rpp/src/sys/_$(notdir $(CURDIR)) diff --git a/halcogen/tms570_hydctr/hydctr.dil b/halcogen/tms570_hydctr/hydctr.dil index 313d2c4..1174730 100644 --- a/halcogen/tms570_hydctr/hydctr.dil +++ b/halcogen/tms570_hydctr/hydctr.dil @@ -1,4 +1,4 @@ -# TMS570LS1227ZWT 09/01/15 17:52:25 +# TMS570LS1227ZWT 09/01/15 22:44:57 # ARCH=TMS570LS1227ZWT # @@ -6877,7 +6877,7 @@ DRIVER.DCC.VAR.DCC1_CLOCK_SOURCE0_FREQ.VALUE=16.0 DRIVER.DCC.VAR.DCC1_VALID0_SEED.VALUE=792 DRIVER.DCC.VAR.DCC1_BASE.VALUE=0xFFFFEC00 DRIVER.DCC.VAR.DCC2_COUNT1_SEED.VALUE=0 -DRIVER.DCC.VAR.DCC1_CLOCK_SOURCE1_FREQ.VALUE=180.0 +DRIVER.DCC.VAR.DCC1_CLOCK_SOURCE1_FREQ.VALUE=180.00 DRIVER.DCC.VAR.DCC1_CLOCK_DRIFT.VALUE=1.0 DRIVER.DCC.VAR.DCC1_ENABLE.VALUE=0xA DRIVER.DCC.VAR.DCC1_ENABLE_SINGLESHOT_MODE.VALUE=0x5 -- 2.39.2