From 019ad4b6e3fca2cbe5e739c94385aadd8dd16bfa Mon Sep 17 00:00:00 2001 From: batt Date: Fri, 28 Aug 2009 13:25:27 +0000 Subject: [PATCH] Refactor makefile variables architecture. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2810 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/arm/info/AT91SAM7S128.cdef | 4 ++-- bertos/cpu/arm/info/AT91SAM7S256.cdef | 4 ++-- bertos/cpu/arm/info/AT91SAM7S512.cdef | 4 ++-- bertos/cpu/arm/info/AT91SAM7S64.cdef | 4 ++-- bertos/cpu/arm/info/AT91SAM7X128.cdef | 4 ++-- bertos/cpu/arm/info/AT91SAM7X256.cdef | 4 ++-- bertos/cpu/arm/info/AT91SAM7X512.cdef | 4 ++-- bertos/cpu/arm/info/at91sam7.common | 32 ++++++++++----------------- bertos/cpu/avr/info/avr.common | 23 ++++--------------- bertos/cpu/avr/info/avr_post.common | 7 +++++- wizard/BCpuPage.py | 13 ++++++----- wizard/bertos_utils.py | 9 ++------ wizard/const.py | 17 -------------- wizard/mktemplates/template.mk | 17 +------------- wizard/mktemplates/template_wiz.mk | 27 +++++++++++++--------- 15 files changed, 63 insertions(+), 110 deletions(-) diff --git a/bertos/cpu/arm/info/AT91SAM7S128.cdef b/bertos/cpu/arm/info/AT91SAM7S128.cdef index 1efaf1b2..cf7bbefa 100644 --- a/bertos/cpu/arm/info/AT91SAM7S128.cdef +++ b/bertos/cpu/arm/info/AT91SAM7S128.cdef @@ -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" diff --git a/bertos/cpu/arm/info/AT91SAM7S256.cdef b/bertos/cpu/arm/info/AT91SAM7S256.cdef index 603ae523..0d39a451 100644 --- a/bertos/cpu/arm/info/AT91SAM7S256.cdef +++ b/bertos/cpu/arm/info/AT91SAM7S256.cdef @@ -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" diff --git a/bertos/cpu/arm/info/AT91SAM7S512.cdef b/bertos/cpu/arm/info/AT91SAM7S512.cdef index ca8fabe1..4f3154c6 100644 --- a/bertos/cpu/arm/info/AT91SAM7S512.cdef +++ b/bertos/cpu/arm/info/AT91SAM7S512.cdef @@ -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" diff --git a/bertos/cpu/arm/info/AT91SAM7S64.cdef b/bertos/cpu/arm/info/AT91SAM7S64.cdef index e76fb92a..50ffdfef 100644 --- a/bertos/cpu/arm/info/AT91SAM7S64.cdef +++ b/bertos/cpu/arm/info/AT91SAM7S64.cdef @@ -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" diff --git a/bertos/cpu/arm/info/AT91SAM7X128.cdef b/bertos/cpu/arm/info/AT91SAM7X128.cdef index ee2d3d03..6b94b776 100644 --- a/bertos/cpu/arm/info/AT91SAM7X128.cdef +++ b/bertos/cpu/arm/info/AT91SAM7X128.cdef @@ -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" diff --git a/bertos/cpu/arm/info/AT91SAM7X256.cdef b/bertos/cpu/arm/info/AT91SAM7X256.cdef index 4f78a995..e0b8d8e7 100644 --- a/bertos/cpu/arm/info/AT91SAM7X256.cdef +++ b/bertos/cpu/arm/info/AT91SAM7X256.cdef @@ -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" diff --git a/bertos/cpu/arm/info/AT91SAM7X512.cdef b/bertos/cpu/arm/info/AT91SAM7X512.cdef index 01178560..2329a1fb 100644 --- a/bertos/cpu/arm/info/AT91SAM7X512.cdef +++ b/bertos/cpu/arm/info/AT91SAM7X512.cdef @@ -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" diff --git a/bertos/cpu/arm/info/at91sam7.common b/bertos/cpu/arm/info/at91sam7.common index 5dea788c..942d84e9 100644 --- a/bertos/cpu/arm/info/at91sam7.common +++ b/bertos/cpu/arm/info/at91sam7.common @@ -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"] diff --git a/bertos/cpu/avr/info/avr.common b/bertos/cpu/avr/info/avr.common index 924eea9a..5bb40dee 100644 --- a/bertos/cpu/avr/info/avr.common +++ b/bertos/cpu/avr/info/avr.common @@ -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/" diff --git a/bertos/cpu/avr/info/avr_post.common b/bertos/cpu/avr/info/avr_post.common index e1237433..b5aa27f9 100644 --- a/bertos/cpu/avr/info/avr_post.common +++ b/bertos/cpu/avr/info/avr_post.common @@ -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 ] diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index ff0710c3..463e333f 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -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 diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index e8f35842..fcfa3da7 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -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 diff --git a/wizard/const.py b/wizard/const.py index 5fc1d562..4b2a3fcc 100644 --- a/wizard/const.py +++ b/wizard/const.py @@ -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": "", } diff --git a/wizard/mktemplates/template.mk b/wizard/mktemplates/template.mk index 155b8f95..35896c47 100644 --- a/wizard/mktemplates/template.mk +++ b/wizard/mktemplates/template.mk @@ -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 diff --git a/wizard/mktemplates/template_wiz.mk b/wizard/mktemplates/template_wiz.mk index 4caf7f2f..88bd3f71 100644 --- a/wizard/mktemplates/template_wiz.mk +++ b/wizard/mktemplates/template_wiz.mk @@ -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) -- 2.25.1