]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/commitdiff
Update/add files for automatic conversion of HalCoGen output to RPP structure
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 1 Sep 2015 23:20:32 +0000 (01:20 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 3 Sep 2015 08:22:11 +0000 (10:22 +0200)
halcogen/.gitattributes [new file with mode: 0644]
halcogen/.gitignore [new file with mode: 0644]
halcogen/halcogen-cleanup.sh
halcogen/tms570_hydctr/.gitattributes [new file with mode: 0644]
halcogen/tms570_hydctr/Makefile [new file with mode: 0644]
halcogen/tms570_hydctr/hydctr.dil

diff --git a/halcogen/.gitattributes b/halcogen/.gitattributes
new file mode 100644 (file)
index 0000000..84adb46
--- /dev/null
@@ -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 (file)
index 0000000..ed00aff
--- /dev/null
@@ -0,0 +1,4 @@
+*/source/
+*/include/
+*/rpp/
+.*.stamp
index 30364b92b5d4438a9ff05bebee707d533e740d84..820113889719f517ff26db1682dd9c5619d85d79 100755 (executable)
@@ -5,9 +5,18 @@
 #
 # Usage: halcogen-cleanup.sh <file1> [<file2>...]
 
+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 (file)
index 0000000..346a40e
--- /dev/null
@@ -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 (file)
index 0000000..ad3930c
--- /dev/null
@@ -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))
index 313d2c41c99137d2e3de39af0def169fb5234fdd..1174730cb98d134c52c5f867a5f6190e342544f7 100644 (file)
@@ -1,4 +1,4 @@
-# TMS570LS1227ZWT 09/01/15 17:52:25\r
+# TMS570LS1227ZWT 09/01/15 22:44:57\r
 # \r
 ARCH=TMS570LS1227ZWT\r
 # \r
@@ -6877,7 +6877,7 @@ DRIVER.DCC.VAR.DCC1_CLOCK_SOURCE0_FREQ.VALUE=16.0
 DRIVER.DCC.VAR.DCC1_VALID0_SEED.VALUE=792\r
 DRIVER.DCC.VAR.DCC1_BASE.VALUE=0xFFFFEC00\r
 DRIVER.DCC.VAR.DCC2_COUNT1_SEED.VALUE=0\r
-DRIVER.DCC.VAR.DCC1_CLOCK_SOURCE1_FREQ.VALUE=180.0\r
+DRIVER.DCC.VAR.DCC1_CLOCK_SOURCE1_FREQ.VALUE=180.00\r
 DRIVER.DCC.VAR.DCC1_CLOCK_DRIFT.VALUE=1.0\r
 DRIVER.DCC.VAR.DCC1_ENABLE.VALUE=0xA\r
 DRIVER.DCC.VAR.DCC1_ENABLE_SINGLESHOT_MODE.VALUE=0x5\r