Skip to content

Commit

Permalink
Merge pull request #14 from TG9541/C0135
Browse files Browse the repository at this point in the history
C0135 with release
  • Loading branch information
TG9541 authored Apr 13, 2020
2 parents dd1f0aa + ea6e33a commit ca5bf7b
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 23 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 32 additions & 0 deletions C0135/board.fs
Original file line number Diff line number Diff line change
@@ -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
57 changes: 40 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}

Expand All @@ -8,41 +8,54 @@ 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)

.PHONY: test clean

# Usage:make term BOARD=<board dir> [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}; \
Expand All @@ -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

0 comments on commit ca5bf7b

Please sign in to comment.