diff --git a/Makefile b/Makefile index f4eae70..1f6df9b 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ main.ihx: main.c $(MDEPS) mkdir -p out/$(BOARD)/target rm -f out/$(BOARD)/target/* tools/genalias.awk -v target="out/$(BOARD)/target/" out/$(BOARD)/forth.rst - tools/genefr.awk out/$(BOARD)/forth.rst > out/$(BOARD)/FORTH.efr + tools/genconst.awk -v target="out/$(BOARD)/target/" out/$(BOARD)/forth.rst forth.rel: forth.asm mkdir -p out/$(BOARD) diff --git a/STM8S103.efr b/mcu/STM8S103.efr similarity index 100% rename from STM8S103.efr rename to mcu/STM8S103.efr diff --git a/STM8S105.efr b/mcu/STM8S105.efr similarity index 100% rename from STM8S105.efr rename to mcu/STM8S105.efr diff --git a/tools/genalias.awk b/tools/genalias.awk index 5619cb6..3702aec 100755 --- a/tools/genalias.awk +++ b/tools/genalias.awk @@ -120,7 +120,9 @@ END { } function makeAlias(word,addr) { - print ": " word " [ $CC C, $" ALIASADDR[word] " , OVERT" > target word + filename = word + gsub("/", "_", filename) # replace "/" - it's forbidden in Linux filenames + print ": " word " [ $CC C, $" ALIASADDR[word] " , OVERT" > target filename } function result (text) { diff --git a/tools/genconst.awk b/tools/genconst.awk new file mode 100755 index 0000000..b71156c --- /dev/null +++ b/tools/genconst.awk @@ -0,0 +1,19 @@ +#!/usr/bin/gawk -f +BEGIN { + if (!target) { + target = "target/" + } +} + +$3!~/(LINK|RAMPOOL)/ && $4=="=" && $5~/(UPP|RAMPOOL)/ && $1~/^00/ { + if (split($0,b,"\"") == 3) { + symbol = b[2] + } + else { + symbol = $3 + } + split($0,a,";"); + addr = "$" substr($1,3) + comment = " \\ " a[2] + print addr " CONSTANT " symbol comment > target symbol +}