Use git describe for version in generated header file.
This commit is contained in:
parent
6f5b1873d7
commit
97824b7f02
|
@ -1,3 +1,4 @@
|
|||
src/include/version.h
|
||||
blackmagic
|
||||
*.bin
|
||||
*.hex
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This scripts adds local version information from the version
|
||||
# control systems git, mercurial (hg) and subversion (svn).
|
||||
#
|
||||
# If something goes wrong, send a mail the kernel build mailinglist
|
||||
# (see MAINTAINERS) and CC Nico Schottelius
|
||||
# <nico-linuxsetlocalversion -at- schottelius.org>.
|
||||
#
|
||||
#
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [srctree]" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "${1:-.}" || usage
|
||||
|
||||
# Check for git and a git repo.
|
||||
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
|
||||
|
||||
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it,
|
||||
# because this version is defined in the top level Makefile.
|
||||
if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
|
||||
|
||||
# If we are past a tagged commit (like "v2.6.30-rc5-302-g72357d5"),
|
||||
# we pretty print it.
|
||||
if atag="`git describe 2>/dev/null`"; then
|
||||
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
||||
|
||||
# If we don't have a tag at all we print -g{commitish}.
|
||||
else
|
||||
printf '%s%s' -g $head
|
||||
fi
|
||||
fi
|
||||
|
||||
# Is this git on svn?
|
||||
if git config --get svn-remote.svn.url >/dev/null; then
|
||||
printf -- '-svn%s' "`git svn find-rev $head`"
|
||||
fi
|
||||
|
||||
# Update index only on r/w media
|
||||
[ -w . ] && git update-index --refresh --unmerged > /dev/null
|
||||
|
||||
# Check for uncommitted changes
|
||||
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
|
||||
| read dummy; then
|
||||
printf '%s' -dirty
|
||||
fi
|
||||
|
||||
# All done with git
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check for mercurial and a mercurial repo.
|
||||
if hgid=`hg id 2>/dev/null`; then
|
||||
tag=`printf '%s' "$hgid" | cut -d' ' -f2`
|
||||
|
||||
# Do we have an untagged version?
|
||||
if [ -z "$tag" -o "$tag" = tip ]; then
|
||||
id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
|
||||
printf '%s%s' -hg "$id"
|
||||
fi
|
||||
|
||||
# Are there uncommitted changes?
|
||||
# These are represented by + after the changeset id.
|
||||
case "$hgid" in
|
||||
*+|*+\ *) printf '%s' -dirty ;;
|
||||
esac
|
||||
|
||||
# All done with mercurial
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check for svn and a svn repo.
|
||||
if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
|
||||
rev=`echo $rev | awk '{print $NF}'`
|
||||
printf -- '-svn%s' "$rev"
|
||||
|
||||
# All done with svn
|
||||
exit
|
||||
fi
|
15
src/Makefile
15
src/Makefile
|
@ -7,12 +7,9 @@ MAKEFLAGS += --no-print-dir
|
|||
Q := @
|
||||
endif
|
||||
|
||||
BUILDDATE := `date +"%Y%m%d"`
|
||||
|
||||
CFLAGS += -Wall -Wextra -Wno-char-subscripts\
|
||||
-O2 -std=gnu99 -g3 -DBUILDDATE=\"$(BUILDDATE)\"\
|
||||
-O2 -std=gnu99 -g3 -MD \
|
||||
-I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR) \
|
||||
-DVERSION_SUFFIX=\"`../scripts/setlocalversion`\" -MD
|
||||
|
||||
SRC = \
|
||||
adiv5.c \
|
||||
|
@ -49,9 +46,9 @@ include $(PLATFORM_DIR)/Makefile.inc
|
|||
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
blackmagic: $(OBJ)
|
||||
blackmagic: include/version.h $(OBJ)
|
||||
@echo " LD $@"
|
||||
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
|
||||
$(Q)$(CC) -o $@ $(OBJ) $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
@echo " CC $<"
|
||||
|
@ -65,7 +62,7 @@ blackmagic: $(OBJ)
|
|||
@echo " OBJCOPY $@"
|
||||
$(Q)$(OBJCOPY) -O ihex $^ $@
|
||||
|
||||
.PHONY: clean host_clean all_platforms
|
||||
.PHONY: clean host_clean all_platforms FORCE
|
||||
|
||||
clean: host_clean
|
||||
$(Q)echo " CLEAN"
|
||||
|
@ -86,5 +83,9 @@ all_platforms:
|
|||
fi ;\
|
||||
done
|
||||
|
||||
include/version.h: FORCE
|
||||
$(Q)echo " GIT include/version.h"
|
||||
$(Q)echo "#define FIRMWARE_VERSION \"`git describe --dirty`\"" > $@
|
||||
|
||||
-include *.d
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "target.h"
|
||||
#include "morse.h"
|
||||
#include "adiv5.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef PLATFORM_HAS_TRACESWO
|
||||
# include "traceswo.h"
|
||||
|
@ -106,8 +107,8 @@ int command_process(target *t, char *cmd)
|
|||
|
||||
bool cmd_version(void)
|
||||
{
|
||||
gdb_out("Black Magic Probe (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")\n");
|
||||
gdb_out("Copyright (C) 2011 Black Sphere Technologies Ltd.\n");
|
||||
gdb_out("Black Magic Probe (Firmware " FIRMWARE_VERSION ")\n");
|
||||
gdb_out("Copyright (C) 2015 Black Sphere Technologies Ltd.\n");
|
||||
gdb_out("License GPLv3+: GNU GPL version 3 or later "
|
||||
"<http://gnu.org/licenses/gpl.html>\n\n");
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ LDFLAGS = -lopencm3_stm32f4 -Wl,--defsym,_stack=0x20006000 \
|
|||
VPATH += platforms/stm32
|
||||
|
||||
SRC += cdcacm.c \
|
||||
platform.c \
|
||||
traceswo.c \
|
||||
usbuart.c \
|
||||
serialno.c \
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
#include "gpio.h"
|
||||
#include "morse.h"
|
||||
#include "timing.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PLATFORM_HAS_TRACESWO
|
||||
#define BOARD_IDENT "Black Magic Probe (F4Discovery), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for F4Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT "Black Magic Probe (F4Discovery), (Firmware " FIRMWARE_VERSION ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for F4Discovery, (Firmware " FIRMWARE_VERSION ")"
|
||||
#define DFU_IDENT "Black Magic Firmware Upgrade (F4Discovery"
|
||||
#define DFU_IFACE_STRING "@Internal Flash /0x08000000/1*016Ka,3*016Kg,1*064Kg,7*128Kg"
|
||||
|
||||
|
|
|
@ -24,8 +24,10 @@
|
|||
#include <libopencm3/lm4f/gpio.h>
|
||||
#include <libopencm3/usb/usbd.h>
|
||||
|
||||
#define BOARD_IDENT "Black Magic Probe (Launchpad ICDI), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for Launchpad, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#include "version.h"
|
||||
|
||||
#define BOARD_IDENT "Black Magic Probe (Launchpad ICDI), (Firmware " FIRMWARE_VERSION ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for Launchpad, (Firmware " FIRMWARE_VERSION ")"
|
||||
#define DFU_IDENT "Black Magic Firmware Upgrade (Launchpad)"
|
||||
#define DFU_IFACE_STRING "lolwut"
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
#include "general.h"
|
||||
#include "gdb_if.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -157,6 +158,11 @@ void platform_init(int argc, char **argv)
|
|||
if(cable_desc[index].cbus_ddr)
|
||||
ftdi_init[8]= cable_desc[index].cbus_ddr;
|
||||
|
||||
printf("\nBlack Magic Probe (" FIRMWARE_VERSION ")\n");
|
||||
printf("Copyright (C) 2015 Black Sphere Technologies Ltd.\n");
|
||||
printf("License GPLv3+: GNU GPL version 3 or later "
|
||||
"<http://gnu.org/licenses/gpl.html>\n\n");
|
||||
|
||||
if(ftdic) {
|
||||
ftdi_usb_close(ftdic);
|
||||
ftdi_free(ftdic);
|
||||
|
|
|
@ -15,7 +15,6 @@ LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000
|
|||
VPATH += platforms/stm32
|
||||
|
||||
SRC += cdcacm.c \
|
||||
platform.c \
|
||||
traceswo.c \
|
||||
usbuart.c \
|
||||
serialno.c \
|
||||
|
|
|
@ -15,7 +15,6 @@ LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000
|
|||
VPATH += platforms/stm32
|
||||
|
||||
SRC += cdcacm.c \
|
||||
platform.c \
|
||||
usbuart.c \
|
||||
serialno.c \
|
||||
timing.c \
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "gdb_packet.h"
|
||||
#include "gpio.h"
|
||||
#include "timing.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <libopencm3/cm3/common.h>
|
||||
#include <libopencm3/stm32/f1/memorymap.h>
|
||||
|
@ -34,9 +35,9 @@
|
|||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define BOARD_IDENT "Black Magic Probe (STLINK), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for STLink/Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_UPD "Black Magic (DFU Upgrade) for STLink/Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT "Black Magic Probe (STLINK), (Firmware " FIRMWARE_VERSION ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for STLink/Discovery, (Firmware " FIRMWARE_VERSION ")"
|
||||
#define BOARD_IDENT_UPD "Black Magic (DFU Upgrade) for STLink/Discovery, (Firmware " FIRMWARE_VERSION ")"
|
||||
#define DFU_IDENT "Black Magic Firmware Upgrade (STLINK)"
|
||||
#define DFU_IFACE_STRING "@Internal Flash /0x08000000/8*001Ka,56*001Kg"
|
||||
#define UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg"
|
||||
|
|
|
@ -15,7 +15,6 @@ LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000
|
|||
VPATH += platforms/stm32
|
||||
|
||||
SRC += cdcacm.c \
|
||||
platform.c \
|
||||
usbuart.c \
|
||||
serialno.c \
|
||||
timing.c \
|
||||
|
|
|
@ -27,12 +27,13 @@
|
|||
#include "gdb_packet.h"
|
||||
#include "gpio.h"
|
||||
#include "timing.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define BOARD_IDENT "Black Magic Probe (SWLINK), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade), STM8S Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_UPD "Black Magic (DFU Upgrade), STM8S Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT "Black Magic Probe (SWLINK), (Firmware " FIRMWARE_VERSION ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade), STM8S Discovery, (Firmware " FIRMWARE_VERSION ")"
|
||||
#define BOARD_IDENT_UPD "Black Magic (DFU Upgrade), STM8S Discovery, (Firmware " FIRMWARE_VERSION ")"
|
||||
#define DFU_IDENT "Black Magic Firmware Upgrade (SWLINK)"
|
||||
#define DFU_IFACE_STRING "@Internal Flash /0x08000000/8*001Ka,56*001Kg"
|
||||
#define UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg"
|
||||
|
|
Loading…
Reference in New Issue