diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fe0068..c7eda7a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,7 @@ - - variables: -# PRODUCT_NAME: "AG" -# PRODUCT_VARIANT: "NA" -# PRODUCT_VARIANT: "EU" -# PRODUCT_VARIANT: "CN" -# PROJECT_VERSION: "10" -# SW_MAJOR: "1" -# SW_MINOR: "3" + SW_KERNEL: "0" + SW_MAJOR: "0" + SW_MINOR: "0" before_script: @@ -18,7 +12,7 @@ stages: - check - build # - test -# - deploy + - deploy build_job: script: @@ -32,10 +26,11 @@ check_job: - "make check BOARD=stm32f4-discovery" stage: check -#deploy_job: -# script: -# - "make deploy BOARD=stm32f4-discovery" -# stage: deploy +deploy_job: + script: + - "source/scripts/release_number.py" + - "make deploy BOARD=stm32f4-discovery" + stage: deploy #test_job: # script: diff --git a/Makefile b/Makefile index eb9b4bb..415207d 100755 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ include config/make/rules.mk OS_NAME = kosmos MAINFILE = $(EXE_DIR)/lib$(OS_NAME)-$(ARCH)-$(BOARD)$(DBG_EXT)$(LIB_EXT) +DEPLOY_PACKET = lib$(OS_NAME)-$(ARCH)-$(BOARD)-$()$(DBG_EXT).tar.gz INCLUDES += $(SRC_DIR) @@ -29,6 +30,9 @@ ASMSOURCES += $(foreach folder, $(SUB_FOLDER), $(wildcard $(ROOT_DIR)/$(folder)/ all: check $(MAINFILE) deploy: all + echo $(SW_KERNEL) + echo $(SW_MAJOR) + echo $(SW_MINOR) @$(MKDIR) $(EXE_DIR)/include $(SRC_DIR)/scripts/board_interface.py -b "$(SRC_DIR)/firmware/arch/$(CPU)/board/$(BOARD)/include/$(BOARD).h" -o "$(EXE_DIR)/include/board_devices.h" $(SRC_DIR)/scripts/stack_interface.py -i "$(SRC_DIR)/firmware/arch/$(CPU)/include/$(CPU)_stack.h" -o "$(EXE_DIR)/include/stack.h" diff --git a/source/firmware/firmware_version.h b/source/firmware/firmware_version.h deleted file mode 100644 index 2f735a8..0000000 --- a/source/firmware/firmware_version.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * firmware_version.h - * - * Created on: Oct 20, 2015 - * Author: tkl - */ - -#ifndef FIRMWARE_VERSION_H_ -#define FIRMWARE_VERSION_H_ - -#define kernel_version 0 -#define major_number 0 -#define minor_number 0 - -#endif /* FIRMWARE_VERSION_H_ */ diff --git a/source/firmware/version.h b/source/firmware/version.h new file mode 100644 index 0000000..003a627 --- /dev/null +++ b/source/firmware/version.h @@ -0,0 +1,10 @@ +/* Release number include file */ + +#ifndef VERSION_H +#define VERSION_H + +#define KERNEL_VERSION "unknown" +#define MAJOR_VERSION "unknown" +#define MINOR_VERSION "unknown" + +#endif /* VERSION_H */ diff --git a/source/scripts/deploy_container.py b/source/scripts/deploy_container.py new file mode 100755 index 0000000..77a2630 --- /dev/null +++ b/source/scripts/deploy_container.py @@ -0,0 +1,43 @@ +#!/usr/bin/python2 +from sys import argv, exit +from getopt import getopt +from re import match, sub +import os + +def get_current_numbers(): + config = {} + if os.environ.has_key("SW_KERNEL"): + config["sw_kernel"] = os.environ["SW_KERNEL"] + if os.environ.has_key("SW_MAJOR"): + config["sw_major"] = os.environ["SW_MAJOR"] + if os.environ.has_key("SW_MINOR"): + config["sw_minor"] = os.environ["SW_MINOR"] + return config + +def generate_include(numbers): + f = open("../firmware/version.h", "w") + f.write("/* Release number include file */\n\n") + f.write("#ifndef VERSION_H\n") + f.write("#define VERSION_H\n\n") + if numbers.has_key("sw_kernel"): + f.write("#define KERNEL_VERSION\t\"" + numbers["sw_kernel"] + "\"\n") + else: + f.write("#define KERNEL_VERSION\t\"unknown\"\n") + if numbers.has_key("sw_major"): + f.write("#define MAJOR_VERSION\t\"" + numbers["sw_major"] + "\"\n") + else: + f.write("#define MAJOR_VERSION\t\"unknown\"\n") + if numbers.has_key("sw_minor"): + f.write("#define MINOR_VERSION\t\"" + numbers["sw_minor"] + "\"\n") + else: + f.write("#define MINOR_VERSION\t\"unknown\"\n") + f.write("\n#endif /* VERSION_H */\n") + f.close() + +def main(argv): + numbers = get_current_numbers() + generate_include(numbers) + +if __name__ == "__main__": + main(argv[1:]) + diff --git a/source/scripts/release_number.py b/source/scripts/release_number.py new file mode 100755 index 0000000..77a2630 --- /dev/null +++ b/source/scripts/release_number.py @@ -0,0 +1,43 @@ +#!/usr/bin/python2 +from sys import argv, exit +from getopt import getopt +from re import match, sub +import os + +def get_current_numbers(): + config = {} + if os.environ.has_key("SW_KERNEL"): + config["sw_kernel"] = os.environ["SW_KERNEL"] + if os.environ.has_key("SW_MAJOR"): + config["sw_major"] = os.environ["SW_MAJOR"] + if os.environ.has_key("SW_MINOR"): + config["sw_minor"] = os.environ["SW_MINOR"] + return config + +def generate_include(numbers): + f = open("../firmware/version.h", "w") + f.write("/* Release number include file */\n\n") + f.write("#ifndef VERSION_H\n") + f.write("#define VERSION_H\n\n") + if numbers.has_key("sw_kernel"): + f.write("#define KERNEL_VERSION\t\"" + numbers["sw_kernel"] + "\"\n") + else: + f.write("#define KERNEL_VERSION\t\"unknown\"\n") + if numbers.has_key("sw_major"): + f.write("#define MAJOR_VERSION\t\"" + numbers["sw_major"] + "\"\n") + else: + f.write("#define MAJOR_VERSION\t\"unknown\"\n") + if numbers.has_key("sw_minor"): + f.write("#define MINOR_VERSION\t\"" + numbers["sw_minor"] + "\"\n") + else: + f.write("#define MINOR_VERSION\t\"unknown\"\n") + f.write("\n#endif /* VERSION_H */\n") + f.close() + +def main(argv): + numbers = get_current_numbers() + generate_include(numbers) + +if __name__ == "__main__": + main(argv[1:]) +