diff --git a/.travis.yml b/.travis.yml index ba48e5e..6e8088c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,17 +5,17 @@ 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 && cat SWIMCOM-forth.ihx" +- 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: true + tags: false branch: master repo: TG9541/stm8ef-modbus 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..05f6f66 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -STM8EF_BOARD=SWIMCOM -STM8EF_VER=2.2.24.pre1 +STM8EF_BOARD=C0135 +STM8EF_VER=2.2.24.pre2 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,45 @@ 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 +release: zip tgz -zip: - zip -r ${STM8EF_BOARD}-forth ${STM8EF_BOARD}-forth.ihx +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 -@ -defaults: - stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w tools/stm8s103FactoryDefaults.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 - -flash: target +build: words + make BOARD=CORE + +load: flash + 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 -load: target - tools/codeload.py -b out/$(STM8EF_BOARD) -p /dev/$(TERM_PORT) serial main.fs +defaults: + stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w tools/stm8s103FactoryDefaults.bin + +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 +65,15 @@ depend: fi touch depend +term: + $(E4THCOM) -t stm8ef -p .:lib $(TERM_FLAGS) -d $(TERM_PORT) -b B$(TERM_BAUD) + 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