Commit ee1c7482 authored by Adam Wujek's avatar Adam Wujek Committed by Grzegorz Daniluk

revision: report build information via spll_stats structure

--increase spll_stats structure version to 2
--add to spll_stats structure:
  - commit_id
  - build_date
  - build_time
  - start_cnt (to be used later for start counter)
--move declaration of spll_stats structure from wrs_main.c to revision.c
--pass git version and author at compile time to revision.c
--create revision.h with build_* externs
--update version reporting at cpu start
--update version command
--include section .stats in section .data for node
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent bb790151
......@@ -84,7 +84,7 @@ OUTPUT-$(CONFIG_WR_NODE) = wrc
OUTPUT-$(CONFIG_WR_SWITCH) = rt_cpu
OUTPUT := $(OUTPUT-y)
REVISION=$(shell git describe --dirty --always)
GIT_VER = $(shell git describe --always --dirty | sed 's;^wr-switch-sw-;;')
all: tools $(OUTPUT).ram $(OUTPUT).vhd $(OUTPUT).mif
......@@ -111,7 +111,7 @@ sdb-lib/libsdbfs.a:
$(MAKE) -C sdb-lib
$(OUTPUT).elf: $(LDS-y) $(AUTOCONF) gitmodules $(OUTPUT).o config.o
$(CC) $(CFLAGS) -DGIT_REVISION=\"$(REVISION)\" -c revision.c
$(CC) $(CFLAGS) -D__GIT_VER__="\"$(GIT_VER)\"" -c revision.c
${CC} -o $@ revision.o config.o $(OUTPUT).o $(LDFLAGS)
${OBJDUMP} -d $(OUTPUT).elf > $(OUTPUT)_disasm.S
$(SIZE) $@
......
......@@ -49,6 +49,7 @@ SECTIONS
.data : {
*(.data .data.*)
*(.stats)
} > ram
.bss : {
......
#ifndef __REVISION_H__
#define __REVISION_H__
extern const char *build_revision;
extern const char *build_date;
extern const char *build_time;
#endif /* __REVISION_H__ */
#include "softpll_ng.h"
#include "revision.h"
const char *build_revision = stats.commit_id;
const char *build_revision = GIT_REVISION;
const char *build_date = stats.build_date;
const char *build_time = stats.build_time;
/*
* We export softpll internal status to the ARM cpu, for SNMP. Thus,
* we place this structure at a known address in the linker script
*/
struct spll_stats stats __attribute__((section(".stats"))) = {
.magic = 0x5b1157a7,
.ver = SPLL_STATS_VER,
#ifdef CONFIG_DETERMINISTIC_BINARY
const char *build_date = "";
.build_date = "",
#else
const char *build_date = "Built on " __DATE__ ", " __TIME__ "\n";
.build_date = __DATE__,
.build_time = __TIME__,
#endif
.commit_id = __GIT_VER__,
};
#include <wrc.h>
#include "shell.h"
#include "syscon.h"
extern const char *build_revision, *build_date;
#include "revision.h"
#ifdef CONFIG_DEVELOPER
#define SUPPORT " (unsupported developer build)"
......@@ -16,7 +14,7 @@ static int cmd_ver(const char *args[])
int hwram = sysc_get_memsize();
pp_printf("WR Core build: %s%s\n", build_revision, SUPPORT);
pp_printf("%s", build_date); /* may be empty, or complete with \n */
pp_printf("Built: %s %s\n", build_date, build_time); /* may be empty */
pp_printf("Built for %d kB RAM, stack is %d bytes\n",
CONFIG_RAMSIZE / 1024, CONFIG_STACKSIZE);
/* hardware reports memory size, with a 16kB granularity */
......
......@@ -129,7 +129,10 @@ int spll_get_dac(int out_channel);
void check_vco_frequencies();
#define SPLL_STATS_VER 2
/* info reported through .stat section */
/* due to endiannes problem strings has to be 4 bytes alligned */
struct spll_stats {
int magic; /* 0x5b1157a7 = SPLLSTAT ?;)*/
int ver; /* version of the structure */
......@@ -142,6 +145,10 @@ struct spll_stats {
int M_lock;
int H_y, M_y;
int del_cnt;
int start_cnt;
char commit_id[32];
char build_date[16];
char build_time[16];
};
/* This only exists in wr-switch, but we should use it always */
......
#include <wrc.h>
#include "uart.h"
#include "softpll_ng.h"
#include "minipc.h"
#include "revision.h"
const char *build_revision;
const char *build_date;
int scb_ver = 33; //SCB version.
/*
* We export softpll internal status to the ARM cpu, for SNMP. Thus,
* we place this structure at a known address in the linker script
*/
struct spll_stats stats __attribute__((section(".stats"))) = {
.magic = 0x5b1157a7,
.ver = 1,
};
int main(void)
{
uint32_t start_tics = timer_get_tics();
......@@ -27,7 +15,8 @@ int main(void)
TRACE("");
TRACE("WR Switch Real Time Subsystem (c) CERN 2011 - 2014\n");
TRACE("Revision: %s, built %s.\n", build_revision, build_date);
TRACE("Revision: %s, built: %s %s.\n",
build_revision, build_date, build_time);
TRACE("SCB version: %d. %s\n", scb_ver,(scb_ver>=34)?"10 MHz SMC Output.":"" );
TRACE("--");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment