Merge pull request #3791 from theotherjimmy/remove-cr

Remove GCC_CR and refurbish LPCXpresso exporter
pull/3724/head
Sam Grove 2017-02-22 13:33:14 -06:00 committed by GitHub
commit 067f5a0fef
52 changed files with 47 additions and 83 deletions

View File

@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from tools.export import codered, ds5_5, iar, makefile from tools.export import lpcxpresso, ds5_5, iar, makefile
from tools.export import embitz, coide, kds, simplicity, atmelstudio from tools.export import embitz, coide, kds, simplicity, atmelstudio
from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt
from tools.export import gnuarmeclipse from tools.export import gnuarmeclipse
@ -24,7 +24,7 @@ from tools.targets import TARGET_NAMES
EXPORTERS = { EXPORTERS = {
'uvision5': uvision.Uvision, 'uvision5': uvision.Uvision,
'uvision': uvision.Uvision, 'uvision': uvision.Uvision,
'lpcxpresso': codered.CodeRed, 'lpcxpresso': lpcxpresso.LPCXpresso,
'gcc_arm': makefile.GccArm, 'gcc_arm': makefile.GccArm,
'make_gcc_arm': makefile.GccArm, 'make_gcc_arm': makefile.GccArm,
'make_armc5': makefile.Armc5, 'make_armc5': makefile.Armc5,

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1,3 +0,0 @@
{% extends "codered_cproject_common.tmpl" %}
{% block core %}cm0{% endblock %}

View File

@ -1,3 +0,0 @@
{% extends "codered_cproject_common.tmpl" %}
{% block core %}cm3{% endblock %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -1 +0,0 @@
{% extends "codered_project_common.tmpl" %}

View File

@ -18,9 +18,9 @@ from os.path import splitext, basename
from tools.export.exporters import Exporter from tools.export.exporters import Exporter
class CodeRed(Exporter): class LPCXpresso(Exporter):
NAME = 'CodeRed' NAME = 'LPCXpresso'
TOOLCHAIN = 'GCC_CR' TOOLCHAIN = 'GCC_ARM'
MBED_CONFIG_HEADER_SUPPORTED = True MBED_CONFIG_HEADER_SUPPORTED = True
@ -56,5 +56,5 @@ class CodeRed(Exporter):
'symbols': self.toolchain.get_symbols() 'symbols': self.toolchain.get_symbols()
} }
ctx.update(self.flags) ctx.update(self.flags)
self.gen_file('codered/%s_project.tmpl' % self.target.lower(), ctx, '.project') self.gen_file('lpcxpresso/%s_project.tmpl' % self.target.lower(), ctx, '.project')
self.gen_file('codered/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject') self.gen_file('lpcxpresso/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}
{% block startup_file %}cr_startup_lpc176x.c{% endblock %} {% block startup_file %}cr_startup_lpc176x.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -0,0 +1,3 @@
{% extends "lpcxpresso/cproject_common.tmpl" %}
{% block core %}cm0{% endblock %}

View File

@ -0,0 +1,3 @@
{% extends "lpcxpresso/cproject_common.tmpl" %}
{% block core %}cm3{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}
{% block startup_file %}cr_startup_lpc11xx.c{% endblock %} {% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}
{% block startup_file %}cr_startup_lpc11xx.c{% endblock %} {% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}
{% block startup_file %}cr_startup_lpc11xx.c{% endblock %} {% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}
{% block startup_file %}cr_startup_lpc11xx.c{% endblock %} {% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}
{% block startup_file %}startup_LPC11U68.cpp{% endblock %} {% block startup_file %}startup_LPC11U68.cpp{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}
{% block startup_file %}cr_startup_lpc15xx.c{% endblock %} {% block startup_file %}cr_startup_lpc15xx.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxprosso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}
{% block startup_file %}cr_startup_lpc176x.c{% endblock %} {% block startup_file %}cr_startup_lpc176x.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}
{% block startup_file %}startup_LPC824_CR.cpp{% endblock %} {% block startup_file %}startup_LPC824_CR.cpp{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}
{% block startup_file %}cr_startup_lpc11xx.c{% endblock %} {% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %} {% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}
{% block startup_file %}cr_startup_lpc176x.c{% endblock %} {% block startup_file %}cr_startup_lpc176x.c{% endblock %}

View File

@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}

View File

@ -1395,26 +1395,24 @@ class mbedToolchain:
return Config.config_to_macros(self.config_data) if self.config_data else [] return Config.config_to_macros(self.config_data) if self.config_data else []
from tools.settings import ARM_PATH from tools.settings import ARM_PATH
from tools.settings import GCC_ARM_PATH, GCC_CR_PATH from tools.settings import GCC_ARM_PATH
from tools.settings import IAR_PATH from tools.settings import IAR_PATH
TOOLCHAIN_PATHS = { TOOLCHAIN_PATHS = {
'ARM': ARM_PATH, 'ARM': ARM_PATH,
'uARM': ARM_PATH, 'uARM': ARM_PATH,
'GCC_ARM': GCC_ARM_PATH, 'GCC_ARM': GCC_ARM_PATH,
'GCC_CR': GCC_CR_PATH,
'IAR': IAR_PATH 'IAR': IAR_PATH
} }
from tools.toolchains.arm import ARM_STD, ARM_MICRO from tools.toolchains.arm import ARM_STD, ARM_MICRO
from tools.toolchains.gcc import GCC_ARM, GCC_CR from tools.toolchains.gcc import GCC_ARM
from tools.toolchains.iar import IAR from tools.toolchains.iar import IAR
TOOLCHAIN_CLASSES = { TOOLCHAIN_CLASSES = {
'ARM': ARM_STD, 'ARM': ARM_STD,
'uARM': ARM_MICRO, 'uARM': ARM_MICRO,
'GCC_ARM': GCC_ARM, 'GCC_ARM': GCC_ARM,
'GCC_CR': GCC_CR,
'IAR': IAR 'IAR': IAR
} }

View File

@ -29,12 +29,12 @@ class GCC(mbedToolchain):
INDEX_PATTERN = re.compile('(?P<col>\s*)\^') INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
def __init__(self, target, notify=None, macros=None, def __init__(self, target, notify=None, macros=None,
silent=False, tool_path="", extra_verbose=False, silent=False, extra_verbose=False, build_profile=None):
build_profile=None):
mbedToolchain.__init__(self, target, notify, macros, silent, mbedToolchain.__init__(self, target, notify, macros, silent,
extra_verbose=extra_verbose, extra_verbose=extra_verbose,
build_profile=build_profile) build_profile=build_profile)
tool_path=TOOLCHAIN_PATHS['GCC_ARM']
# Add flags for current size setting # Add flags for current size setting
default_lib = "std" default_lib = "std"
if hasattr(target, "default_lib"): if hasattr(target, "default_lib"):
@ -92,7 +92,7 @@ class GCC(mbedToolchain):
self.flags['ld'] += self.cpu self.flags['ld'] += self.cpu
self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.flags['ld'] self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.flags['ld']
self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"] self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc", "nosys"]
self.preproc = [join(tool_path, "arm-none-eabi-cpp"), "-E", "-P"] self.preproc = [join(tool_path, "arm-none-eabi-cpp"), "-E", "-P"]
self.ar = join(tool_path, "arm-none-eabi-ar") self.ar = join(tool_path, "arm-none-eabi-ar")
@ -126,7 +126,7 @@ class GCC(mbedToolchain):
# The warning/error notification is multiline # The warning/error notification is multiline
msg = None msg = None
for line in output.splitlines(): for line in output.splitlines():
match = GCC.DIAGNOSTIC_PATTERN.search(line) match = self.DIAGNOSTIC_PATTERN.search(line)
if match is not None: if match is not None:
if msg is not None: if msg is not None:
self.cc_info(msg) self.cc_info(msg)
@ -143,7 +143,7 @@ class GCC(mbedToolchain):
} }
elif msg is not None: elif msg is not None:
# Determine the warning/error column by calculating the ^ position # Determine the warning/error column by calculating the ^ position
match = GCC.INDEX_PATTERN.match(line) match = self.INDEX_PATTERN.match(line)
if match is not None: if match is not None:
msg['col'] = len(match.group('col')) msg['col'] = len(match.group('col'))
self.cc_info(msg) self.cc_info(msg)
@ -280,8 +280,6 @@ class GCC(mbedToolchain):
def redirect_symbol(source, sync, build_dir): def redirect_symbol(source, sync, build_dir):
return "-Wl,--defsym=%s=%s" % (source, sync) return "-Wl,--defsym=%s=%s" % (source, sync)
class GCC_ARM(GCC):
@staticmethod @staticmethod
def check_executable(): def check_executable():
"""Returns True if the executable (arm-none-eabi-gcc) location """Returns True if the executable (arm-none-eabi-gcc) location
@ -289,37 +287,5 @@ class GCC_ARM(GCC):
Returns False otherwise.""" Returns False otherwise."""
return mbedToolchain.generic_check_executable("GCC_ARM", 'arm-none-eabi-gcc', 1) return mbedToolchain.generic_check_executable("GCC_ARM", 'arm-none-eabi-gcc', 1)
def __init__(self, target, notify=None, macros=None, class GCC_ARM(GCC):
silent=False, extra_verbose=False, build_profile=None): pass
GCC.__init__(self, target, notify, macros, silent,
TOOLCHAIN_PATHS['GCC_ARM'], extra_verbose=extra_verbose,
build_profile=build_profile)
self.sys_libs.append("nosys")
class GCC_CR(GCC):
@staticmethod
def check_executable():
"""Returns True if the executable (arm-none-eabi-gcc) location
specified by the user exists OR the executable can be found on the PATH.
Returns False otherwise."""
return mbedToolchain.generic_check_executable("GCC_CR", 'arm-none-eabi-gcc', 1)
def __init__(self, target, notify=None, macros=None,
silent=False, extra_verbose=False, build_profile=None):
GCC.__init__(self, target, notify, macros, silent,
TOOLCHAIN_PATHS['GCC_CR'], extra_verbose=extra_verbose,
build_profile=build_profile)
additional_compiler_flags = [
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
]
self.cc += additional_compiler_flags
self.cppc += additional_compiler_flags
# Use latest gcc nanolib
self.ld.append("--specs=nano.specs")
if target.name in ["LPC1768", "LPC4088", "LPC4088_DM", "LPC4330", "UBLOX_C027", "LPC2368"]:
self.ld.extend(["-u _printf_float", "-u _scanf_float"])
self.ld += ["-nostdlib"]