Browse Source

ch376-native: updated github action build scripts to also attempt to transpile driver from c to assembly

pull/592/head
Dean Netherton 1 year ago
parent
commit
bf2a45f83e
  1. 6
      .github/workflows/commit.yml
  2. 3
      .github/workflows/release.yml
  3. 7
      Makefile
  4. 12
      Source/HBIOS/ch376-native/Makefile

6
.github/workflows/commit.yml

@ -26,7 +26,8 @@ jobs:
run: |
export TZ='America/Los_Angeles'
sudo apt-get install srecord
make distlog
make transpile-c-code
make distlog --trace
rm -rf .git*
- name: List Output
@ -58,7 +59,8 @@ jobs:
run: |
export TZ='America/Los_Angeles'
brew install srecord
make distlog
make transpile-c-code
make distlog --trace
rm -rf .git*
- name: List Output

3
.github/workflows/release.yml

@ -19,7 +19,8 @@ jobs:
export TZ='America/Los_Angeles'
sudo apt-get install libncurses-dev
sudo apt-get install srecord
make distlog
make transpile-c-code
make distlog --trace
rm -rf .git*
- name: Create Package Archive

7
Makefile

@ -1,7 +1,7 @@
.PHONY: tools source clean clobber diff dist
.ONESHELL:
.SHELLFLAGS = -cex
.SHELLFLAGS = -ce
all: tools source
@ -22,6 +22,11 @@ clobber: clean
diff:
$(MAKE) --directory Source diff
# Convert c code to assembly code
transpile-c-code:
@cd Source/HBIOS/ch376-native
$(MAKE) -j
dist:
$(MAKE) ROM_PLATFORM=dist
$(MAKE) --directory Tools clean

12
Source/HBIOS/ch376-native/Makefile

@ -11,10 +11,15 @@ LIBS := -I./$(SRC)base-drv/
ZCCFLAGS := +z80 -vn -startup=0 -clib=sdcc_iy -compiler=sdcc -Cs--std=c23 -Cs--Werror $(ZCCRELFLAGS) $(LIBS)
ZCC_PATH := $(shell command -v zcc)
DOCKER_PATH := $(shell command -v docker)
ZCC := $(shell command -v zcc >/dev/null 2>&1 && echo zcc || echo 'docker run -w /host/${PWD} -v /:/host/ -u $(shell id -u ${USER}):$(shell id -g ${USER}) -t z88dk/z88dk zcc')
ifeq ($(ZCC_PATH),)
ifeq ($(DOCKER_PATH),)
.DEFAULT_GOAL := skip
else
$(info ZCC is set to use Docker to run zcc)
endif
else
$(info ZCC is set to $(ZCC_PATH))
endif
@ -23,6 +28,10 @@ ASSDIR := ./
all: $(ASSDIR)base-drv.s $(ASSDIR)scsi-drv.s $(ASSDIR)ufi-drv.s $(ASSDIR)keyboard.s
skip:
@echo "Unable to compile ch376 native to assembly. Install docker or z88dk."
exit 0
clean:
@rm -rf base-drv/*.s
rm -rf base-drv/*.asm
@ -43,7 +52,8 @@ $(ASSDIR)%.c.s: $(ASSDIR)%.c.asm
${SRC}convert-for-uz80as.sh $< $@
define compile
@mkdir -p $(dir $@)
@set -e
mkdir -p $(dir $@)
$(ZCC) $(ZCCFLAGS) --c-code-in-asm --assemble-only $< -o $@
echo "Compiled $(notdir $@) from $(notdir $<)"
endef

Loading…
Cancel
Save