mirror of https://github.com/ARMmbed/mbed-os.git
Avoid relying on environmental variables for ARMCC system include and library paths. Provide build progress notification to web IDE. Add generic MBED_MCU target.
parent
3cba20b3cd
commit
2f74fffc00
|
@ -5,31 +5,45 @@ from workspace_tools.data.support import *
|
|||
LIBRARIES = [
|
||||
# NXP
|
||||
{
|
||||
"id": "nxp_cmsis",
|
||||
"source_dir": join(NXP, "cmsis"),
|
||||
"id": "NXP_cmsis",
|
||||
"source_dir": join(VENDOR_NXP, "cmsis"),
|
||||
"build_dir": MBED_LIBRARIES,
|
||||
"supported": DEFAULT_SUPPORT
|
||||
},
|
||||
{
|
||||
"id": "nxp_mbed",
|
||||
"id": "NXP_mbed",
|
||||
"name": "mbed",
|
||||
"source_dir": [join(NXP, "capi"), MBED_CAPI, MBED_CPP],
|
||||
"source_dir": [join(VENDOR_NXP, "capi"), MBED_CAPI, MBED_CPP],
|
||||
"build_dir": MBED_LIBRARIES,
|
||||
"dependencies": [MBED_LIBRARIES],
|
||||
"supported": DEFAULT_SUPPORT
|
||||
},
|
||||
|
||||
# Freescale
|
||||
# ARM
|
||||
{
|
||||
"id": "freescale_cmsis",
|
||||
"source_dir": join(FREESCALE, "cmsis"),
|
||||
"id": "ARM_cmsis",
|
||||
"source_dir": join(VENDOR_ARM, "cmsis"),
|
||||
"build_dir": MBED_LIBRARIES,
|
||||
"supported": DEFAULT_SUPPORT
|
||||
},
|
||||
{
|
||||
"id": "freescale_mbed",
|
||||
"id": "ARM_mbed",
|
||||
"name": "mbed",
|
||||
"source_dir": [join(FREESCALE, "capi"), MBED_CAPI, MBED_CPP],
|
||||
"source_dir": [join(VENDOR_ARM, "capi"), MBED_CAPI, MBED_CPP],
|
||||
"build_dir": MBED_LIBRARIES,
|
||||
"dependencies": [MBED_LIBRARIES],
|
||||
"supported": DEFAULT_SUPPORT
|
||||
},
|
||||
# Freescale
|
||||
{
|
||||
"id": "Freescale_cmsis",
|
||||
"source_dir": join(VENDOR_FREESCALE, "cmsis"),
|
||||
"build_dir": MBED_LIBRARIES,
|
||||
"supported": DEFAULT_SUPPORT
|
||||
},
|
||||
{
|
||||
"id": "Freescale_mbed",
|
||||
"name": "mbed",
|
||||
"source_dir": [join(VENDOR_FREESCALE, "capi"), MBED_CAPI, MBED_CPP],
|
||||
"build_dir": MBED_LIBRARIES,
|
||||
"dependencies": [MBED_LIBRARIES],
|
||||
"supported": DEFAULT_SUPPORT
|
||||
|
|
|
@ -17,8 +17,9 @@ MBED_RPC = join(MBED_BASE, "rpc")
|
|||
|
||||
# Vendors directories
|
||||
VENDOR = join(MBED_BASE, "vendor")
|
||||
NXP = join(VENDOR, "NXP")
|
||||
FREESCALE = join(VENDOR, "Freescale")
|
||||
VENDOR_NXP = join(VENDOR, "NXP")
|
||||
VENDOR_FREESCALE = join(VENDOR, "Freescale")
|
||||
VENDOR_ARM = join(VENDOR, "ARM")
|
||||
|
||||
MBED_LIBRARIES = join(BUILD_DIR, "mbed")
|
||||
|
||||
|
|
|
@ -36,29 +36,20 @@ armcc = "standalone" # "keil", or "standalone", or "ds-5"
|
|||
|
||||
if armcc == "keil":
|
||||
ARM_PATH = "C:/Keil_4_54/ARM"
|
||||
|
||||
ARM_BIN = join(ARM_PATH, "BIN40")
|
||||
|
||||
ARM_INC = join(ARM_PATH, "INC")
|
||||
|
||||
ARM_INC = join(ARM_PATH, "RV31", "INC")
|
||||
ARM_LIB = join(ARM_PATH, "RV31", "LIB")
|
||||
|
||||
elif armcc == "standalone":
|
||||
ARM_PATH = "C:/Program Files/ARM/armcc_4.1_791"
|
||||
|
||||
ARM_BIN = join(ARM_PATH, "bin")
|
||||
|
||||
ARM_INC = join(ARM_PATH, "include")
|
||||
|
||||
ARM_LIB = join(ARM_PATH, "lib")
|
||||
|
||||
elif armcc == "ds-5":
|
||||
ARM_PATH = "C:/Program Files (x86)/DS-5"
|
||||
|
||||
ARM_BIN = join(ARM_PATH, "bin")
|
||||
|
||||
ARM_INC = join(ARM_PATH, "include")
|
||||
|
||||
ARM_LIB = join(ARM_PATH, "lib")
|
||||
|
||||
ARM_CPPLIB = join(ARM_LIB, "cpplib")
|
||||
|
@ -76,6 +67,10 @@ GCC_CR_PATH = "C:/code_red/RedSuite_4.2.0_349/redsuite/Tools/bin"
|
|||
# IAR
|
||||
IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.0/arm"
|
||||
|
||||
# GCC Code Warrior
|
||||
GCC_CW_PATH = "C:/Freescale/CW MCU v10.3/Cross_Tools/arm-none-eabi-gcc-4_6_2/bin"
|
||||
EWL_LIB_PATH = "C:/Freescale/CW MCU v10.3/MCU/ARM_GCC_Support/ewl/lib"
|
||||
|
||||
try:
|
||||
# Allow to overwrite the default settings without the need to edit the
|
||||
# settings file stored in the repository
|
||||
|
|
|
@ -22,7 +22,7 @@ class LPC2368(Target):
|
|||
Target.__init__(self)
|
||||
|
||||
self.core = "ARM7TDMI-S"
|
||||
self.vendor = "nxp"
|
||||
self.vendor = "NXP"
|
||||
|
||||
self.supported_toolchains = ["ARM"]
|
||||
|
||||
|
@ -32,7 +32,7 @@ class LPC1768(Target):
|
|||
Target.__init__(self)
|
||||
|
||||
self.core = "Cortex-M3"
|
||||
self.vendor = "nxp"
|
||||
self.vendor = "NXP"
|
||||
|
||||
self.supported_toolchains = ["ARM", "GCC_ARM", "GCC_CS", "GCC_CR", "IAR"]
|
||||
|
||||
|
@ -42,7 +42,7 @@ class LPC11U24(Target):
|
|||
Target.__init__(self)
|
||||
|
||||
self.core = "Cortex-M0"
|
||||
self.vendor = "nxp"
|
||||
self.vendor = "NXP"
|
||||
|
||||
self.supported_toolchains = ["ARM", "uARM"]
|
||||
|
||||
|
@ -52,7 +52,7 @@ class KL25Z(Target):
|
|||
Target.__init__(self)
|
||||
|
||||
self.core = "Cortex-M0+"
|
||||
self.vendor = "freescale"
|
||||
self.vendor = "Freescale"
|
||||
|
||||
self.supported_toolchains = ["ARM", "GCC_CW"]
|
||||
|
||||
|
@ -64,20 +64,30 @@ class LPC812(Target):
|
|||
Target.__init__(self)
|
||||
|
||||
self.core = "Cortex-M0+"
|
||||
self.vendor = "nxp"
|
||||
self.vendor = "NXP"
|
||||
|
||||
self.supported_toolchains = ["uARM"]
|
||||
|
||||
self.program_cycle_s = 4
|
||||
|
||||
|
||||
class MBED_MCU(Target):
|
||||
def __init__(self):
|
||||
Target.__init__(self)
|
||||
|
||||
self.core = "Cortex-M0+"
|
||||
self.vendor = "ARM"
|
||||
|
||||
self.supported_toolchains = ["ARM"]
|
||||
|
||||
# Get a single instance for each target
|
||||
TARGETS = [
|
||||
LPC2368(),
|
||||
LPC1768(),
|
||||
LPC11U24(),
|
||||
KL25Z(),
|
||||
LPC812()
|
||||
LPC812(),
|
||||
MBED_MCU()
|
||||
]
|
||||
|
||||
# Map each target name to its unique instance
|
||||
|
|
|
@ -586,19 +586,30 @@ TESTS = [
|
|||
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'MMA8451Q')],
|
||||
"mcu": ["KL25Z"],
|
||||
},
|
||||
|
||||
# LPC812
|
||||
{
|
||||
"id": "LPC812_1", "description": "LPC812: Blinky",
|
||||
"source_dir": join(TEST_DIR, "lpc812", "blinky"),
|
||||
"dependencies": [MBED_LIBRARIES],
|
||||
"mcu": ["LPC812"],
|
||||
},
|
||||
|
||||
# MBED_MCU
|
||||
{
|
||||
"id": "EXAMPLE_1", "description": "/dev/null",
|
||||
"id": "MBED_MCU_1", "description": "MBED_MCU: BASIC",
|
||||
"source_dir": join(TEST_DIR, "mbed", "mbed_mcu_basic"),
|
||||
"dependencies": [MBED_LIBRARIES],
|
||||
},
|
||||
|
||||
# Examples
|
||||
{
|
||||
"id": "EXAMPLE_1", "description": "Example: /dev/null",
|
||||
"source_dir": join(TEST_DIR, "mbed", "dev_null"),
|
||||
"dependencies": [MBED_LIBRARIES],
|
||||
},
|
||||
{
|
||||
"id": "EXAMPLE_2", "description": "FS + RTOS",
|
||||
"id": "EXAMPLE_2", "description": "Example: FS + RTOS",
|
||||
"source_dir": join(TEST_DIR, "mbed", "fs"),
|
||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB, SD_FS, FAT_FS],
|
||||
}
|
||||
|
|
|
@ -278,16 +278,21 @@ class mbedToolchain:
|
|||
copyfile(source, target)
|
||||
|
||||
def compile_sources(self, resources, build_path, inc_dirs=None):
|
||||
# Web IDE progress bar for project build
|
||||
self.to_be_compiled = len(resources.s_sources) + len(resources.c_sources) + len(resources.cpp_sources)
|
||||
self.compiled = 0
|
||||
|
||||
objects = []
|
||||
inc_paths = resources.inc_dirs
|
||||
if inc_dirs is not None:
|
||||
inc_paths.extend(inc_dirs)
|
||||
|
||||
for source in resources.s_sources:
|
||||
self.compiled += 1
|
||||
_, name, _ = split_path(source)
|
||||
object = join(build_path, name + '.o')
|
||||
if self.need_update(object, [source]):
|
||||
self.progress("assemble", source)
|
||||
self.progress("assemble", source, build_update=True)
|
||||
self.assemble(source, object)
|
||||
objects.append(object)
|
||||
|
||||
|
@ -313,9 +318,13 @@ class mbedToolchain:
|
|||
# Check dependencies
|
||||
base, _ = splitext(object)
|
||||
dep_path = base + '.d'
|
||||
|
||||
self.compiled += 1
|
||||
|
||||
if (not exists(dep_path) or
|
||||
self.need_update(object, self.parse_dependencies(dep_path))):
|
||||
self.progress("compile", source)
|
||||
|
||||
self.progress("compile", source, build_update=True)
|
||||
|
||||
# Compile
|
||||
command = cc + ['-D%s' % s for s in self.symbols] + ["-I%s" % i for i in includes] + ["-o", object, source]
|
||||
|
@ -362,7 +371,7 @@ class mbedToolchain:
|
|||
self.progress("elf2bin", name)
|
||||
self.binary(elf, bin)
|
||||
|
||||
if self.target.vendor == 'nxp':
|
||||
if self.target.vendor == 'NXP':
|
||||
self.debug("LPC Patch %s" % (name + '.bin'))
|
||||
patch(bin)
|
||||
|
||||
|
@ -393,8 +402,11 @@ class mbedToolchain:
|
|||
def cc_info(self, severity, file, line, message):
|
||||
self.notify({'type': 'cc', 'severity': severity, 'file': file, 'line': line, 'message': message})
|
||||
|
||||
def progress(self, action, file):
|
||||
self.notify({'type': 'progress', 'action': action, 'file': file})
|
||||
def progress(self, action, file, build_update=False):
|
||||
msg = {'type': 'progress', 'action': action, 'file': file}
|
||||
if build_update:
|
||||
msg['percent'] = 100. * float(self.compiled) / float(self.to_be_compiled)
|
||||
self.notify(msg)
|
||||
|
||||
def tool_error(self, message):
|
||||
self.notify({'type': 'tool_error', 'message': message})
|
||||
|
@ -424,7 +436,10 @@ class ARM(mbedToolchain):
|
|||
"-Ospace", "--split_sections", "--apcs=interwork",
|
||||
"--brief_diagnostics"
|
||||
]
|
||||
common_c = ["--md", "--no_depend_system_headers"]
|
||||
common_c = [
|
||||
"--md", "--no_depend_system_headers",
|
||||
'-I%s' % ARM_INC
|
||||
]
|
||||
|
||||
self.asm = common
|
||||
self.cc = common + common_c + ["--c99"]
|
||||
|
@ -449,6 +464,11 @@ class ARM(mbedToolchain):
|
|||
for line in open(dep_path).readlines():
|
||||
match = ARM.DEP_PATTERN.match(line)
|
||||
if match is not None:
|
||||
if self.CHROOT:
|
||||
# mbed.org build system: We need to append chroot here,
|
||||
# because when the .d files are generated, armcc is chrooted
|
||||
dependencies.append(self.CHROOT + match.group('file'))
|
||||
else:
|
||||
dependencies.append(match.group('file'))
|
||||
return dependencies
|
||||
|
||||
|
@ -482,6 +502,7 @@ class ARM_STD(ARM):
|
|||
|
||||
def __init__(self, target, notify=None):
|
||||
ARM.__init__(self, target, notify)
|
||||
self.ld.append("--libpath=%s" % ARM_LIB)
|
||||
|
||||
|
||||
class ARM_MICRO(ARM):
|
||||
|
@ -512,6 +533,8 @@ class ARM_MICRO(ARM):
|
|||
|
||||
elif target.core in ["Cortex-M0", "Cortex-M0+"]:
|
||||
self.sys_libs.extend([join(ARM_CPPLIB, lib+".l") for lib in ["cpp_ps", "cpprt_p"]])
|
||||
else:
|
||||
self.ld.append("--libpath=%s" % ARM_LIB)
|
||||
|
||||
|
||||
class GCC(mbedToolchain):
|
||||
|
@ -660,19 +683,17 @@ class GCC_CW(GCC):
|
|||
}
|
||||
|
||||
def __init__(self, target, notify=None):
|
||||
tool_path = join(GCC_CW_PATH, "Cross_Tools/arm-none-eabi-gcc-4_6_2/bin")
|
||||
GCC.__init__(self, target, notify, tool_path)
|
||||
GCC.__init__(self, target, notify, GCC_CW_PATH)
|
||||
|
||||
# Compiler
|
||||
self.cc.append('-mfloat-abi=soft')
|
||||
|
||||
# Linker
|
||||
lib_path = join(GCC_CW_PATH, "MCU/ARM_GCC_Support/ewl/lib", GCC_CW.ARCH_LIB[target.core])
|
||||
self.sys_libs = []
|
||||
self.CIRCULAR_DEPENDENCIES = False
|
||||
self.ld = [join(tool_path, "arm-none-eabi-g++"),
|
||||
self.ld = [join(GCC_CW_PATH, "arm-none-eabi-g++"),
|
||||
"-Xlinker", "--gc-sections",
|
||||
"-L%s" % lib_path,
|
||||
"-L%s" % join(EWL_LIB_PATH, GCC_CW.ARCH_LIB[target.core]),
|
||||
"-n", "-specs=ewl_c++.specs", "-mfloat-abi=soft",
|
||||
"-Xlinker", "--undefined=__pformatter_", "-Xlinker", "--defsym=__pformatter=__pformatter_",
|
||||
"-Xlinker", "--undefined=__sformatter", "-Xlinker", "--defsym=__sformatter=__sformatter",
|
||||
|
|
Loading…
Reference in New Issue