Merge branch 'logicog:main' into main

This commit is contained in:
Zoë O'Connell authored and GitHub committed 2026-10-27 17:24:37 +00:00
commit 3910888052
4 files changed
+45 -11

No files matched your search

+25 -7
View File
@@ -4,6 +4,10 @@ DEFAULT_CONFIG_LOCATION = 454656
CONFIG_LOCATION = 458752 CONFIG_LOCATION = 458752
HTML_LOCATION = 262144 HTML_LOCATION = 262144
# Startup configuration embedded in the image. Override it to build a specific
# machine with its own configuration: make MACHINE=<name> CONFIG=<file>
CONFIG ?= config.txt
SDCC_TOOLCHAIN = sdcc-$(shell cat sdcc/* | cksum | cut -d' ' -f1) SDCC_TOOLCHAIN = sdcc-$(shell cat sdcc/* | cksum | cut -d' ' -f1)
SDCC_PREFIX = toolchain/$(SDCC_TOOLCHAIN) SDCC_PREFIX = toolchain/$(SDCC_TOOLCHAIN)
ifeq ($(origin CC),default) ifeq ($(origin CC),default)
@@ -56,6 +60,7 @@ ifndef BUILDDIR
BUILDDIR = output/$(MACHINE) BUILDDIR = output/$(MACHINE)
endif endif
CONFIG_STAMP := $(BUILDDIR)/.config
VERSION_HEADER := version.h VERSION_HEADER := version.h
GIT_VERSION := $(shell git rev-parse --short HEAD) GIT_VERSION := $(shell git rev-parse --short HEAD)
@@ -78,9 +83,10 @@ BUILD_DATE := $(shell date -u -d @$(SOURCE_DATE_EPOCH) +"%Y-%m-%d %H:%M:%S" 2>/d
|| date -u -r $(SOURCE_DATE_EPOCH) +"%Y-%m-%d %H:%M:%S") || date -u -r $(SOURCE_DATE_EPOCH) +"%Y-%m-%d %H:%M:%S")
endif endif
# $(MACHINE_SRC) is listed here so an unknown $MACHINE fails before anything else # $(MACHINE_SRC) and $(CONFIG) are listed here so an unknown $MACHINE or a
# is built, including the tools/ subdirectory. # missing config file fails before anything else is built, including the tools/
all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin # subdirectory.
all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(CONFIG) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin
bank_size: bank_size:
tools/bank_occupancy.sh "$(MACHINE)" tools/bank_occupancy.sh "$(MACHINE)"
@@ -101,6 +107,12 @@ $(MACHINE_SRC):
@echo " Example: make MACHINE=KP_9000_6XHML_X2" >&2 @echo " Example: make MACHINE=KP_9000_6XHML_X2" >&2
@false @false
# Fail with a clear message when CONFIG names a file that does not exist.
$(CONFIG):
@echo "ERROR: CONFIG='$(CONFIG)' does not exist." >&2
@echo " Point CONFIG at a configuration file, or omit it to use config.txt." >&2
@false
# Keep the per-machine definition in first position to fail immediately on an # Keep the per-machine definition in first position to fail immediately on an
# invalid $MACHINE value # invalid $MACHINE value
SRCS = \ SRCS = \
@@ -220,6 +232,12 @@ FORCE:
$(CCFLAGS_STAMP): FORCE | create_build_dir $(CCFLAGS_STAMP): FORCE | create_build_dir
@echo '$(CC_FLAGS)' | cmp -s - $@ 2>/dev/null || echo '$(CC_FLAGS)' > $@ @echo '$(CC_FLAGS)' | cmp -s - $@ 2>/dev/null || echo '$(CC_FLAGS)' > $@
# The same for $(CONFIG): its path is stamped so switching to a config file
# older than the image still rebuilds it, while $(CONFIG) itself as a normal
# prerequisite covers edits to the selected file.
$(CONFIG_STAMP): FORCE | create_build_dir
@echo '$(CONFIG)' | cmp -s - $@ 2>/dev/null || echo '$(CONFIG)' > $@
$(BUILDDIR)/%.rel: %.c $(CCFLAGS_STAMP) | create_build_dir html_data.h $(BUILDDIR)/%.rel: %.c $(CCFLAGS_STAMP) | create_build_dir html_data.h
$(CC) -MMD $(CC_FLAGS) -o $@ -c $< $(CC) -MMD $(CC_FLAGS) -o $@ -c $<
@@ -233,11 +251,11 @@ $(BUILDDIR)/rtlplayground.ihx: $(OBJS) $(BUILDDIR)/crtbank.rel $(BUILDDIR)/crc16
$(BUILDDIR)/rtlplayground.img: $(BUILDDIR)/rtlplayground.ihx $(BUILDDIR)/rtlplayground.img: $(BUILDDIR)/rtlplayground.ihx
objcopy --input-target=ihex -O binary $< $@ objcopy --input-target=ihex -O binary $< $@
$(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.img | tools $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.img $(CONFIG) $(CONFIG_STAMP) | tools
if [ -e $@ ]; then rm $@; fi if [ -e $@ ]; then rm $@; fi
tools/$(BUILDDIR)/imagebuilder -i $^ $@ tools/$(BUILDDIR)/imagebuilder -i $(BUILDDIR)/rtlplayground.img $@
tools/$(BUILDDIR)/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@ tools/$(BUILDDIR)/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d "$(CONFIG)" $@
tools/$(BUILDDIR)/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@ tools/$(BUILDDIR)/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d "$(CONFIG)" $@
tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@ tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@
tools/$(BUILDDIR)/crc_calculator -u $@ tools/$(BUILDDIR)/crc_calculator -u $@
ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin $(BUILDDIR)/../rtlplayground.bin ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin $(BUILDDIR)/../rtlplayground.bin
+7
View File
@@ -127,6 +127,13 @@ The name selects the board definition `machine/<name>.c`; `make` without a
`MACHINE` value stops with an error listing what is expected. If your board is `MACHINE` value stops with an error listing what is expected. If your board is
not in the list yet, see [Adding a new device](doc/adding-a-device.md). not in the list yet, see [Adding a new device](doc/adding-a-device.md).
To embed a machine-specific startup configuration, pass `CONFIG`:
```
make MACHINE=DEFAULT_8C_1SFP CONFIG=configs/DEFAULT_8C_1SFP.txt
```
`CONFIG` defaults to `config.txt`; the selected file is embedded in the image
and changing it triggers a rebuild.
> [!TIP] > [!TIP]
> You can write configuration parameters in config.txt (see below) in order your switch to get > You can write configuration parameters in config.txt (see below) in order your switch to get
> straight at the first boot, a correct IP configuration. > straight at the first boot, a correct IP configuration.
+2 -1
View File
@@ -954,6 +954,7 @@ function byPort(a){return a.sort(function(x,y){return x.portNum-y.portNum})}
function pollStatus(){ function pollStatus(){
return getJSON("/status.json").then(function(s){ return getJSON("/status.json").then(function(s){
byPort(s); byPort(s);
S.ports=s;
var now=Date.now(); var now=Date.now();
if(!S.n){ if(!S.n){
S.n=s.length; S.n=s.length;
@@ -975,7 +976,7 @@ function pollStatus(){
}; };
}); });
} }
S.prev=s;S.prevT=now;S.ports=s; S.prev=s;S.prevT=now;
updateStrip(); updateStrip();
var hk=tabHooks[curTab]; var hk=tabHooks[curTab];
if(hk&&hk.status)hk.status(); if(hk&&hk.status)hk.status();
+11 -3
View File
@@ -125,12 +125,20 @@ label.row span.lb{width:110px;flex:none;color:var(--fg2);font-size:13px}
.port .pn{font-weight:650;font-size:12px} .port .pn{font-weight:650;font-size:12px}
.port .ps{font-size:9px;color:var(--fg2);display:block;line-height:1.2} .port .ps{font-size:9px;color:var(--fg2);display:block;line-height:1.2}
.port .jack{ .port .jack{
display:block;width:16px;height:10px;margin:2px auto 1px;border-radius:2px; display:block;width:21px;height:12px;margin:4px auto 2px;border-radius:2px;
border:2px solid var(--fg2);border-top-width:4px;opacity:.55; border:2px solid var(--fg2);border-top-width:8px;opacity:.55;position:relative;
} }
.port.sfp .jack{width:24px;height:9px;border-top-width:3px} .port .jack:before{content:"";
position:absolute;bottom:100%;left:50%;transform:translateX(-50%);
width:6px;height:5px;margin-bottom:7px;border-radius: 1px 1px 0 0;
background-color:var(--fg2);
}
.port.sfp .jack{width:24px;height:16px;margin:0 auto 2px;border-top-width:5px}
.port.sfp .jack:before{width:10px;margin-bottom:2px;border-radius:0 0 1px 1px;background-color:var(--panel2)}
.port.up{border-color:var(--pc);background:color-mix(in srgb,var(--pc) 10%,var(--panel2))} .port.up{border-color:var(--pc);background:color-mix(in srgb,var(--pc) 10%,var(--panel2))}
.port.up .jack{border-color:var(--pc);opacity:1} .port.up .jack{border-color:var(--pc);opacity:1}
.port.up .jack:before{background-color:var(--pc)}
.port.up.sfp .jack:before{background-color:color-mix(in srgb,var(--pc) 10%,var(--panel2))}
.port.up .ps{color:var(--pc);font-weight:600} .port.up .ps{color:var(--pc);font-weight:600}
.port.dis{opacity:.45;border-style:dashed} .port.dis{opacity:.45;border-style:dashed}
.badge{font-size:11px;font-weight:600;border-radius:10px;padding:1px 8px;background:var(--panel2);color:var(--fg2)} .badge{font-size:11px;font-weight:600;border-radius:10px;padding:1px 8px;background:var(--panel2);color:var(--fg2)}