Add STM32 to the buildchain

pull/8/head
Joe Turner 2013-04-24 09:35:11 +01:00
parent d18875bee3
commit 40abe5fb74
5 changed files with 28 additions and 4 deletions

View File

@ -144,6 +144,8 @@ CHIP_VENDOR = {
"LPC812" : "nxp",
"KL25Z" : "freescale",
"STM32F407": "stm",
}
def build_mbed_libs(target, toolchain, verbose=False):

View File

@ -4,10 +4,11 @@ DEFAULT_SUPPORT = {
"LPC2368" : ["ARM"],
"KL25Z" : ["ARM", "GCC_CW"],
"LPC812" : ["uARM"],
"STM32F407" : ["GCC_ARM"]
}
CORTEX_ARM_SUPPORT = {
"LPC1768" : ["ARM"],
"LPC11U24": ["ARM", "uARM"],
"KL25Z" : ["ARM"],
"LPC812" : ["uARM"],
}
}

View File

@ -34,6 +34,22 @@ LIBRARIES = [
"dependencies": [MBED_LIBRARIES],
"supported": DEFAULT_SUPPORT
},
# STM
{
"id": "stm_cmsis",
"source_dir": join(STM, "cmsis"),
"build_dir": MBED_LIBRARIES,
"supported": DEFAULT_SUPPORT
},
{
"id": "stm_mbed",
"name": "mbed",
"source_dir": [join(STM, "capi"), MBED_CAPI, MBED_CPP],
"build_dir": MBED_LIBRARIES,
"dependencies": [MBED_LIBRARIES],
"supported": DEFAULT_SUPPORT
},
# RTOS libraries
{

View File

@ -19,6 +19,7 @@ MBED_RPC = join(MBED_BASE, "rpc")
VENDOR = join(MBED_BASE, "vendor")
NXP = join(VENDOR, "NXP")
FREESCALE = join(VENDOR, "Freescale")
STM = join(VENDOR, "STM")
MBED_LIBRARIES = join(BUILD_DIR, "mbed")

View File

@ -24,7 +24,7 @@ type directory, because it would get confused with the legacy "ARM" toolchain.
* ARM -> ARM_STD
* uARM -> ARM_MICRO
"""
TARGETS = set(['LPC1768', 'LPC11U24', 'LPC2368', 'KL25Z', 'LPC812'])
TARGETS = set(['LPC1768', 'LPC11U24', 'LPC2368', 'KL25Z', 'LPC812', "STM32F407"])
TOOLCHAINS = set(['ARM', 'uARM', 'GCC_ARM', 'GCC_CS', 'GCC_CR', 'GCC_CW', 'IAR'])
TYPES = set(['GCC'])
@ -130,6 +130,7 @@ class mbedToolchain:
"LPC11U24": ["__CORTEX_M0", "ARM_MATH_CM0"],
"KL25Z" : ["__CORTEX_M0", "ARM_MATH_CM0"],
"LPC812" : ["__CORTEX_M0", "ARM_MATH_CM0"],
"STM32F407" : ["__CORTEX_M4", "ARM_MATH_CM4"],
}
def __init__(self, target, notify=None):
@ -325,6 +326,8 @@ class mbedToolchain:
if hasattr(self, "cc_extra"):
command.extend(self.cc_extra(base))
print " ".join(command)
self.debug(command)
_, stderr, rc = run_cmd(command, dirname(object), chroot=self.CHROOT)
@ -524,6 +527,7 @@ class GCC(mbedToolchain):
"LPC11U24": "cortex-m0",
"KL25Z": "cortex-m0",
"LPC812" : "cortex-m0",
"STM32F407" : "cortex-m4",
}
STD_LIB_NAME = "lib%s.a"
@ -534,7 +538,7 @@ class GCC(mbedToolchain):
mbedToolchain.__init__(self, target, notify)
self.IGNORE_DIR.remove('GCC')
self.cpu = ["-mcpu=%s" % GCC.CPU[target]]
if target in ["LPC1768", "LPC11U24", "KL25Z", "LPC812"]:
if target in ["LPC1768", "LPC11U24", "KL25Z", "LPC812", "STM32F407"]:
self.cpu.append("-mthumb")
# Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
@ -627,7 +631,7 @@ class GCC_ARM(GCC):
# Use latest gcc nanolib
self.ld.append("--specs=nano.specs")
if target in ["LPC1768"]:
if target in ["LPC1768", "STM32F407"]:
self.ld.extend(["-u", "_printf_float", "-u", "_scanf_float"])
self.sys_libs.append("nosys")