mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Merge pull request #42 from vDorst/cmd_version
Added software version + git short hash string to firmware.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
output/
|
output/
|
||||||
html_data.c
|
html_data.c
|
||||||
html_data.h
|
html_data.h
|
||||||
|
version.h
|
||||||
tools/httpd_sim
|
tools/httpd_sim
|
||||||
tools/injector
|
tools/injector
|
||||||
tools/fileadder
|
tools/fileadder
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
BOOTLOADER_ADDRESS=0x100
|
BOOTLOADER_ADDRESS=0x100
|
||||||
|
|
||||||
|
VERSION=0.1.0
|
||||||
IMAGESIZE = 524288
|
IMAGESIZE = 524288
|
||||||
CONFIG_LOCATION = 458752
|
CONFIG_LOCATION = 458752
|
||||||
HTML_LOCATION = 262144
|
HTML_LOCATION = 262144
|
||||||
@@ -13,8 +14,9 @@ SUBDIRS := tools uip httpd
|
|||||||
SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS))
|
SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS))
|
||||||
|
|
||||||
BUILDDIR = output/
|
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:
|
create_build_dir:
|
||||||
mkdir -p $(BUILDDIR)
|
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
|
html_data.c html_data.h: html tools
|
||||||
tools/$(BUILDDIR)fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data
|
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
|
httpd: html_data.h
|
||||||
|
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
@@ -34,7 +42,7 @@ $(SUBDIRS):
|
|||||||
clean:
|
clean:
|
||||||
-make -C uip clean
|
-make -C uip clean
|
||||||
-make -C httpd clean
|
-make -C httpd clean
|
||||||
-rm html_data.c html_data.h
|
-rm html_data.c html_data.h $(VERSION_HEADER)
|
||||||
-rm -r $(BUILDDIR)
|
-rm -r $(BUILDDIR)
|
||||||
|
|
||||||
$(BUILDDIR)crtstart.rel: crtstart.asm
|
$(BUILDDIR)crtstart.rel: crtstart.asm
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "rtl837x_sfr.h"
|
#include "rtl837x_sfr.h"
|
||||||
#include "rtl837x_stp.h"
|
#include "rtl837x_stp.h"
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#pragma codeseg BANK1
|
#pragma codeseg BANK1
|
||||||
#pragma constseg BANK1
|
#pragma constseg BANK1
|
||||||
@@ -490,6 +491,13 @@ void print_gpio_status(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show software version
|
||||||
|
void print_sw_version(void) __banked {
|
||||||
|
print_string("Software version: ");
|
||||||
|
print_string(VERSION_SW);
|
||||||
|
write_char('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Identify command
|
// Identify command
|
||||||
void cmd_parser(void) __banked
|
void cmd_parser(void) __banked
|
||||||
@@ -695,6 +703,9 @@ void cmd_parser(void) __banked
|
|||||||
port_eee_status_all();
|
port_eee_status_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cmd_compare(0, "version")) {
|
||||||
|
print_sw_version();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ extern __xdata uint8_t cmd_available;
|
|||||||
uint8_t cmd_tokenize(void) __banked;
|
uint8_t cmd_tokenize(void) __banked;
|
||||||
void cmd_parser(void) __banked;
|
void cmd_parser(void) __banked;
|
||||||
void execute_config(void) __banked;
|
void execute_config(void) __banked;
|
||||||
|
void print_sw_version(void) __banked;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+4
-2
@@ -8,6 +8,7 @@
|
|||||||
#include "../html_data.h"
|
#include "../html_data.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "../phy.h"
|
#include "../phy.h"
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
#pragma codeseg BANK1
|
#pragma codeseg BANK1
|
||||||
#pragma constseg BANK1
|
#pragma constseg BANK1
|
||||||
@@ -169,8 +170,9 @@ void send_basic_info(void)
|
|||||||
byte_to_html(uip_ethaddr.addr[3]); char_to_html(':');
|
byte_to_html(uip_ethaddr.addr[3]); char_to_html(':');
|
||||||
byte_to_html(uip_ethaddr.addr[4]); char_to_html(':');
|
byte_to_html(uip_ethaddr.addr[4]); char_to_html(':');
|
||||||
byte_to_html(uip_ethaddr.addr[5]);
|
byte_to_html(uip_ethaddr.addr[5]);
|
||||||
slen += strtox(outbuf + slen, "\",\"sw_ver\":\"v0.1-ge4c48586\",\"hw_ver\":\"SWGT024-V2.0\"}");
|
slen += strtox(outbuf + slen, "\",\"sw_ver\":\"");
|
||||||
// slen += strtox(outbuf + slen, "\"}");
|
slen += strtox(outbuf + slen, VERSION_SW);
|
||||||
|
slen += strtox(outbuf + slen, "\",\"hw_ver\":\"SWGT024-V2.0\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1707,6 +1707,9 @@ void bootloader(void)
|
|||||||
print_string("RTL8372\n");
|
print_string("RTL8372\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print SW version
|
||||||
|
print_sw_version();
|
||||||
|
|
||||||
print_string("\nStarting up...\n");
|
print_string("\nStarting up...\n");
|
||||||
print_string(" Flash controller\n");
|
print_string(" Flash controller\n");
|
||||||
flash_init(0);
|
flash_init(0);
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@
|
|||||||
#include "httpd_sim.h"
|
#include "httpd_sim.h"
|
||||||
#include <json.h>
|
#include <json.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
#define PORTS 6
|
#define PORTS 6
|
||||||
time_t last_called;
|
time_t last_called;
|
||||||
@@ -71,7 +72,7 @@ void send_basic_info(int socket)
|
|||||||
{
|
{
|
||||||
char *response = "HTTP/1.1 200 OK\r\n"
|
char *response = "HTTP/1.1 200 OK\r\n"
|
||||||
"Content-Type: application/json; charset=UTF-8\r\n\r\n"
|
"Content-Type: application/json; charset=UTF-8\r\n\r\n"
|
||||||
"{\"ip_address\":\"192.168.10.247\",\"ip_gateway\":\"192.168.2.22\",\"ip_netmask\":\"255.255.255.0\",\"mac_address\":\"1c:2a:a3:23:00:02\",\"sw_ver\":\"v0.1-ge4c48586\",\"hw_ver\":\"SWGT024-V2.0\"}";
|
"{\"ip_address\":\"192.168.10.247\",\"ip_gateway\":\"192.168.2.22\",\"ip_netmask\":\"255.255.255.0\",\"mac_address\":\"1c:2a:a3:23:00:02\",\"sw_ver\":\"" VERSION_SW "\",\"hw_ver\":\"SWGT024-V2.0\"}";
|
||||||
write(socket, response, strlen(response));
|
write(socket, response, strlen(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user