Skip to content

Remove GCC_CR and refurbish LPCXpresso exporter #3791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# See the License for the specific language governing permissions and
# 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 sw4stm32, e2studio, zip, cmsis, uvision, cdt
from tools.targets import TARGET_NAMES

EXPORTERS = {
'uvision5': uvision.Uvision,
'uvision': uvision.Uvision,
'lpcxpresso': codered.CodeRed,
'lpcxpresso': lpcxpresso.LPCXpresso,
'gcc_arm': makefile.GccArm,
'make_gcc_arm': makefile.GccArm,
'make_armc5': makefile.Armc5,
Expand Down
1 change: 0 additions & 1 deletion tools/export/codered/arch_pro_project.tmpl

This file was deleted.

3 changes: 0 additions & 3 deletions tools/export/codered/cproject_cortexm0_common.tmpl

This file was deleted.

3 changes: 0 additions & 3 deletions tools/export/codered/cproject_cortexm3_common.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc1114_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc11u35_401_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc11u35_501_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc11u37h_401_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc11u68_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc1549_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc1768_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc4088_dm_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc4088_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc4330_m4_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpc824_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/lpccappuccino_project.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion tools/export/codered/ublox_c027_project.tmpl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

from tools.export.exporters import Exporter

class CodeRed(Exporter):
NAME = 'CodeRed'
TOOLCHAIN = 'GCC_CR'
class LPCXpresso(Exporter):
NAME = 'LPCXpresso'
TOOLCHAIN = 'GCC_ARM'

MBED_CONFIG_HEADER_SUPPORTED = True

Expand Down Expand Up @@ -56,5 +56,5 @@ def generate(self):
'symbols': self.toolchain.get_symbols()
}
ctx.update(self.flags)
self.gen_file('codered/%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_project.tmpl' % self.target.lower(), ctx, '.project')
self.gen_file('lpcxpresso/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}

{% block startup_file %}cr_startup_lpc176x.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/arch_pro_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
3 changes: 3 additions & 0 deletions tools/export/lpcxpresso/cproject_cortexm0_common.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends "lpcxpresso/cproject_common.tmpl" %}

{% block core %}cm0{% endblock %}
3 changes: 3 additions & 0 deletions tools/export/lpcxpresso/cproject_cortexm3_common.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends "lpcxpresso/cproject_common.tmpl" %}

{% block core %}cm3{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}

{% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc1114_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}

{% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc11u35_401_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}

{% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc11u35_501_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}

{% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc11u37h_401_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}

{% block startup_file %}startup_LPC11U68.cpp{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc11u68_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}

{% block startup_file %}cr_startup_lpc15xx.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc1549_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxprosso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}

{% block startup_file %}cr_startup_lpc176x.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc1768_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc4088_dm_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc4088_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc4330_m4_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}

{% block startup_file %}startup_LPC824_CR.cpp{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpc824_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm0_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm0_common.tmpl" %}

{% block startup_file %}cr_startup_lpc11xx.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/lpccappuccino_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "codered_cproject_cortexm3_common.tmpl" %}
{% extends "lpcxpresso/cproject_cortexm3_common.tmpl" %}

{% block startup_file %}cr_startup_lpc176x.c{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions tools/export/lpcxpresso/ublox_c027_project.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "lpcxpresso/project_common.tmpl" %}
6 changes: 2 additions & 4 deletions tools/toolchains/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,26 +1395,24 @@ def get_config_macros(self):
return Config.config_to_macros(self.config_data) if self.config_data else []

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

TOOLCHAIN_PATHS = {
'ARM': ARM_PATH,
'uARM': ARM_PATH,
'GCC_ARM': GCC_ARM_PATH,
'GCC_CR': GCC_CR_PATH,
'IAR': IAR_PATH
}

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

TOOLCHAIN_CLASSES = {
'ARM': ARM_STD,
'uARM': ARM_MICRO,
'GCC_ARM': GCC_ARM,
'GCC_CR': GCC_CR,
'IAR': IAR
}

Expand Down
48 changes: 7 additions & 41 deletions tools/toolchains/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class GCC(mbedToolchain):
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')

def __init__(self, target, notify=None, macros=None,
silent=False, tool_path="", extra_verbose=False,
build_profile=None):
silent=False, extra_verbose=False, build_profile=None):
mbedToolchain.__init__(self, target, notify, macros, silent,
extra_verbose=extra_verbose,
build_profile=build_profile)

tool_path=TOOLCHAIN_PATHS['GCC_ARM']
# Add flags for current size setting
default_lib = "std"
if hasattr(target, "default_lib"):
Expand Down Expand Up @@ -92,7 +92,7 @@ def __init__(self, target, notify=None, macros=None,

self.flags['ld'] += self.cpu
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.ar = join(tool_path, "arm-none-eabi-ar")
Expand Down Expand Up @@ -126,7 +126,7 @@ def parse_output(self, output):
# The warning/error notification is multiline
msg = None
for line in output.splitlines():
match = GCC.DIAGNOSTIC_PATTERN.search(line)
match = self.DIAGNOSTIC_PATTERN.search(line)
if match is not None:
if msg is not None:
self.cc_info(msg)
Expand All @@ -143,7 +143,7 @@ def parse_output(self, output):
}
elif msg is not None:
# 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:
msg['col'] = len(match.group('col'))
self.cc_info(msg)
Expand Down Expand Up @@ -280,46 +280,12 @@ def make_ld_define(name, value):
def redirect_symbol(source, sync, build_dir):
return "-Wl,--defsym=%s=%s" % (source, sync)


class GCC_ARM(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_ARM", '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_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"]
class GCC_ARM(GCC):
pass