Merge branch 'feature/version_numbering' into 'master'

Feature/version numbering



See merge request !1
This commit is contained in:
tkl 2016-08-01 14:02:36 +00:00
commit a6ba2f7429
6 changed files with 120 additions and 68 deletions

View File

@ -1,14 +1,7 @@
variables: variables:
# PRODUCT_NAME: "AG" SW_KERNEL: "0"
# PRODUCT_VARIANT: "NA" SW_MAJOR: "0"
# PRODUCT_VARIANT: "EU" SW_MINOR: "1"
# PRODUCT_VARIANT: "CN"
# PROJECT_VERSION: "10"
# SW_MAJOR: "1"
# SW_MINOR: "3"
before_script: before_script:
- "echo $CI_BUILD_ID" - "echo $CI_BUILD_ID"
@ -18,7 +11,7 @@ stages:
- check - check
- build - build
# - test # - test
# - deploy - deploy
build_job: build_job:
script: script:
@ -32,39 +25,14 @@ check_job:
- "make check BOARD=stm32f4-discovery" - "make check BOARD=stm32f4-discovery"
stage: check stage: check
#deploy_job: deploy_job:
# script: stage: deploy
# - "make deploy BOARD=stm32f4-discovery" script:
# stage: deploy - "source/scripts/release_number.py"
- "make deploy BOARD=stm32f4-discovery"
#test_job: artifacts:
# script: paths:
# - "make install APP=test BOARD=stm32f4-discovery" - ./*.xz
# stage: test only:
- tags
#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

View File

@ -1,12 +1,16 @@
##############################################################
#
##############################################################
include config/make/rules.mk include config/make/rules.mk
OS_NAME = kosmos 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) 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/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" $(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/ cp $(SRC_DIR)/firmware/kernel/interface/*.* $(EXE_DIR)/include/
tar cvJf $(DEPLOY_PACKET) -C $(EXE_DIR) .
check: check:
echo $(CHECK_FOLDER)
echo $(CHECKSOURCES)
$(CPPCHECK) $(CPPCHECK_FLAGS) $(CHECKSOURCES) $(CPPCHECK) $(CPPCHECK_FLAGS) $(CHECKSOURCES)

View File

@ -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_ */

10
source/firmware/version.h Normal file
View File

@ -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 */

View File

@ -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:])

View File

@ -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:])