Add comment
[bertos.git] / wizard / bertos_utils.py
index 4a17beb91eb209ab914dab8e96356b4a395adb11..584edd0d919b8e7784e4f4f141813a595b071fd7 100644 (file)
@@ -74,6 +74,7 @@ def createBertosProject(project_info):
     ## Destination main.c file
     main = open("srctemplates/main.c", "r").read()
     open(prjdir + "/main.c", "w").write(main)
+    ## Codelite project files
     if "codelite" in project_info.info("OUTPUT"):
         workspace = codeliteWorkspaceGenerator(project_info)
         open(directory + "/" + os.path.basename(prjdir) + ".workspace", "w").write(workspace)
@@ -89,7 +90,7 @@ def mkGenerator(project_info, makefile):
     mk_data["$cpuname"] = project_info.info("CPU_INFOS")["CORE_CPU"]
     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["$constants"] = csrcGenerator(project_info)
+    mk_data["$csrc"], mk_data["$pcsrc"], 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["$cross"] = project_info.info("TOOLCHAIN")["path"].split("gcc")[0]
@@ -119,13 +120,15 @@ def csrcGenerator(project_info):
     csrc = []
     ## file to be included in PCSRC variable
     pcsrc = []
+    ## files to be included in CPPASRC variable
+    asrc = []
     ## constants to be included at the beginning of the makefile
     constants = {}
-    module_files = set([])
-    dependency_files = set([])
-    ## assembly sources
-    asm_files = set([])
     for module, information in modules.items():
+        module_files = set([])
+        dependency_files = set([])
+        ## assembly sources
+        asm_files = set([])
         if information["enabled"]:
             if "constants" in information:
                 constants.update(information["constants"])
@@ -139,15 +142,18 @@ def csrcGenerator(project_info):
                     asm_files |= set(dependencySFiles)
             for file in module_files:
                 if not harvard or "harvard" not in information or information["harvard"] == "both":
-                    csrc.append(file)
+                    csrc.append(os.path.normpath(file))
                 if harvard and "harvard" in information:
-                    pcsrc.append(file)
+                    pcsrc.append(os.path.normpath(file))
             for file in dependency_files:
-                csrc.append(file)
+                csrc.append(os.path.normpath(file))
+            for file in asm_files:
+                asrc.append(os.path.normpath(file))
     csrc = " \\\n\t".join(csrc) + " \\"
     pcsrc = " \\\n\t".join(pcsrc) + " \\"
+    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, constants
+    return csrc, pcsrc, asrc, constants
     
 def findModuleFiles(module, project_info):
     ## Find the files related to the selected module
@@ -393,6 +399,9 @@ def loadModuleData(project):
             except ParseError, err:
                 raise DefineException.ModuleDefineException(path, err.line_number, err.line)
             for module, information in module_dict.items():
+                if "depends" not in information:
+                    information["depends"] = ()
+                information["depends"] += (filename.split(".")[0],)
                 information["category"] = os.path.basename(path)
                 if "configuration" in information.keys() and len(information["configuration"]):
                     configuration = module_dict[module]["configuration"]