Commit 592dd7cb authored by danh-arm's avatar danh-arm
Browse files

Merge pull request #176 from danh-arm/jc/tf-issues/203-v3

Add support for printing version at runtime v3
parents 2d4aceaf aaa3e722
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
# #
#
# Trusted Firmware Version
#
VERSION_MAJOR := 0
VERSION_MINOR := 4
# #
# Default values for build configurations # Default values for build configurations
# #
...@@ -76,6 +82,13 @@ else ...@@ -76,6 +82,13 @@ else
BUILD_TYPE := release BUILD_TYPE := release
endif endif
# Default build string (git branch and commit)
ifeq (${BUILD_STRING},)
BUILD_STRING := $(shell git log -n 1 --pretty=format:"%h")
endif
VERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING}
BL_COMMON_SOURCES := common/bl_common.c \ BL_COMMON_SOURCES := common/bl_common.c \
common/debug.c \ common/debug.c \
common/tf_printf.c \ common/tf_printf.c \
...@@ -377,7 +390,8 @@ $(BUILD_DIR) : ...@@ -377,7 +390,8 @@ $(BUILD_DIR) :
$(ELF) : $(OBJS) $(LINKERFILE) $(ELF) : $(OBJS) $(LINKERFILE)
@echo " LD $$@" @echo " LD $$@"
@echo 'const char build_message[] = "Built : "__TIME__", "__DATE__;' | \ @echo 'const char build_message[] = "Built : "__TIME__", "__DATE__; \
const char version_string[] = "${VERSION_STRING}";' | \
$$(CC) $$(CFLAGS) -xc - -o $(BUILD_DIR)/build_message.o $$(CC) $$(CFLAGS) -xc - -o $(BUILD_DIR)/build_message.o
$$(Q)$$(LD) -o $$@ $$(LDFLAGS) -Map=$(MAPFILE) --script $(LINKERFILE) \ $$(Q)$$(LD) -o $$@ $$(LDFLAGS) -Map=$(MAPFILE) --script $(LINKERFILE) \
$(BUILD_DIR)/build_message.o $(OBJS) $(BUILD_DIR)/build_message.o $(OBJS)
......
...@@ -130,7 +130,8 @@ void bl1_main(void) ...@@ -130,7 +130,8 @@ void bl1_main(void)
/* Announce our arrival */ /* Announce our arrival */
tf_printf(FIRMWARE_WELCOME_STR); tf_printf(FIRMWARE_WELCOME_STR);
tf_printf("%s\n\r", build_message); tf_printf("%s\n", version_string);
tf_printf("%s\n", build_message);
SET_PARAM_HEAD(&bl2_image_info, PARAM_IMAGE_BINARY, VERSION_1, 0); SET_PARAM_HEAD(&bl2_image_info, PARAM_IMAGE_BINARY, VERSION_1, 0);
SET_PARAM_HEAD(&bl2_ep, PARAM_EP, VERSION_1, 0); SET_PARAM_HEAD(&bl2_ep, PARAM_EP, VERSION_1, 0);
......
...@@ -195,7 +195,8 @@ void bl2_main(void) ...@@ -195,7 +195,8 @@ void bl2_main(void)
/* Perform platform setup in BL2 */ /* Perform platform setup in BL2 */
bl2_platform_setup(); bl2_platform_setup();
tf_printf("BL2 %s\n\r", build_message); tf_printf("BL2 %s\n", version_string);
tf_printf("BL2 %s\n", build_message);
/* /*
* Load the subsequent bootloader images * Load the subsequent bootloader images
......
...@@ -77,7 +77,8 @@ void bl31_main(void) ...@@ -77,7 +77,8 @@ void bl31_main(void)
/* Perform platform setup in BL1 */ /* Perform platform setup in BL1 */
bl31_platform_setup(); bl31_platform_setup();
tf_printf("BL31 %s\n\r", build_message); tf_printf("BL31 %s\n", version_string);
tf_printf("BL31 %s\n", build_message);
/* Initialise helper libraries */ /* Initialise helper libraries */
bl31_lib_init(); bl31_lib_init();
......
...@@ -120,7 +120,8 @@ uint64_t tsp_main(void) ...@@ -120,7 +120,8 @@ uint64_t tsp_main(void)
tsp_stats[linear_id].cpu_on_count++; tsp_stats[linear_id].cpu_on_count++;
spin_lock(&console_lock); spin_lock(&console_lock);
tf_printf("TSP %s\n\r", build_message); tf_printf("TSP %s\n", version_string);
tf_printf("TSP %s\n", build_message);
INFO("Total memory base : 0x%x\n", (unsigned long)BL32_TOTAL_BASE); INFO("Total memory base : 0x%x\n", (unsigned long)BL32_TOTAL_BASE);
INFO("Total memory size : 0x%x bytes\n", INFO("Total memory size : 0x%x bytes\n",
(unsigned long)(BL32_TOTAL_LIMIT - BL32_TOTAL_BASE)); (unsigned long)(BL32_TOTAL_LIMIT - BL32_TOTAL_BASE));
......
...@@ -210,6 +210,7 @@ int load_image(meminfo_t *mem_layout, ...@@ -210,6 +210,7 @@ int load_image(meminfo_t *mem_layout,
image_info_t *image_data, image_info_t *image_data,
entry_point_info_t *entry_point_info); entry_point_info_t *entry_point_info);
extern const char build_message[]; extern const char build_message[];
extern const char version_string[];
void reserve_mem(uint64_t *free_base, size_t *free_size, void reserve_mem(uint64_t *free_base, size_t *free_size,
uint64_t addr, size_t size); uint64_t addr, size_t size);
......
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