Refactor makefile variables architecture.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 28 Aug 2009 13:25:27 +0000 (13:25 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 28 Aug 2009 13:25:27 +0000 (13:25 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2810 38d2e660-2303-0410-9eaa-f027e97ec537

15 files changed:
bertos/cpu/arm/info/AT91SAM7S128.cdef
bertos/cpu/arm/info/AT91SAM7S256.cdef
bertos/cpu/arm/info/AT91SAM7S512.cdef
bertos/cpu/arm/info/AT91SAM7S64.cdef
bertos/cpu/arm/info/AT91SAM7X128.cdef
bertos/cpu/arm/info/AT91SAM7X256.cdef
bertos/cpu/arm/info/AT91SAM7X512.cdef
bertos/cpu/arm/info/at91sam7.common
bertos/cpu/avr/info/avr.common
bertos/cpu/avr/info/avr_post.common
wizard/BCpuPage.py
wizard/bertos_utils.py
wizard/const.py
wizard/mktemplates/template.mk
wizard/mktemplates/template_wiz.mk

index 1efaf1b2d5d424edcfb38af0d569f15f24fd9320..cf7bbefae32a39bdb469ae7270bce0c41c6e2eb2 100644 (file)
@@ -48,6 +48,6 @@ CPU_DESC += [ "128 Kbytes internal flash memory",
              "32 Kbytes internal SRAM memory" ]
 
 # GCC flags for this cpu.
-CPP_FLAGS += [ "-D__ARM_AT91SAM7S128__" ]
-LD_FLAGS += [ "-T " + SCRIPT_DIR + "at91sam7_128_rom.ld" ]
+MK_CPU_CPPFLAGS += " -D__ARM_AT91SAM7S128__"
+MK_LDFLAGS += " -T " + SCRIPT_DIR + "at91sam7_128_rom.ld"
 
index 603ae5234be5ac92923a196fb2e8a23643b61671..0d39a4516300519238bad9b8b050d7de2a98ece9 100644 (file)
@@ -48,7 +48,7 @@ CPU_DESC += [ "256 Kbytes internal flash memory",
              "64 Kbytes internal SRAM memory" ]
 
 # GCC flags for this cpu.
-CPP_FLAGS += [ "-D__ARM_AT91SAM7S256__" ]
-LD_FLAGS += [ "-T " + SCRIPT_DIR + "at91sam7_256_rom.ld" ]
+MK_CPU_CPPFLAGS += " -D__ARM_AT91SAM7S256__"
+MK_LDFLAGS += " -T " + SCRIPT_DIR + "at91sam7_256_rom.ld"
 
 
index ca8fabe1ed5da3ba2c56388604de67c5d2832a9e..4f3154c61035908e55b4865eed0e6da045e64d8f 100644 (file)
@@ -48,6 +48,6 @@ CPU_DESC += [ "512 Kbytes internal flash memory",
              "64 Kbytes internal SRAM memory" ]
 
 # GCC flags for this cpu.
-CPP_FLAGS += [ "-D__ARM_AT91SAM7S512__" ]
-LD_FLAGS += [ "-T " + SCRIPT_DIR + "at91sam7_512_rom.ld" ]
+MK_CPU_CPPFLAGS += " -D__ARM_AT91SAM7S512__"
+MK_LDFLAGS += " -T " + SCRIPT_DIR + "at91sam7_512_rom.ld"
 
index e76fb92a6da76b252aa50f9427b7b791245a0ccf..50ffdfef1c7dd9c8889644afea35068efda69fcb 100644 (file)
@@ -48,6 +48,6 @@ CPU_DESC += [ "64 Kbytes internal flash memory",
              "16 Kbytes internal SRAM memory" ]
 
 # GCC flags for this cpu.
-CPP_FLAGS += [ "-D__ARM_AT91SAM7S64__" ]
-LD_FLAGS += [ "-T " + SCRIPT_DIR + "at91sam7_64_rom.ld" ]
+MK_CPU_CPPFLAGS += " -D__ARM_AT91SAM7S64__"
+MK_LDFLAGS += " -T " + SCRIPT_DIR + "at91sam7_64_rom.ld"
 
index ee2d3d03914080350e41dc6462c184c1e3c3e1f7..6b94b7764ecbc62ac7b50a515700f17d9592b05e 100644 (file)
@@ -48,6 +48,6 @@ CPU_DESC += [ "128 Kbytes internal flash memory",
              "32 Kbytes internal SRAM memory" ]
 
 # GCC flags for this cpu.
-CPP_FLAGS += [ "-D__ARM_AT91SAM7X128__" ]
-LD_FLAGS += [ "-T " + SCRIPT_DIR + "at91sam7_128_rom.ld" ]
+MK_CPU_CPPFLAGS += " -D__ARM_AT91SAM7X128__"
+MK_LDFLAGS += " -T " + SCRIPT_DIR + "at91sam7_128_rom.ld"
 
index 4f78a995f398e507cccf668443c3705d4922140b..e0b8d8e7075626369d390343adb54f95331292f1 100644 (file)
@@ -48,6 +48,6 @@ CPU_DESC += [ "256 Kbytes internal flash memory",
              "64 Kbytes internal SRAM memory" ]
 
 # GCC flags for this cpu.
-CPP_FLAGS += [ "-D__ARM_AT91SAM7X256__" ]
-LD_FLAGS += [ "-T " + SCRIPT_DIR + "at91sam7_256_rom.ld" ]
+MK_CPU_CPPFLAGS += " -D__ARM_AT91SAM7X256__"
+MK_LDFLAGS += " -T " + SCRIPT_DIR + "at91sam7_256_rom.ld"
 
index 0117856028a9e18d7d77e102081e39f2ae1ea0d7..2329a1fbdd0acaa2fc3b685e4346e9157af4215f 100644 (file)
@@ -48,6 +48,6 @@ CPU_DESC += [ "512 Kbytes internal flash memory",
              "64 Kbytes internal SRAM memory" ]
 
 # GCC flags for this cpu.
-CPP_FLAGS += [ "-D__ARM_AT91SAM7X512__" ]
-LD_FLAGS += [ "-T " + SCRIPT_DIR + "at91sam7_512_rom.ld" ]
+MK_CPU_CPPFLAGS += " -D__ARM_AT91SAM7X512__"
+MK_LDFLAGS += " -T " + SCRIPT_DIR + "at91sam7_512_rom.ld"
 
index 5dea788c3ddff24a362edfadd7e8f1ce7c47d9f0..942d84e9a500f141b217930afd2bb2bdd7e41731 100644 (file)
@@ -55,39 +55,31 @@ TOOLCHAIN = "arm"
 CORE_CPU = "arm7tdmi"
 
 # CPU type used for flashing/debugging
-PROGRAMMER_CPU = "at91sam7"
+MK_PROGRAMMER_CPU = "at91sam7"
 
 # Name of the flag used by the build system to pass to the compiler the CPU type.
-CPU_FLAG_NAME = "CPU"
+MK_CPU = CORE_CPU
 
 # CPU default clock frequency
 CPU_DEFAULT_FREQ = "48023000UL"
 
 # Special CPU related tags.
-CPU_TAGS = ["at91"]
+CPU_TAGS = ["at91", CORE_CPU]
 
 # Where are locate the bertos directories
 SCRIPT_DIR = CPU_DIR + "arm/scripts/"
 HW_DIR = CPU_DIR + "arm/hw/"
-DRV_DIR = CPU_DIR + "arm/drv/"
+PROG_SCRIPT_DIR = "prog_scripts/arm/"
 
-FLASH_SCRIPT = SCRIPT_DIR + "flash.sh"
-DEBUG_SCRIPT = SCRIPT_DIR + "debug.sh"
-GDB_INIT_SCRIPT = SCRIPT_DIR + "openocd/gdbinit-sam7"
+MK_FLASH_SCRIPT = PROG_SCRIPT_DIR + "flash.sh"
+MK_DEBUG_SCRIPT = PROG_SCRIPT_DIR + "debug.sh"
+MK_GDB_INIT_SCRIPT = PROG_SCRIPT_DIR + "openocd/gdbinit-sam7"
 
 # Common GCC flags.
-CPPA_FLAGS = [ "-O0", "-g -gdwarf-2", "-g -gen-debug" ]
-CPP_FLAGS = [ "-O0", "-g3 -gdwarf-2", "-fverbose-asm", "-I" + CPU_DIR + "arm/" ]
-LD_FLAGS = [ "-nostartfiles", "-Wl,--no-warn-mismatch" ]
-# CRT file.
-CPPA_SRC = [ HW_DIR + "crtat91sam7_rom.S"]
+MK_CPPAFLAGS = "-O0 -g -gdwarf-2 -g -gen-debug"
+MK_CPU_CPPFLAGS = "-O0 -g3 -gdwarf-2 -fverbose-asm -I" + CPU_DIR + "arm/"
+MK_LDFLAGS = "-nostartfiles -Wl,--no-warn-mismatch"
 
-# For this cpu core BeRTOS supports these drivers:
-SUPPORTED_DRV = [ "adc",
-                 "kdebug",
-                 "pwm",
-                 "ser",
-                 "stepper",
-                 "timer",
-                 "twi" ]
+# CRT file.
+MK_CPPASRC = [ HW_DIR + "crtat91sam7_rom.S"]
 
index 924eea9a02dec02b77eb38fd05c93969cd91322a..5bb40dee108eccc8226f6869ee0f60ef6089aad6 100644 (file)
@@ -53,31 +53,16 @@ CPU_TAGS = ["harvard"]
 # Type of the toolchain we should use to compile the source for this CPU.
 TOOLCHAIN = "avr"
 
-# Name of the flag used by the build system to pass to the compiler the CPU type.
-CPU_FLAG_NAME = "MCU"
-
 # CPU default clock frequency
 CPU_DEFAULT_FREQ = "8000000UL"
 
 # Where are locate the bertos directories
 SCRIPT_DIR = CPU_DIR + "avr/scripts/"
-HW_DIR = CPU_DIR + "avr/hw/"
-DRV_DIR = CPU_DIR + "avr/drv/"
+PROG_SCRIPT_DIR = "prog_scripts/avr/"
 
-FLASH_SCRIPT = SCRIPT_DIR + "flash.sh"
-DEBUG_SCRIPT = SCRIPT_DIR + "debug.sh"
+MK_FLASH_SCRIPT = PROG_SCRIPT_DIR + "flash.sh"
+MK_DEBUG_SCRIPT = PROG_SCRIPT_DIR + "debug.sh"
 
 # Common GCC flags.
-CPP_FLAGS = [ "-Os", "-fno-strict-aliasing", "-I" + CPU_DIR + "avr/"]
-
-SUPPORTED_DRV = [ "adc",
-                 "flash",
-                 "pwm",
-                 "ser",
-                 "sipo",
-                 "timer",
-                 "wdt",
-                 "ic2",
-                 "kdebug",
-                 "lcd_32122a" ]
+MK_CPU_CPPFLAGS = "-Os -fno-strict-aliasing -I" + CPU_DIR + "avr/"
 
index e1237433e6f9d34701bf74b192d1c9b0fc7d859f..b5aa27f9341403723d8968cc9a2b408ea676e50c 100644 (file)
@@ -1,4 +1,9 @@
 
 # CPU type used for flashing
-PROGRAMMER_CPU = CORE_CPU
+MK_PROGRAMMER_CPU = CORE_CPU
 
+# Name of the flag used by the build system to pass to the compiler the CPU type.
+MK_MCU = CORE_CPU
+
+# Add CPU core to tags
+CPU_TAGS += [ CORE_CPU ]
index ff0710c3c90ca6ac68950ea000dc77c249b19d99..463e333fa7c4954b394c15b0691fe55b92d943d7 100644 (file)
@@ -61,16 +61,19 @@ class BCpuPage(BWizardPage):
             self.pageContent.frequencySpinBox.setVisible(True)
             infos = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))
             for key, value in infos.items():
-                if type(CPU_DEF[key]) == list:
-                    infos[key] = qvariant_converter.getStringList(value)
-                if type(CPU_DEF[key]) == str or type(CPU_DEF) == unicode:
-                    infos[key] = qvariant_converter.getString(value)
+               if key in CPU_DEF:
+                   if type(CPU_DEF[key]) == list:
+                       infos[key] = qvariant_converter.getStringList(value)
+                   if type(CPU_DEF[key]) == str or type(CPU_DEF) == unicode:
+                       infos[key] = qvariant_converter.getString(value)
+               else:
+                    del infos[key]
             self.setProjectInfo("CPU_INFOS", infos)
             self.setProjectInfo("CPU_NAME", unicode(self.pageContent.cpuList.currentItem().text()))
             self.setProjectInfo("SELECTED_FREQ", unicode(long(self.pageContent.frequencySpinBox.value())))
             tag_dict = self.projectInfo("ALL_CPU_TAGS")
             for tag in tag_dict:
-                if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["CORE_CPU"], infos["TOOLCHAIN"]]:
+                if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["TOOLCHAIN"]]:
                     tag_dict[tag] = True
                 else:
                     tag_dict[tag] = False
index e8f35842434d7c550f599eb50c4aaf0b98be1b2f..fcfa3da7097c3a10f3a9f49310d927588ac8f865 100644 (file)
@@ -76,7 +76,7 @@ def loadBertosProject(project_file):
         tag_dict[element] = False
     infos = project_info.info("CPU_INFOS")
     for tag in tag_dict:
-        if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["CORE_CPU"], infos["TOOLCHAIN"]]:
+        if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["TOOLCHAIN"]]:
             tag_dict[tag] = True
         else:
             tag_dict[tag] = False
@@ -216,19 +216,15 @@ def mkGenerator(project_info, makefile):
     mk_data = {}
     mk_data["$pname"] = os.path.basename(project_info.info("PROJECT_PATH"))
     mk_data["$cpuclockfreq"] = project_info.info("SELECTED_FREQ")
-
     cpu_mk_parameters = []
     for key, value in project_info.info("CPU_INFOS").items():
         if key.startswith("MK_"):
-            cpu_mk_parameters.append("%s = %s" %(key.replace("MK_", mk_data["$pname"]), value)
+            cpu_mk_parameters.append("%s = %s" %(key.replace("MK_", mk_data["$pname"]), value))
     mk_data["$cpuparameters"] = "\n".join(cpu_mk_parameters)
     mk_data["$csrc"], mk_data["$pcsrc"], mk_data["$cppasrc"], mk_data["$cxxsrc"], mk_data["$asrc"], mk_data["$constants"] = csrcGenerator(project_info)
     mk_data["$prefix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[0])
     mk_data["$suffix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[1])
     mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c"
-    mk_data["$programmercpu"] = project_info.info("CPU_INFOS")["PROGRAMMER_CPU"]
-    mk_data["$flashscript"] = project_info.info("CPU_INFOS")["FLASH_SCRIPT"]
-    mk_data["$debugscript"] = project_info.info("CPU_INFOS")["DEBUG_SCRIPT"]
     for key in mk_data:
         while makefile.find(key) != -1:
             makefile = makefile.replace(key, mk_data[key])
@@ -419,7 +415,6 @@ def getTagSet(cpu_info):
     for cpu in cpu_info:
         tag_set |= set([cpu["CPU_NAME"]])
         tag_set |= set(cpu["CPU_TAGS"])
-        tag_set |= set([cpu["CORE_CPU"]])
         tag_set |= set([cpu["TOOLCHAIN"]])
     return tag_set
         
index 5fc1d562e7aaecab476046895a54f4eb78031e7b..4b2a3fccb10ea82f50d69482d57ce454f3ce8b37 100644 (file)
@@ -39,30 +39,13 @@ CPU_DEF = {
     "DEFINITION_PATH": "",
     "TOOLCHAIN": "",
     "CPU_TAGS": [],
-    "CPU_FLAG_NAME": "",
-    "CORE_CPU": "",
-    "SCRIPT_DIR": "",
-    "HW_DIR": "",
-    "DRV_DIR": "",
-    "C_FLAGS": [],
-    "CPPA_FLAGS" : [],
-    "CPP_FLAGS" : [],
-    "CPPA_FLAGS": [],
-    "CXX_FLAGS": [],
-    "AS_FLAGS": [],
-    "AR_FLAGS": [],
-    "LD_FLAGS" : [],
     "CPPA_SRC" : [],
     "CXX_SRC": [],
     "ASRC": [],
     "C_SRC": [],
-    "SUPPORTED_DRV" : [],
     "PC_SRC" : [],
     "CPU_DESC" : [],
     "CPU_DEFAULT_FREQ": "1000000",
-    "PROGRAMMER_CPU": "",
-    "FLASH_SCRIPT": "",
-    "DEBUG_SCRIPT": "",
     "GDB_INIT_SCRIPT": "",
 }
 
index 155b8f95b4d3acd14b515d2592440d8b113fb90f..35896c47af8609d14bf8db8d3c939d9e72dde630 100644 (file)
@@ -36,20 +36,5 @@ $pname_USER_ASRC = \
 $pname_PROGRAMMER_TYPE = none
 $pname_PROGRAMMER_PORT = none
 
-####### End of configurable section, do not edit the lines below! #######
-
-# Automatically generated by the wizard. PLEASE DO NOT EDIT!
-$pname_CSRC = $($pname_WIZARD_CSRC) $($pname_USER_CSRC)
-
-# Automatically generated by the wizard. PLEASE DO NOT EDIT!
-$pname_PCSRC = $($pname_WIZARD_PCSRC) $($pname_USER_PCSRC)
-
-# Automatically generated by the wizard. PLEASE DO NOT EDIT!
-$pname_CPPASRC = $($pname_WIZARD_CPPASRC) $($pname_USER_CPPASRC)
-
-# Automatically generated by the wizard. PLEASE DO NOT EDIT!
-$pname_CXXSRC = $($pname_WIZARD_CXXSRC) $($pname_USER_CXXSRC)
-
-# Automatically generated by the wizard. PLEASE DO NOT EDIT!
-$pname_ASRC = $($pname_WIZARD_ASRC) $($pname_USER_ASRC)
 
+$cpuparameters
index 4caf7f2fed522e249f7fbc49d3e2a6de79792a75..88bd3f71d4663e63503cc23fb65b65795ff9942d 100644 (file)
@@ -45,14 +45,19 @@ $pname_WIZARD_ASRC = \
        $asrc
        #
 
-$pname_CFLAGS = $cflags
-$pname_LDFLAGS = $ldflags
-$pname_CPPFLAGS = -D'CPU_FREQ=($cpuclockfreqUL)' -D'ARCH=(ARCH_DEFAULT)' -D'WIZ_AUTOGEN' -I$pname/ $cppflags
-$pname_CPPAFLAGS = $cppaflags
-$pname_CXXFLAGS = $cxxflags
-$pname_ASFLAGS = $asflags
-$pname_ARFLAGS = $arflags
-
-$pname_PROGRAMMER_CPU = $programmercpu
-$pname_FLASH_SCRIPT = $flashscript
-$pname_DEBUG_SCRIPT = $debugscript
+$pname_CPPFLAGS = -D'CPU_FREQ=($cpuclockfreqUL)' -D'ARCH=(ARCH_DEFAULT)' -D'WIZ_AUTOGEN' -I$pname/ $($pname_CPU_CPPFLAGS)
+
+# Automatically generated by the wizard. PLEASE DO NOT EDIT!
+$pname_CSRC = $($pname_WIZARD_CSRC) $($pname_USER_CSRC)
+
+# Automatically generated by the wizard. PLEASE DO NOT EDIT!
+$pname_PCSRC = $($pname_WIZARD_PCSRC) $($pname_USER_PCSRC)
+
+# Automatically generated by the wizard. PLEASE DO NOT EDIT!
+$pname_CPPASRC = $($pname_WIZARD_CPPASRC) $($pname_USER_CPPASRC)
+
+# Automatically generated by the wizard. PLEASE DO NOT EDIT!
+$pname_CXXSRC = $($pname_WIZARD_CXXSRC) $($pname_USER_CXXSRC)
+
+# Automatically generated by the wizard. PLEASE DO NOT EDIT!
+$pname_ASRC = $($pname_WIZARD_ASRC) $($pname_USER_ASRC)