From 82dbd90da7a1ab85ae74c11e17ffdf491f7610fe Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 13 Apr 2020 12:16:14 +0200 Subject: [PATCH 1/4] #12 modular build --- C0135/board.fs | 32 ++++++++++++++++++++++++++++++++ Makefile | 44 ++++++++++++++++++++++++++++---------------- 2 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 C0135/board.fs diff --git a/C0135/board.fs b/C0135/board.fs new file mode 100644 index 0000000..97d8a3f --- /dev/null +++ b/C0135/board.fs @@ -0,0 +1,32 @@ +#require MBSERVER + + $4000 CONSTANT EE_NODE + $4002 CONSTANT EE_BAUD + +#require :NVM +#require WIPE + +NVM +#require OUT! + + \ output handler + :NVM + coils @ OUT! + ;NVM ( xt ) + + \ --- MODBUS server startup + : init ( -- ) + ( xt ) LITERAL mbact ! + 0 coils ! + + EE_BAUD @ ( #BR ) UARTISR + EE_NODE @ DUP 0 256 WITHIN NOT IF + DROP 1 \ out of range - use default + THEN + ( n ) mbnode ! + + MBSERVER + ; + + ' init 'BOOT ! +WIPE RAM diff --git a/Makefile b/Makefile index 10bd78f..65f6781 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -STM8EF_BOARD=SWIMCOM +STM8EF_BOARD=C0135 STM8EF_VER=2.2.24.pre1 STM8EF_BIN=stm8ef-bin.zip STM8EF_URL=https://github.com/TG9541/stm8ef/releases/download/${STM8EF_VER}/${STM8EF_BIN} @@ -8,6 +8,8 @@ TERM_PORT=ttyUSB0 TERM_BAUD=9600 TERM_FLAGS= +ifeq ($(BOARD),) + # e4thcom style Forth code can't have a file suffix (but filenames are uppercase) mmforth:=$(shell echo `ls|gawk '/^[A-Z0-9]*$$/ {print}'`) forth=$(wildcard *fs) $(mmforth) @@ -15,34 +17,31 @@ forth=$(wildcard *fs) $(mmforth) .PHONY: test clean # Usage:make term BOARD= [TERM_PORT=ttyXXXX] [TERM_BAUD=nnnn] [TERM_FLAGS="--half-duplex --idm"] -term: - $(E4THCOM) -t stm8ef -p .:lib $(TERM_FLAGS) -d $(TERM_PORT) -b B$(TERM_BAUD) +all: load -all: flash +load: flash + tools/codeload.py -b out/$(STM8EF_BOARD) -p /dev/$(TERM_PORT) serial main.fs -zip: - zip -r ${STM8EF_BOARD}-forth ${STM8EF_BOARD}-forth.ihx +flash: target defaults + stm8flash -c stlinkv2 -p stm8s103f3 -w out/$(STM8EF_BOARD)/$(STM8EF_BOARD).ihx defaults: stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w tools/stm8s103FactoryDefaults.bin -flash: target - stm8flash -c stlinkv2 -p stm8s103f3 -w out/$(STM8EF_BOARD)/$(STM8EF_BOARD).ihx - -load: target - tools/codeload.py -b out/$(STM8EF_BOARD) -p /dev/$(TERM_PORT) serial main.fs +test: simload + test/mbtest.sh $(STM8EF_BOARD) simload: $(forth) target tools/simload.sh $(STM8EF_BOARD) touch simload -test: simload - test/mbtest.sh $(STM8EF_BOARD) - -target: depend +target: binary rm -f target ln -s out/${STM8EF_BOARD}/target target +binary: depend + make BOARD=C0135 + depend: if [ ! -d "out" ]; then \ curl -# -L -O ${STM8EF_URL}; \ @@ -52,5 +51,18 @@ depend: fi touch depend +term: + $(E4THCOM) -t stm8ef -p .:lib $(TERM_FLAGS) -d $(TERM_PORT) -b B$(TERM_BAUD) + +zip: + zip -r ${STM8EF_BOARD}-forth ${STM8EF_BOARD}-forth.ihx + clean: - rm -rf target STM8S103.efr STM8S105.efr simload depend docs lib mcu out inc tools + rm -rf target docs lib mcu out inc tools + rm -f forth.asm forth.h forth.mk main.c STM8S103.efr STM8S105.efr + rm -f simload depend + +else +# the STM8 eForth make is a dependency +include forth.mk +endif From e66c512ac17c04e6fcaae4b2c03128a34240f612 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 13 Apr 2020 13:50:44 +0200 Subject: [PATCH 2/4] #12 improve release --- .travis.yml | 4 ++-- Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ba48e5e..bde6dd9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ install: - docker run -v `pwd`:/home tg9541/docker-sdcc:V3.8.4 /bin/sh -c "sdcc --version ; sstm8 -version" script: docker run -v `pwd`:/home tg9541/docker-sdcc:V3.8.4 /bin/sh -c "cd /home && - make test && make zip && cat SWIMCOM-forth.ihx" + make test && make zip" deploy: provider: releases api_key: @@ -16,6 +16,6 @@ deploy: file: SWIMCOM-forth.zip skip_cleanup: true on: - tags: true + tags: false branch: master repo: TG9541/stm8ef-modbus diff --git a/Makefile b/Makefile index 65f6781..4a91487 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ STM8EF_BOARD=C0135 -STM8EF_VER=2.2.24.pre1 +STM8EF_VER=2.2.24.pre2 STM8EF_BIN=stm8ef-bin.zip STM8EF_URL=https://github.com/TG9541/stm8ef/releases/download/${STM8EF_VER}/${STM8EF_BIN} @@ -20,7 +20,7 @@ forth=$(wildcard *fs) $(mmforth) all: load load: flash - tools/codeload.py -b out/$(STM8EF_BOARD) -p /dev/$(TERM_PORT) serial main.fs + tools/codeload.py -b out/$(STM8EF_BOARD) -p /dev/$(TERM_PORT) serial $(STM8EF_BOARD)/board.fs flash: target defaults stm8flash -c stlinkv2 -p stm8s103f3 -w out/$(STM8EF_BOARD)/$(STM8EF_BOARD).ihx From c0655a21c057def66b3ddcd0823e16fe797a069e Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 13 Apr 2020 14:10:10 +0200 Subject: [PATCH 3/4] #12 improve release --- .travis.yml | 10 +++++----- Makefile | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index bde6dd9..6e8088c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,15 @@ services: before_install: - docker pull tg9541/docker-sdcc:V3.8.4 install: -- docker run -v `pwd`:/home tg9541/docker-sdcc:V3.8.4 /bin/sh -c "sdcc --version ; - sstm8 -version" -script: docker run -v `pwd`:/home tg9541/docker-sdcc:V3.8.4 /bin/sh -c "cd /home && - make test && make zip" +- docker run -v `pwd`:/home tg9541/docker-sdcc:V3.8.4 /bin/sh -c "sdcc --version ; sstm8 -version" +script: docker run -v `pwd`:/home tg9541/docker-sdcc:V3.8.4 /bin/sh -c "cd /home && make release" deploy: provider: releases api_key: secure: zAu5q6+9+zdC8weWy/xNQtuJb3TYQ9bMdiJuW80WcW2e/5xPsY9BM4rpz5r4XeFP/9IsdZhn3ZpTH1+KTZljpQwa+W1UI/OMgGMh4LzMpWawGQn8IZni3da57VTsA+EScMxVXRoRel3AfgANMKDFIhWvmj6klbj1Uw1t6fD69iw1I6sU4fKXvN3DpsPJmx4LtExHPonmZ1ikB08bDkMryo/GxWfTYlscL1CAD4Ea3O+fcWsV2X5Vne89KsL50UgheegvggbnJifXs/Lj6gBaNHIyO0peoIrxgKaTNb344yfHtEwS7JutfD5GLft7fte13doLOsrPjDDNjC0q7hDN8lCk3Aa+vgbQhudmYxW8bzTqY2vpitIoU5XTpmOsC1VFs6c7N2t3v/+uDNXZJoXWL1Nh9WnsL3j7SoBpPmPFzZ8k2Fly5WiSFI07dR2XzlXzlPBvp1ae6Rc71XH+FuPSvHQnfI99PnkozIIXZnN6lcrbN9v4oSzZ8b77l2LEH4gJDtC+gdAvXHOyD+X1JoGdxYDqZGGXOT+ecwge3gDmdzy+34n4q9qj5mqtZALrqOJMl+8z21LZ/B4nUzM1L5lclfwcO5PiMAv3LSQ7wDzFNrygpnCQi71cwn5CPs/78+xgHvnPFOeZMr/FOZL5dv/zylubIOBW1WWSX9fGB8Yt3X4= - file: SWIMCOM-forth.zip + file: + - "out/stm8ef-bin.zip" + - "out/stm8ef-bin.tgz" skip_cleanup: true on: tags: false diff --git a/Makefile b/Makefile index 4a91487..49770e7 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,20 @@ forth=$(wildcard *fs) $(mmforth) # Usage:make term BOARD= [TERM_PORT=ttyXXXX] [TERM_BAUD=nnnn] [TERM_FLAGS="--half-duplex --idm"] all: load +release: zip tgz + +zip: simload + find out/ -name "*.ihx" -print | zip -r out/stm8ef-bin LICENSE.md docs/words.md inc/* mcu/* lib/* -@ + find out/ -name "simbreak.txt" -print | zip -r out/stm8ef-bin tools/* -@ + find out/ -name "target" -print | zip -r out/stm8ef-bin -@ + +tgz: simload + ( find out/ -path "*target/*" -print0 ; find out/ -name "*.ihx" -type f -print0 ; find out/ -name "simbreak.txt" -type f -print0 ) | tar -czvf out/stm8ef-bin.tgz LICENSE.md docs/words.md mcu lib tools --null -T - + ( find out/ -name "forth.rst" -type f -print0 ) | tar -czvf out/stm8ef-rst.tgz --null -T - + +build: words + make BOARD=CORE + load: flash tools/codeload.py -b out/$(STM8EF_BOARD) -p /dev/$(TERM_PORT) serial $(STM8EF_BOARD)/board.fs From ea6e33af726d980799c023565878353014502d9d Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 13 Apr 2020 14:12:58 +0200 Subject: [PATCH 4/4] #12 improve release --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 49770e7..05f6f66 100644 --- a/Makefile +++ b/Makefile @@ -68,9 +68,6 @@ depend: term: $(E4THCOM) -t stm8ef -p .:lib $(TERM_FLAGS) -d $(TERM_PORT) -b B$(TERM_BAUD) -zip: - zip -r ${STM8EF_BOARD}-forth ${STM8EF_BOARD}-forth.ihx - clean: rm -rf target docs lib mcu out inc tools rm -f forth.asm forth.h forth.mk main.c STM8S103.efr STM8S105.efr