tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26910 ) Change subject: icE1usb fw: Add support for the ICE1USB_DEV_GET_FW_BUILD control request ...................................................................... icE1usb fw: Add support for the ICE1USB_DEV_GET_FW_BUILD control request This was already defined but not implemented Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: Id65734153c92ef87bc9ecf967447e9bf11804f24 --- M firmware/ice40-riscv/icE1usb/Makefile M firmware/ice40-riscv/icE1usb/fw_app.c M firmware/ice40-riscv/icE1usb/usb_dev.c M firmware/ice40-riscv/icE1usb/usb_dev.h 4 files changed, 13 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/10/26910/1 diff --git a/firmware/ice40-riscv/icE1usb/Makefile b/firmware/ice40-riscv/icE1usb/Makefile index 1240a9f..36fd921 100644 --- a/firmware/ice40-riscv/icE1usb/Makefile +++ b/firmware/ice40-riscv/icE1usb/Makefile @@ -10,11 +10,12 @@ DFU_UTIL = dfu-util TAG_PREFIX = icE1usb-fw -GITVER = $(shell git describe --match '$(TAG_PREFIX)*') +GITVER = $(shell git describe --match '$(TAG_PREFIX)*' --dirty) TARGET = $(GITVER) BOARD_DEFINE=BOARD_$(shell echo $(BOARD) | tr a-z\- A-Z_) CFLAGS=-Wall -Wextra -Wno-unused-parameter -Os -march=rv32i -mabi=ilp32 -ffreestanding -flto -nostartfiles -fomit-frame-pointer -Wl,--gc-section --specs=nano.specs -D$(BOARD_DEFINE) -I. -I../common +CFLAGS += -DBUILD_INFO="\"$(GITVER) built $(shell date) on $(shell hostname)\"" NO2USB_FW_VERSION=0 include ../../../gateware/cores/no2usb/fw/fw.mk diff --git a/firmware/ice40-riscv/icE1usb/fw_app.c b/firmware/ice40-riscv/icE1usb/fw_app.c index 41ef3ab..880d2d6 100644 --- a/firmware/ice40-riscv/icE1usb/fw_app.c +++ b/firmware/ice40-riscv/icE1usb/fw_app.c @@ -69,7 +69,7 @@ /* Init console IO */ console_init(); - puts("Booting App image..\n"); + printf("\n\nBooting %s\n", fw_build_str); /* LED */ led_init(); diff --git a/firmware/ice40-riscv/icE1usb/usb_dev.c b/firmware/ice40-riscv/icE1usb/usb_dev.c index 1187047..e19d9a0 100644 --- a/firmware/ice40-riscv/icE1usb/usb_dev.c +++ b/firmware/ice40-riscv/icE1usb/usb_dev.c @@ -6,6 +6,7 @@ */ #include <stdint.h> +#include <string.h> #include <no2usb/usb.h> #include <no2usb/usb_proto.h> @@ -16,6 +17,9 @@ #include "ice1usb_proto.h" +const char *fw_build_str = BUILD_INFO; + + static enum usb_fnd_resp _usb_dev_ctrl_req(struct usb_ctrl_req *req, struct usb_xfer *xfer) { @@ -29,6 +33,10 @@ xfer->data[0] = (1 << ICE1USB_DEV_CAP_GPSDO); xfer->len = 1; break; + case ICE1USB_DEV_GET_FW_BUILD: + xfer->data = (void*) fw_build_str; + xfer->len = strlen(fw_build_str); + break; default: return USB_FND_ERROR; } diff --git a/firmware/ice40-riscv/icE1usb/usb_dev.h b/firmware/ice40-riscv/icE1usb/usb_dev.h index ca32a46..b2c4855 100644 --- a/firmware/ice40-riscv/icE1usb/usb_dev.h +++ b/firmware/ice40-riscv/icE1usb/usb_dev.h @@ -7,4 +7,6 @@ #pragma once +extern const char *fw_build_str; + void usb_dev_init(void); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26910 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Id65734153c92ef87bc9ecf967447e9bf11804f24 Gerrit-Change-Number: 26910 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt@246tNt.com> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-MessageType: newchange