mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #529 from mintsoft/ci-build-sizing
CI: Output the sizes of the banks
This commit is contained in:
5 files changed
+87
-8
No files matched your search
@@ -5,6 +5,10 @@ on:
|
|||||||
branches: ['**']
|
branches: ['**']
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -13,18 +17,52 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
path: branch
|
||||||
|
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
path: main
|
||||||
|
ref: main
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt update
|
apt update
|
||||||
apt install make gcc sdcc xxd python-is-python3 libjson-c-dev zlib1g-dev -y
|
apt install make gcc sdcc xxd python-is-python3 libjson-c-dev zlib1g-dev -y
|
||||||
- name: Run the host-side unit tests
|
- name: Run the host-side unit tests
|
||||||
run: make -C test
|
run: cd branch && make -C test
|
||||||
- name: Check that every machine definition can be compiled
|
- name: Check that every machine definition can be compiled
|
||||||
run: make machine_check
|
run: cd branch && make machine_check
|
||||||
- name: Make project (4x2/RTL8372)
|
- name: Make project (4x2/RTL8372)
|
||||||
run: make CI=1 MACHINE="KP_9000_6XHML_X2"
|
run: cd branch && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/branch.map
|
||||||
- name: Make project (8x1/RTL8373)
|
- name: Make project (8x1/RTL8373)
|
||||||
run: make CI=1 MACHINE="KP_9000_9XHML_X_V3_1"
|
run: cd branch && make CI=1 MACHINE="KP_9000_9XHML_X_V3_1"
|
||||||
- name: Make project with the health instrumentation
|
- name: Make project with the health instrumentation
|
||||||
run: make clean && make CI=1 MACHINE="KP_9000_6XHML_X2" HEALTH=1
|
run: cd branch && make clean && make CI=1 MACHINE="KP_9000_6XHML_X2" HEALTH=1
|
||||||
|
- name: Make main
|
||||||
|
run: cd main && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/main.map
|
||||||
|
- name: Calculate bank growth
|
||||||
|
run: |
|
||||||
|
sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/MAIN_\1=\3/p' /tmp/main.map | sort -u >> "$GITHUB_ENV"
|
||||||
|
sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/BRANCH_\1=\3/p' /tmp/branch.map | sort -u >> "$GITHUB_ENV"
|
||||||
|
du -sb main/output/html_min | awk '{print "MAIN_WEB="$1}' >> "$GITHUB_ENV"
|
||||||
|
du -sb branch/output/html_min | awk '{print "BRANCH_WEB="$1}' >>"$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Update PR comment
|
||||||
|
uses: marocchino/sticky-pull-request-comment@v3
|
||||||
|
with:
|
||||||
|
header: Sizes
|
||||||
|
message: |
|
||||||
|
## Image Growth
|
||||||
|
|
||||||
|
Commit: ${{ github.sha }}
|
||||||
|
|
||||||
|
| Name | Main | Branch |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| XSEG | ${{ env.MAIN_XSEG }} bytes | ${{ env.BRANCH_XSEG }} bytes |
|
||||||
|
| CSEG | ${{ env.MAIN_CSEG }} bytes | ${{ env.BRANCH_CSEG }} bytes |
|
||||||
|
| DSEG | ${{ env.MAIN_DSEG }} bytes | ${{ env.BRANCH_DSEG }} bytes |
|
||||||
|
| 1 | ${{ env.MAIN_BANK1 }} bytes | ${{ env.BRANCH_BANK1 }} bytes |
|
||||||
|
| 2 | ${{ env.MAIN_BANK2 }} bytes | ${{ env.BRANCH_BANK2 }} bytes |
|
||||||
|
| 3 | ${{ env.MAIN_BANK3 }} bytes | ${{ env.BRANCH_BANK3 }} bytes |
|
||||||
|
| HTML/JS | ${{ env.MAIN_WEB }} bytes | ${{ env.BRANCH_WEB }} bytes |
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
.idea/
|
.idea/
|
||||||
output/
|
output/
|
||||||
|
output-main/
|
||||||
html_data.c
|
html_data.c
|
||||||
html_data.h
|
html_data.h
|
||||||
version.h
|
version.h
|
||||||
@@ -12,3 +13,4 @@ build/
|
|||||||
# host-test stand-ins for the two generated headers
|
# host-test stand-ins for the two generated headers
|
||||||
!test/stub/html_data.h
|
!test/stub/html_data.h
|
||||||
!test/stub/version.h
|
!test/stub/version.h
|
||||||
|
.vscode
|
||||||
@@ -34,7 +34,10 @@ endif
|
|||||||
# The board definition being built: one file per MACHINE_* symbol in machine.h.
|
# The board definition being built: one file per MACHINE_* symbol in machine.h.
|
||||||
MACHINE_SRC = machine/$(MACHINE).c
|
MACHINE_SRC = machine/$(MACHINE).c
|
||||||
|
|
||||||
|
ifndef BUILDDIR
|
||||||
BUILDDIR = output/$(MACHINE)
|
BUILDDIR = output/$(MACHINE)
|
||||||
|
endif
|
||||||
|
|
||||||
VERSION_HEADER := version.h
|
VERSION_HEADER := version.h
|
||||||
|
|
||||||
GIT_VERSION := $(shell git rev-parse --short HEAD)
|
GIT_VERSION := $(shell git rev-parse --short HEAD)
|
||||||
@@ -61,6 +64,9 @@ endif
|
|||||||
# is built, including the tools/ subdirectory.
|
# is built, including the tools/ subdirectory.
|
||||||
all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin
|
all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin
|
||||||
|
|
||||||
|
bank_size:
|
||||||
|
tools/bank_occupancy.sh "$(MACHINE)"
|
||||||
|
|
||||||
create_build_dir:
|
create_build_dir:
|
||||||
mkdir -p "$(BUILDDIR)"
|
mkdir -p "$(BUILDDIR)"
|
||||||
mkdir -p "$(BUILDDIR)/uip"
|
mkdir -p "$(BUILDDIR)/uip"
|
||||||
@@ -133,7 +139,7 @@ HTML := $(shell find html -name '*.js' -or -name '*.html' -or -name '*.svg' -or
|
|||||||
# Minified copy of the web UI sources, used as the fileadder input.
|
# Minified copy of the web UI sources, used as the fileadder input.
|
||||||
# The raw html/ sources stay untouched for development; the minified
|
# The raw html/ sources stay untouched for development; the minified
|
||||||
# copy is a build artifact under output/.
|
# copy is a build artifact under output/.
|
||||||
HTML_MIN := output/html_min
|
HTML_MIN := $(BUILDDIR)/html_min
|
||||||
.PHONY: html_min
|
.PHONY: html_min
|
||||||
html_min: $(HTML)
|
html_min: $(HTML)
|
||||||
rm -rf $(HTML_MIN)
|
rm -rf $(HTML_MIN)
|
||||||
@@ -155,7 +161,7 @@ $(VERSION_HEADER): FORCE
|
|||||||
httpd: html_data.h
|
httpd: html_data.h
|
||||||
|
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
$(MAKE) -C $@
|
$(MAKE) -C $@ BUILDDIR=$(BUILDDIR)
|
||||||
|
|
||||||
clean: $(SUBDIRSCLEAN)
|
clean: $(SUBDIRSCLEAN)
|
||||||
-rm -f html_data.c html_data.h $(VERSION_HEADER)
|
-rm -f html_data.c html_data.h $(VERSION_HEADER)
|
||||||
@@ -198,7 +204,7 @@ $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.i
|
|||||||
tools/output/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
tools/output/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
||||||
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@
|
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@
|
||||||
tools/output/crc_calculator -u $@
|
tools/output/crc_calculator -u $@
|
||||||
ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin output/rtlplayground.bin
|
ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin $(BUILDDIR)/../rtlplayground.bin
|
||||||
|
|
||||||
.PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) create_build_dir
|
.PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) create_build_dir
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CCFLAGS = -Wall -o
|
CCFLAGS = -Wall -o
|
||||||
|
ifndef BUILDDIR
|
||||||
BUILDDIR = output
|
BUILDDIR = output
|
||||||
|
endif
|
||||||
|
|
||||||
all: create_build_dir $(BUILDDIR)/injector $(BUILDDIR)/fileadder $(BUILDDIR)/httpd_sim\
|
all: create_build_dir $(BUILDDIR)/injector $(BUILDDIR)/fileadder $(BUILDDIR)/httpd_sim\
|
||||||
$(BUILDDIR)/crc_calculator $(BUILDDIR)/imagebuilder
|
$(BUILDDIR)/crc_calculator $(BUILDDIR)/imagebuilder
|
||||||
|
|||||||
Executable
+31
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
MACHINE="$1"
|
||||||
|
if [[ ! -s output-main/rtlplayground.map ]]; then
|
||||||
|
original_branch=$(git branch --show-current)
|
||||||
|
#trap 'git switch "$original_branch"' EXIT
|
||||||
|
git switch main && make CI=1 MACHINE="$MACHINE" BUILDDIR=output-main
|
||||||
|
git switch "$original_branch"
|
||||||
|
fi
|
||||||
|
source <(sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/main_\1=\3/p' output-main/rtlplayground.map | sort -u)
|
||||||
|
|
||||||
|
main_WEB=$(du -sb output-main/html_min | awk '{print $1}')
|
||||||
|
if [[ ! -s "output/$MACHINE/rtlplayground.map" ]]; then
|
||||||
|
make CI=1 MACHINE="$MACHINE"
|
||||||
|
fi
|
||||||
|
source <(sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/branch_\1=\3/p' output/"$MACHINE"/rtlplayground.map | sort -u)
|
||||||
|
branch_WEB=$(du -sb output/html_min | awk '{print $1}')
|
||||||
|
|
||||||
|
print_line() {
|
||||||
|
local name=$1 main=$2 branch=$3
|
||||||
|
printf '%-20s %-20s %-20s %-20s\n' "$name" "$main" "$branch" "$((branch - main))"
|
||||||
|
}
|
||||||
|
|
||||||
|
printf '%-20s %-20s %-20s %-20s\n' "segment" "main" "branch" "change"
|
||||||
|
|
||||||
|
print_line "BANK1" "$main_BANK1" "$branch_BANK1"
|
||||||
|
print_line "BANK2" "$main_BANK2" "$branch_BANK2"
|
||||||
|
print_line "BANK3" "$main_BANK3" "$branch_BANK3"
|
||||||
|
print_line "CSEG" "$main_CSEG" "$branch_CSEG"
|
||||||
|
print_line "DSEG" "$main_DSEG" "$branch_DSEG"
|
||||||
|
print_line "XSEG" "$main_XSEG" "$branch_XSEG"
|
||||||
|
print_line "WEB" "$main_WEB" "$branch_WEB"
|
||||||
Reference in new issue
Block a user