X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=fe346e8f12f41d8a19cb30ce736115efaa157c34;hb=160b7485c7930b724f8c724107cb4058ce985222;hp=5478cf154a6b69bc7d799aa84bba327a6cee42c4;hpb=722fd5cd013661a095b485dab5565222a1d30ac7;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 5478cf15..fe346e8f 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -4,7 +4,7 @@ # Copyright 2008 Develer S.r.l. (http://www.develer.com/) # All rights reserved. # -# $Id:$ +# $Id$ # # Author: Lorenzo Berni # @@ -14,6 +14,8 @@ import fnmatch import glob import re import shutil +# Use custom copytree function +import copytree import pickle import const @@ -37,7 +39,7 @@ def createBertosProject(project_info): # Destination source dir srcdir = directory + "/bertos" shutil.rmtree(srcdir, True) - shutil.copytree(sources_dir + "/bertos", srcdir) + copytree.copytree(sources_dir + "/bertos", srcdir, ignore_list=const.IGNORE_LIST) # Destination makefile makefile = directory + "/Makefile" if os.path.exists(makefile): @@ -53,13 +55,21 @@ def createBertosProject(project_info): cfgdir = prjdir + "/cfg" shutil.rmtree(cfgdir, True) os.mkdir(cfgdir) + # Set to 1 the autoenabled for enabled modules + for module, information in project_info.info("MODULES").items(): + if information["enabled"] and "configuration" in information and information["configuration"] != "": + configurations = project_info.info("CONFIGURATIONS") + configuration = configurations[information["configuration"]] + for start, parameter in configuration["paramlist"]: + if "type" in configuration[parameter] and configuration[parameter]["type"] == "autoenabled": + configuration[parameter]["value"] = "1" + project_info.setInfo("CONFIGURATIONS", configurations) + # Copy all the configuration files for configuration, information in project_info.info("CONFIGURATIONS").items(): string = open(sources_dir + "/" + configuration, "r").read() for start, parameter in information["paramlist"]: infos = information[parameter] value = infos["value"] - if "type" in infos["informations"] and infos["informations"]["type"] == "autoenabled": - value = "1" if "unsigned" in infos["informations"].keys() and infos["informations"]["unsigned"]: value += "U" if "long" in infos["informations"].keys() and infos["informations"]["long"]: @@ -87,9 +97,15 @@ def mkGenerator(project_info, makefile): mk_data["$pname"] = os.path.basename(project_info.info("PROJECT_PATH")) mk_data["$cpuflag"] = project_info.info("CPU_INFOS")["CPU_FLAG_NAME"] mk_data["$cpuname"] = project_info.info("CPU_INFOS")["CORE_CPU"] + mk_data["$cpuclockfreq"] = project_info.info("SELECTED_FREQ") mk_data["$cflags"] = " ".join(project_info.info("CPU_INFOS")["C_FLAGS"]) mk_data["$ldflags"] = " ".join(project_info.info("CPU_INFOS")["LD_FLAGS"]) - mk_data["$csrc"], mk_data["$pcsrc"], mk_data["$asrc"], mk_data["$constants"] = csrcGenerator(project_info) + mk_data["$cppflags"] = " ".join(project_info.info("CPU_INFOS")["CPP_FLAGS"]) + mk_data["$cppaflags"] = " ".join(project_info.info("CPU_INFOS")["CPPA_FLAGS"]) + mk_data["$cxxflags"] = " ".join(project_info.info("CPU_INFOS")["CXX_FLAGS"]) + mk_data["$asflags"] = " ".join(project_info.info("CPU_INFOS")["AS_FLAGS"]) + mk_data["$arflags"] = " ".join(project_info.info("CPU_INFOS")["AR_FLAGS"]) + mk_data["$csrc"], mk_data["$pcsrc"], mk_data["$cppasrc"], mk_data["$cxxsrc"], mk_data["$asrc"], mk_data["$constants"] = csrcGenerator(project_info) mk_data["$prefix"] = project_info.info("TOOLCHAIN")["path"].split("gcc")[0] mk_data["$suffix"] = project_info.info("TOOLCHAIN")["path"].split("gcc")[1] mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c" @@ -119,6 +135,10 @@ def csrcGenerator(project_info): # file to be included in PCSRC variable pcsrc = [] # files to be included in CPPASRC variable + cppasrc = [] + # files to be included in CXXSRC variable + cxxsrc = [] + # files to be included in ASRC variable asrc = [] # constants to be included at the beginning of the makefile constants = {} @@ -145,13 +165,25 @@ def csrcGenerator(project_info): pcsrc.append(file) for file in dependency_files: csrc.append(file) + for file in project_info.info("CPU_INFOS")["C_SRC"]: + csrc.append(file) + for file in project_info.info("CPU_INFOS")["PC_SRC"]: + pcsrc.append(file) for file in asm_files: - asrc.append(file) + cppasrc.append(file) + for file in project_info.info("CPU_INFOS")["CPPA_SRC"]: + cppasrc.append(file) + for file in project_info.info("CPU_INFOS")["CXX_SRC"]: + cxxsrc.append(file) + for file in project_info.info("CPU_INFOS")["ASRC"]: + asrc.append(file) csrc = " \\\n\t".join(csrc) + " \\" pcsrc = " \\\n\t".join(pcsrc) + " \\" + cppasrc = " \\\n\t".join(cppasrc) + " \\" + cxxsrc = " \\\n\t".join(cxxsrc) + " \\" asrc = " \\\n\t".join(asrc) + " \\" constants = "\n".join([os.path.basename(project_info.info("PROJECT_PATH")) + "_" + key + " = " + str(value) for key, value in constants.items()]) - return csrc, pcsrc, asrc, constants + return csrc, pcsrc, cppasrc, cxxsrc, asrc, constants def findModuleFiles(module, project_info): # Find the files related to the selected module