test var scope

This commit is contained in:
tkl 2016-08-01 13:34:25 +02:00
parent ff8edf8c51
commit 067f9f0f4c
6 changed files with 109 additions and 29 deletions

View File

@ -1,13 +1,7 @@
variables: variables:
# PRODUCT_NAME: "AG" SW_KERNEL: "0"
# PRODUCT_VARIANT: "NA" SW_MAJOR: "0"
# PRODUCT_VARIANT: "EU" SW_MINOR: "0"
# PRODUCT_VARIANT: "CN"
# PROJECT_VERSION: "10"
# SW_MAJOR: "1"
# SW_MINOR: "3"
before_script: before_script:
@ -18,7 +12,7 @@ stages:
- check - check
- build - build
# - test # - test
# - deploy - deploy
build_job: build_job:
script: script:
@ -32,10 +26,11 @@ check_job:
- "make check BOARD=stm32f4-discovery" - "make check BOARD=stm32f4-discovery"
stage: check stage: check
#deploy_job: deploy_job:
# script: script:
# - "make deploy BOARD=stm32f4-discovery" - "source/scripts/release_number.py"
# stage: deploy - "make deploy BOARD=stm32f4-discovery"
stage: deploy
#test_job: #test_job:
# script: # script:

View File

@ -7,6 +7,7 @@ include config/make/rules.mk
OS_NAME = kosmos OS_NAME = kosmos
MAINFILE = $(EXE_DIR)/lib$(OS_NAME)-$(ARCH)-$(BOARD)$(DBG_EXT)$(LIB_EXT) 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) INCLUDES += $(SRC_DIR)
@ -29,6 +30,9 @@ ASMSOURCES += $(foreach folder, $(SUB_FOLDER), $(wildcard $(ROOT_DIR)/$(folder)/
all: check $(MAINFILE) all: check $(MAINFILE)
deploy: all deploy: all
echo $(SW_KERNEL)
echo $(SW_MAJOR)
echo $(SW_MINOR)
@$(MKDIR) $(EXE_DIR)/include @$(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/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"

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("../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:])