mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-07-07 13:39:00 +00:00
include: Add separate header for OpenSBI version
Currently, the OpenSBI version is in top-level Makefile so firmware linking to OpenSBI static library have no-way to know OpenSBI version. This patch moves OpenSBI version from top-level Makefile to sbi/sbi_version.h header which provides OPENSBI_VERSION_MAJOR and OPENSBI_VERSION_MINOR defines. NOTE: the SBI spec (or SBI ecall interface) version is different. The SBI spec version is provided by functions sbi_ecall_version_major() and sbi_ecall_version_minor(). Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
parent
fba7e7c3ea
commit
bd98d77298
3 changed files with 24 additions and 9 deletions
14
Makefile
14
Makefile
|
@ -7,10 +7,6 @@
|
||||||
# Anup Patel <anup.patel@wdc.com>
|
# Anup Patel <anup.patel@wdc.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# Current Version
|
|
||||||
MAJOR = 0
|
|
||||||
MINOR = 1
|
|
||||||
|
|
||||||
# Select Make Options:
|
# Select Make Options:
|
||||||
# o Do not use make's built-in rules and variables
|
# o Do not use make's built-in rules and variables
|
||||||
# o Do not print "Entering directory ...";
|
# o Do not print "Entering directory ...";
|
||||||
|
@ -54,6 +50,10 @@ export include_dir=$(CURDIR)/include
|
||||||
export lib_dir=$(CURDIR)/lib
|
export lib_dir=$(CURDIR)/lib
|
||||||
export firmware_dir=$(CURDIR)/firmware
|
export firmware_dir=$(CURDIR)/firmware
|
||||||
|
|
||||||
|
# Find library version
|
||||||
|
OPENSBI_VERSION_MAJOR=`grep MAJOR $(include_dir)/sbi/sbi_version.h | awk '{ print $$3 }'`
|
||||||
|
OPENSBI_VERSION_MINOR=`grep MINOR $(include_dir)/sbi/sbi_version.h | awk '{ print $$3 }'`
|
||||||
|
|
||||||
# Setup list of objects.mk files
|
# Setup list of objects.mk files
|
||||||
ifdef PLATFORM
|
ifdef PLATFORM
|
||||||
platform-object-mks=$(shell if [ -d $(platform_dir) ]; then find $(platform_dir) -iname "objects.mk" | sort -r; fi)
|
platform-object-mks=$(shell if [ -d $(platform_dir) ]; then find $(platform_dir) -iname "objects.mk" | sort -r; fi)
|
||||||
|
@ -92,9 +92,7 @@ deps-y+=$(platform-common-objs-path-y:.o=.dep)
|
||||||
deps-y+=$(lib-objs-path-y:.o=.dep)
|
deps-y+=$(lib-objs-path-y:.o=.dep)
|
||||||
deps-y+=$(firmware-objs-path-y:.o=.dep)
|
deps-y+=$(firmware-objs-path-y:.o=.dep)
|
||||||
|
|
||||||
GENFLAGS = -DOPENSBI_MAJOR=$(MAJOR)
|
GENFLAGS = -I$(platform_dir)/include
|
||||||
GENFLAGS += -DOPENSBI_MINOR=$(MINOR)
|
|
||||||
GENFLAGS += -I$(platform_dir)/include
|
|
||||||
GENFLAGS += -I$(platform_common_dir)/include
|
GENFLAGS += -I$(platform_common_dir)/include
|
||||||
GENFLAGS += -I$(include_dir)
|
GENFLAGS += -I$(include_dir)
|
||||||
GENFLAGS += $(platform-common-genflags-y)
|
GENFLAGS += $(platform-common-genflags-y)
|
||||||
|
@ -274,7 +272,7 @@ $(build_dir)/docs/latex/refman.tex: $(build_dir)/docs/doxygen.cfg
|
||||||
$(CMD_PREFIX)doxygen $(build_dir)/docs/doxygen.cfg
|
$(CMD_PREFIX)doxygen $(build_dir)/docs/doxygen.cfg
|
||||||
$(build_dir)/docs/doxygen.cfg: $(src_dir)/docs/doxygen.cfg
|
$(build_dir)/docs/doxygen.cfg: $(src_dir)/docs/doxygen.cfg
|
||||||
$(CMD_PREFIX)mkdir -p $(build_dir)/docs
|
$(CMD_PREFIX)mkdir -p $(build_dir)/docs
|
||||||
$(CMD_PREFIX)cat docs/doxygen.cfg | sed -e "s#@@SRC_DIR@@#$(src_dir)#" -e "s#@@BUILD_DIR@@#$(build_dir)#" -e "s#@@OPENSBI_MAJOR@@#$(MAJOR)#" -e "s#@@OPENSBI_MINOR@@#$(MINOR)#" > $(build_dir)/docs/doxygen.cfg
|
$(CMD_PREFIX)cat docs/doxygen.cfg | sed -e "s#@@SRC_DIR@@#$(src_dir)#" -e "s#@@BUILD_DIR@@#$(build_dir)#" -e "s#@@OPENSBI_MAJOR@@#$(OPENSBI_VERSION_MAJOR)#" -e "s#@@OPENSBI_MINOR@@#$(OPENSBI_VERSION_MINOR)#" > $(build_dir)/docs/doxygen.cfg
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs: $(build_dir)/docs/latex/refman.pdf
|
docs: $(build_dir)/docs/latex/refman.pdf
|
||||||
|
|
||||||
|
|
16
include/sbi/sbi_version.h
Normal file
16
include/sbi/sbi_version.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Western Digital Corporation or its affiliates.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Anup Patel <anup.patel@wdc.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SBI_VERSION_H__
|
||||||
|
#define __SBI_VERSION_H__
|
||||||
|
|
||||||
|
#define OPENSBI_VERSION_MAJOR 0
|
||||||
|
#define OPENSBI_VERSION_MINOR 1
|
||||||
|
|
||||||
|
#endif
|
|
@ -16,6 +16,7 @@
|
||||||
#include <sbi/sbi_platform.h>
|
#include <sbi/sbi_platform.h>
|
||||||
#include <sbi/sbi_system.h>
|
#include <sbi/sbi_system.h>
|
||||||
#include <sbi/sbi_timer.h>
|
#include <sbi/sbi_timer.h>
|
||||||
|
#include <sbi/sbi_version.h>
|
||||||
|
|
||||||
#define BANNER \
|
#define BANNER \
|
||||||
" ____ _____ ____ _____\n" \
|
" ____ _____ ____ _____\n" \
|
||||||
|
@ -63,7 +64,7 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
||||||
|
|
||||||
misa_string(str, sizeof(str));
|
misa_string(str, sizeof(str));
|
||||||
sbi_printf("\nOpenSBI v%d.%d (%s %s)\n",
|
sbi_printf("\nOpenSBI v%d.%d (%s %s)\n",
|
||||||
OPENSBI_MAJOR, OPENSBI_MINOR,
|
OPENSBI_VERSION_MAJOR, OPENSBI_VERSION_MINOR,
|
||||||
__DATE__, __TIME__);
|
__DATE__, __TIME__);
|
||||||
|
|
||||||
sbi_printf(BANNER);
|
sbi_printf(BANNER);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue