mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Added software version + git short hash string to firmware.
The Makefile has the version number and generates a version.h which
has VERSION_SW define that looks like "v<VERSION>-g<GIT_SHORT_HASH>".
Software version shows at boot in the serial console.
And shown with command: `version`.
It can also be requested via `information.json`.
```
{
"ip_address": "192.168.10.247",
"ip_gateway": "192.168.10.1",
"ip_netmask": "255.255.255.0",
"mac_address": "1c:2a:a3:23:00:02",
"sw_ver": "v0.1.0-gd48235f",
"hw_ver": "SWGT024-V2.0"
}
```
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
BOOTLOADER_ADDRESS=0x100
|
||||
|
||||
VERSION=0.1.0
|
||||
IMAGESIZE = 524288
|
||||
CONFIG_LOCATION = 458752
|
||||
HTML_LOCATION = 262144
|
||||
@@ -13,8 +14,9 @@ SUBDIRS := tools uip httpd
|
||||
SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS))
|
||||
|
||||
BUILDDIR = output/
|
||||
VERSION_HEADER := version.h
|
||||
|
||||
all: create_build_dir $(SUBDIRS) $(BUILDDIR)rtlplayground.bin
|
||||
all: create_build_dir $(VERSION_HEADER) $(SUBDIRS) $(BUILDDIR)rtlplayground.bin
|
||||
|
||||
create_build_dir:
|
||||
mkdir -p $(BUILDDIR)
|
||||
@@ -26,6 +28,12 @@ OBJS += uip/$(BUILDDIR)/timer.rel uip/$(BUILDDIR)/uip-fw.rel uip/$(BUILDDIR)/uip
|
||||
html_data.c html_data.h: html tools
|
||||
tools/$(BUILDDIR)fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data
|
||||
|
||||
$(VERSION_HEADER):
|
||||
@echo "#ifndef VERSION_H" > $(VERSION_HEADER)
|
||||
@echo "#define VERSION_H" >> $(VERSION_HEADER)
|
||||
@echo "#define VERSION_SW \"v$(VERSION)-g$(shell git rev-parse --short HEAD)\"" >> $(VERSION_HEADER)
|
||||
@echo "#endif" >> $(VERSION_HEADER)
|
||||
|
||||
httpd: html_data.h
|
||||
|
||||
$(SUBDIRS):
|
||||
@@ -34,7 +42,7 @@ $(SUBDIRS):
|
||||
clean:
|
||||
-make -C uip clean
|
||||
-make -C httpd clean
|
||||
-rm html_data.c html_data.h
|
||||
-rm html_data.c html_data.h $(VERSION_HEADER)
|
||||
-rm -r $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR)crtstart.rel: crtstart.asm
|
||||
|
||||
Reference in New Issue
Block a user