diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fe0068..80ffa55 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +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: "1" before_script: - "echo $CI_BUILD_ID" @@ -18,7 +11,7 @@ stages: - check - build # - test -# - deploy + - deploy build_job: script: @@ -32,39 +25,14 @@ check_job: - "make check BOARD=stm32f4-discovery" stage: check -#deploy_job: -# script: -# - "make deploy BOARD=stm32f4-discovery" -# stage: deploy - -#test_job: -# script: -# - "make install APP=test BOARD=stm32f4-discovery" -# stage: test - -#int_release_job: -# script: -# - "cd top_agricola/core" -# - "./generate_ci_makefile.py" -# - "make -f Makefile_ci.gen all" -# - "cd ci" -# - "./deploy_release.py -t rc" -# stage: deploy -# only: -# - /^release/.*$/ -# except: -# - tags - -#ext_release_job: -# script: -# - "cd top_agricola/core" -# - "./generate_ci_makefile.py" -# - "make -f Makefile_ci.gen all" -# - "cd ci" -# - "./deploy_release.py -t r" -# stage: deploy -# only: -# - /^release/174_AG.*$/ -# except: -# - branches +deploy_job: + stage: deploy + script: + - "source/scripts/release_number.py" + - "make deploy BOARD=stm32f4-discovery" + artifacts: + paths: + - ./*.xz + only: + - tags diff --git a/Makefile b/Makefile index eb9b4bb..d874baa 100755 --- a/Makefile +++ b/Makefile @@ -1,12 +1,16 @@ -############################################################## -# -############################################################## - include config/make/rules.mk OS_NAME = kosmos -MAINFILE = $(EXE_DIR)/lib$(OS_NAME)-$(ARCH)-$(BOARD)$(DBG_EXT)$(LIB_EXT) +# version numbering deployed by ci deploy script - no necessary for local build +ifdef SW_KERNEL +VERSION := -$(SW_KERNEL).$(SW_MAJOR).$(SW_MINOR) +else +VERSION := +endif + +MAINFILE = $(EXE_DIR)/lib$(OS_NAME)-$(ARCH)-$(BOARD)$(VERSION)$(DBG_EXT)$(LIB_EXT) +DEPLOY_PACKET = lib$(OS_NAME)-$(ARCH)-$(BOARD)$(VERSION)$(DBG_EXT).tar.xz INCLUDES += $(SRC_DIR) @@ -33,10 +37,9 @@ deploy: all $(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" cp $(SRC_DIR)/firmware/kernel/interface/*.* $(EXE_DIR)/include/ + tar cvJf $(DEPLOY_PACKET) -C $(EXE_DIR) . check: - echo $(CHECK_FOLDER) - echo $(CHECKSOURCES) $(CPPCHECK) $(CPPCHECK_FLAGS) $(CHECKSOURCES) 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..44c235d --- /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("source/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:]) +