2013-08-06 13:38:00 +00:00
|
|
|
"""
|
|
|
|
mbed SDK
|
|
|
|
Copyright (c) 2011-2013 ARM Limited
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
"""
|
|
|
|
|
2013-06-24 13:32:08 +00:00
|
|
|
CORE_LABELS = {
|
|
|
|
"ARM7TDMI-S": "ARM7",
|
|
|
|
"Cortex-M0" : "M0",
|
|
|
|
"Cortex-M0+": "M0P",
|
|
|
|
"Cortex-M3" : "M3",
|
2013-11-27 20:02:37 +00:00
|
|
|
"Cortex-M4" : "M4",
|
2013-12-06 14:19:56 +00:00
|
|
|
"Cortex-M4F" : "M4"
|
2013-06-24 13:32:08 +00:00
|
|
|
}
|
|
|
|
|
2013-08-30 09:19:08 +00:00
|
|
|
import os
|
|
|
|
import shutil
|
2013-04-18 14:43:29 +00:00
|
|
|
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
class Target:
|
|
|
|
def __init__(self):
|
|
|
|
# ARM Core
|
|
|
|
self.core = None
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-25 16:55:52 +00:00
|
|
|
# Is the disk provided by the interface chip of this board virtual?
|
|
|
|
self.is_disk_virtual = False
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
# list of toolchains that are supported by the mbed SDK for this target
|
|
|
|
self.supported_toolchains = None
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-06-24 13:32:08 +00:00
|
|
|
# list of extra specific labels
|
|
|
|
self.extra_labels = []
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
self.name = self.__class__.__name__
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-25 16:55:52 +00:00
|
|
|
def program_cycle_s(self):
|
|
|
|
return 4 if self.is_disk_virtual else 1.5
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-06-24 13:32:08 +00:00
|
|
|
def get_labels(self):
|
|
|
|
return [self.name, CORE_LABELS[self.core]] + self.extra_labels
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2013-08-30 09:19:08 +00:00
|
|
|
def init_hooks(self, hook, toolchain_name):
|
|
|
|
pass
|
2013-04-18 14:43:29 +00:00
|
|
|
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
class LPC2368(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
self.core = "ARM7TDMI-S"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-03 16:14:43 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC23XX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-08-31 04:33:34 +00:00
|
|
|
self.supported_toolchains = ["ARM","GCC_ARM","GCC_CR"]
|
2013-04-18 14:43:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LPC1768(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
self.core = "Cortex-M3"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2014-01-29 02:44:32 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC176X', 'MBED_LPC1768']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-25 16:55:52 +00:00
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM", "GCC_CS", "GCC_CR", "IAR"]
|
2013-04-18 14:43:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LPC11U24(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
self.core = "Cortex-M0"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
|
|
|
self.extra_labels = ['NXP', 'LPC11UXX', 'LPC11U24_401']
|
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
2013-04-18 14:43:29 +00:00
|
|
|
|
|
|
|
|
2013-08-09 16:21:03 +00:00
|
|
|
class LPC11U24_301(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M0"
|
|
|
|
|
|
|
|
self.extra_labels = ['NXP', 'LPC11UXX']
|
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
|
|
|
|
|
|
|
|
2013-06-23 16:22:46 +00:00
|
|
|
class KL05Z(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-06-23 16:22:46 +00:00
|
|
|
self.core = "Cortex-M0+"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2014-01-28 17:57:07 +00:00
|
|
|
self.extra_labels = ['Freescale', 'KLXX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2014-02-18 04:12:16 +00:00
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-25 16:55:52 +00:00
|
|
|
self.is_disk_virtual = True
|
2013-06-23 16:22:46 +00:00
|
|
|
|
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
class KL25Z(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
self.core = "Cortex-M0+"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2014-01-28 17:57:07 +00:00
|
|
|
self.extra_labels = ['Freescale', 'KLXX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-08-02 05:14:36 +00:00
|
|
|
self.supported_toolchains = ["ARM", "GCC_CW_EWL", "GCC_CW_NEWLIB", "GCC_ARM"]
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-25 16:55:52 +00:00
|
|
|
self.is_disk_virtual = True
|
2013-04-18 14:43:29 +00:00
|
|
|
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2013-09-24 14:01:06 +00:00
|
|
|
class KL46Z(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M0+"
|
|
|
|
|
2014-01-28 17:57:07 +00:00
|
|
|
self.extra_labels = ['Freescale', 'KLXX']
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2013-09-29 18:40:06 +00:00
|
|
|
self.supported_toolchains = ["GCC_ARM", "ARM"]
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2013-09-24 14:01:06 +00:00
|
|
|
self.is_disk_virtual = True
|
|
|
|
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2013-09-24 14:36:04 +00:00
|
|
|
class K20D5M(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M4"
|
|
|
|
|
|
|
|
self.extra_labels = ['Freescale']
|
|
|
|
|
2013-11-19 19:06:26 +00:00
|
|
|
self.supported_toolchains = ["GCC_ARM", "ARM"]
|
2013-09-24 14:36:04 +00:00
|
|
|
|
|
|
|
self.is_disk_virtual = True
|
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
|
|
|
|
class LPC812(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
self.core = "Cortex-M0+"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-11-11 11:28:18 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC81X']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
self.supported_toolchains = ["uARM"]
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-25 16:55:52 +00:00
|
|
|
self.is_disk_virtual = True
|
2013-04-18 14:43:29 +00:00
|
|
|
|
|
|
|
|
2013-08-24 06:49:16 +00:00
|
|
|
class LPC810(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
|
|
|
|
2013-08-24 06:49:16 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M0+"
|
|
|
|
|
2013-11-11 11:28:18 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC81X']
|
2013-08-24 06:49:16 +00:00
|
|
|
|
|
|
|
self.supported_toolchains = ["uARM"]
|
|
|
|
|
|
|
|
self.is_disk_virtual = True
|
|
|
|
|
|
|
|
|
2013-05-16 06:53:02 +00:00
|
|
|
class LPC4088(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-11-27 20:02:37 +00:00
|
|
|
self.core = "Cortex-M4F"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-03 16:14:43 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC408X']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-10-31 12:25:58 +00:00
|
|
|
self.supported_toolchains = ["ARM", "GCC_CR", "GCC_ARM"]
|
2014-02-07 17:57:35 +00:00
|
|
|
|
|
|
|
self.is_disk_virtual = True
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-08-30 09:19:08 +00:00
|
|
|
def init_hooks(self, hook, toolchain_name):
|
|
|
|
if toolchain_name in ['ARM_STD', 'ARM_MICRO']:
|
|
|
|
hook.hook_add_binary("post", self.binary_hook)
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2013-08-30 09:19:08 +00:00
|
|
|
@staticmethod
|
2014-02-11 10:50:16 +00:00
|
|
|
def binary_hook(t_self, resources, elf, binf):
|
2013-08-30 09:19:08 +00:00
|
|
|
if not os.path.isdir(binf):
|
|
|
|
# Regular binary file, nothing to do
|
|
|
|
return
|
|
|
|
outbin = open(binf + ".temp", "wb")
|
|
|
|
partf = open(os.path.join(binf, "ER_IROM1"), "rb")
|
|
|
|
# Pad the fist part (internal flash) with 0xFF to 512k
|
|
|
|
data = partf.read()
|
|
|
|
outbin.write(data)
|
|
|
|
outbin.write('\xFF' * (512*1024 - len(data)))
|
|
|
|
partf.close()
|
|
|
|
# Read and append the second part (external flash) in chunks of fixed size
|
|
|
|
chunksize = 128 * 1024
|
|
|
|
partf = open(os.path.join(binf, "ER_IROM2"), "rb")
|
|
|
|
while True:
|
|
|
|
data = partf.read(chunksize)
|
|
|
|
outbin.write(data)
|
|
|
|
if len(data) < chunksize:
|
|
|
|
break
|
|
|
|
partf.close()
|
|
|
|
outbin.close()
|
|
|
|
# Remove the directory with the binary parts and rename the temporary
|
|
|
|
# file to 'binf'
|
|
|
|
shutil.rmtree(binf, True)
|
|
|
|
os.rename(binf + '.temp', binf)
|
|
|
|
t_self.debug("Generated custom binary file (internal flash + SPIFI)")
|
2013-06-24 13:32:08 +00:00
|
|
|
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
class LPC4330_M4(Target):
|
2013-06-19 12:10:44 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-11-27 20:02:37 +00:00
|
|
|
self.core = "Cortex-M4F"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-03 16:14:43 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC43XX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-11-20 01:51:27 +00:00
|
|
|
self.supported_toolchains = ["ARM", "GCC_CR", "IAR", "GCC_ARM"]
|
2013-06-23 16:22:46 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
|
|
|
|
class LPC4330_M0(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
self.core = "Cortex-M0"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC43XX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
self.supported_toolchains = ["ARM", "GCC_CR", "IAR"]
|
|
|
|
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
class LPC1800(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
self.core = "Cortex-M3"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC43XX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-08 03:27:11 +00:00
|
|
|
self.supported_toolchains = ["ARM", "GCC_CR", "IAR"]
|
|
|
|
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-06-26 12:34:34 +00:00
|
|
|
class STM32F407(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-11-27 20:02:37 +00:00
|
|
|
self.core = "Cortex-M4F"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-03 16:14:43 +00:00
|
|
|
self.extra_labels = ['STM', 'STM32F4XX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-29 16:03:19 +00:00
|
|
|
self.supported_toolchains = ["ARM", "GCC_ARM"]
|
2013-05-16 06:53:02 +00:00
|
|
|
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2013-11-14 10:07:01 +00:00
|
|
|
class NUCLEO_F103RB(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
2014-02-10 15:21:57 +00:00
|
|
|
OUTPUT_NAMING = "8.3"
|
|
|
|
|
2013-11-14 10:07:01 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M3"
|
|
|
|
|
2014-01-10 16:46:18 +00:00
|
|
|
self.extra_labels = ['STM', 'STM32F1', 'STM32F103RB']
|
2013-11-14 10:07:01 +00:00
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
2014-02-07 17:57:35 +00:00
|
|
|
|
|
|
|
|
2014-01-10 16:46:18 +00:00
|
|
|
class NUCLEO_L152RE(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
2014-02-10 15:21:57 +00:00
|
|
|
OUTPUT_NAMING = "8.3"
|
|
|
|
|
2014-01-10 16:46:18 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M3"
|
|
|
|
|
|
|
|
self.extra_labels = ['STM', 'STM32L1', 'STM32L152RE']
|
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
2013-06-23 16:22:46 +00:00
|
|
|
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-01-10 16:46:18 +00:00
|
|
|
class NUCLEO_F401RE(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
2014-02-10 15:21:57 +00:00
|
|
|
OUTPUT_NAMING = "8.3"
|
|
|
|
|
2014-01-10 16:46:18 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M4"
|
|
|
|
|
|
|
|
self.extra_labels = ['STM', 'STM32F4', 'STM32F401RE']
|
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
|
|
|
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-01-10 16:46:18 +00:00
|
|
|
class NUCLEO_F030R8(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
2014-02-10 15:21:57 +00:00
|
|
|
OUTPUT_NAMING = "8.3"
|
|
|
|
|
2014-01-10 16:46:18 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M0"
|
|
|
|
|
|
|
|
self.extra_labels = ['STM', 'STM32F0', 'STM32F030R8']
|
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
2013-04-26 16:34:42 +00:00
|
|
|
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-17 13:11:54 +00:00
|
|
|
class LPC1347(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-17 13:11:54 +00:00
|
|
|
self.core = "Cortex-M3"
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-17 13:11:54 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC13XX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-17 13:11:54 +00:00
|
|
|
self.supported_toolchains = ["ARM", "GCC_ARM"]
|
2013-06-24 13:32:08 +00:00
|
|
|
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-07-19 10:24:51 +00:00
|
|
|
class LPC1114(Target):
|
2014-02-12 11:41:02 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
|
|
|
|
2013-08-09 16:18:50 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M0"
|
|
|
|
|
2013-09-23 09:09:33 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC11XX_11CXX', 'LPC11XX']
|
2013-08-09 16:18:50 +00:00
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
|
|
|
|
2013-07-27 17:12:35 +00:00
|
|
|
|
|
|
|
class LPC11C24(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M0"
|
|
|
|
|
2013-09-23 09:09:33 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC11XX_11CXX', 'LPC11CXX']
|
2013-07-27 17:12:35 +00:00
|
|
|
|
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-08-27 12:19:01 +00:00
|
|
|
class LPC11U35_401(Target):
|
2014-02-12 16:55:06 +00:00
|
|
|
ONLINE_TOOLCHAIN = "uARM"
|
|
|
|
|
2013-08-27 12:19:01 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-08-27 12:19:01 +00:00
|
|
|
self.core = "Cortex-M0"
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-08-27 12:19:01 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC11UXX']
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-08-27 12:19:01 +00:00
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
|
2013-08-09 16:18:50 +00:00
|
|
|
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2014-02-07 11:43:25 +00:00
|
|
|
class UBLOX_C027(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M3"
|
|
|
|
|
2014-02-12 14:03:44 +00:00
|
|
|
self.extra_labels = ['NXP', 'LPC176X']
|
2014-02-07 11:43:25 +00:00
|
|
|
|
2014-02-12 11:41:02 +00:00
|
|
|
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM", "GCC_CS", "GCC_CR", "IAR"]
|
2014-02-07 11:43:25 +00:00
|
|
|
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-02-03 16:02:28 +00:00
|
|
|
class NRF51822(Target):
|
2014-01-14 17:15:31 +00:00
|
|
|
EXPECTED_SOFTDEVICE = 's110_nrf51822_6.0.0_softdevice.hex'
|
2014-02-20 11:44:30 +00:00
|
|
|
|
2014-01-22 18:14:04 +00:00
|
|
|
APPCODE_OFFSET = 0x14000
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-02-20 11:44:30 +00:00
|
|
|
UICR_START = 0x10001000
|
|
|
|
UICR_END = 0x10001013
|
|
|
|
|
2013-11-11 13:13:27 +00:00
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-11-11 13:13:27 +00:00
|
|
|
self.core = "Cortex-M0"
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-11-11 13:13:27 +00:00
|
|
|
self.extra_labels = ["NORDIC"]
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-11-11 13:13:27 +00:00
|
|
|
self.supported_toolchains = ["ARM"]
|
2014-02-20 11:44:30 +00:00
|
|
|
|
|
|
|
self.is_disk_virtual = True
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-01-14 17:15:31 +00:00
|
|
|
def init_hooks(self, hook, toolchain_name):
|
|
|
|
if toolchain_name in ['ARM_STD', 'ARM_MICRO']:
|
|
|
|
hook.hook_add_binary("post", self.binary_hook)
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-01-14 17:15:31 +00:00
|
|
|
@staticmethod
|
2014-02-11 10:50:16 +00:00
|
|
|
def binary_hook(t_self, resources, elf, binf):
|
|
|
|
for hexf in resources.hex_files:
|
2014-02-03 16:02:28 +00:00
|
|
|
if hexf.find(NRF51822.EXPECTED_SOFTDEVICE) != -1:
|
2014-01-14 17:15:31 +00:00
|
|
|
break
|
|
|
|
else:
|
2014-02-07 10:08:58 +00:00
|
|
|
t_self.debug("Hex file not found. Aborting.")
|
2014-01-14 17:15:31 +00:00
|
|
|
return
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-02-21 15:05:21 +00:00
|
|
|
# Merge user code with softdevice
|
2014-01-14 17:15:31 +00:00
|
|
|
from intelhex import IntelHex
|
|
|
|
binh = IntelHex()
|
2014-02-03 16:02:28 +00:00
|
|
|
binh.loadbin(binf, offset = NRF51822.APPCODE_OFFSET)
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-01-14 17:15:31 +00:00
|
|
|
sdh = IntelHex(hexf)
|
|
|
|
sdh.merge(binh)
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-02-20 11:44:30 +00:00
|
|
|
# Remove UICR section
|
|
|
|
del sdh[NRF51822.UICR_START:NRF51822.UICR_END+1]
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-02-20 18:33:24 +00:00
|
|
|
with open(binf, "wb") as f:
|
2014-02-20 11:44:30 +00:00
|
|
|
sdh.tofile(f, format = 'bin')
|
2014-02-21 15:05:21 +00:00
|
|
|
|
|
|
|
#with open(binf.replace(".bin", ".hex"), "w") as f:
|
|
|
|
# sdh.tofile(f, format = 'hex')
|
2014-02-07 17:57:35 +00:00
|
|
|
|
2014-02-11 06:54:38 +00:00
|
|
|
class LPC1549(Target):
|
|
|
|
def __init__(self):
|
|
|
|
Target.__init__(self)
|
|
|
|
|
|
|
|
self.core = "Cortex-M3"
|
|
|
|
|
|
|
|
self.extra_labels = ['NXP', 'LPC15XX']
|
|
|
|
|
|
|
|
self.supported_toolchains = ["uARM"]
|
2013-11-25 16:32:46 +00:00
|
|
|
|
2013-04-18 14:43:29 +00:00
|
|
|
# Get a single instance for each target
|
|
|
|
TARGETS = [
|
|
|
|
LPC2368(),
|
|
|
|
LPC1768(),
|
|
|
|
LPC11U24(),
|
2013-08-09 16:18:50 +00:00
|
|
|
LPC11U24_301(),
|
2013-06-23 16:22:46 +00:00
|
|
|
KL05Z(),
|
2013-04-18 14:43:29 +00:00
|
|
|
KL25Z(),
|
2013-09-24 14:01:06 +00:00
|
|
|
KL46Z(),
|
2013-09-24 14:36:04 +00:00
|
|
|
K20D5M(),
|
2013-04-26 16:34:42 +00:00
|
|
|
LPC812(),
|
2013-08-24 06:49:16 +00:00
|
|
|
LPC810(),
|
2013-05-16 06:53:02 +00:00
|
|
|
LPC4088(),
|
2013-07-08 14:58:15 +00:00
|
|
|
LPC4330_M4(),
|
2013-06-19 12:10:44 +00:00
|
|
|
STM32F407(),
|
2013-11-14 10:07:01 +00:00
|
|
|
NUCLEO_F103RB(),
|
2014-01-10 16:46:18 +00:00
|
|
|
NUCLEO_L152RE(),
|
|
|
|
NUCLEO_F401RE(),
|
|
|
|
NUCLEO_F030R8(),
|
2013-07-19 10:24:51 +00:00
|
|
|
LPC1347(),
|
2013-08-09 16:18:50 +00:00
|
|
|
LPC1114(),
|
2013-08-27 12:19:01 +00:00
|
|
|
LPC11C24(),
|
2013-08-30 09:19:08 +00:00
|
|
|
LPC11U35_401(),
|
2014-01-31 16:57:43 +00:00
|
|
|
NRF51822(),
|
2014-02-11 06:54:38 +00:00
|
|
|
UBLOX_C027(),
|
|
|
|
LPC1549()
|
2013-04-18 14:43:29 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
# Map each target name to its unique instance
|
|
|
|
TARGET_MAP = {}
|
|
|
|
for t in TARGETS:
|
|
|
|
TARGET_MAP[t.name] = t
|
|
|
|
|
|
|
|
TARGET_NAMES = TARGET_MAP.keys()
|
2013-11-18 18:24:51 +00:00
|
|
|
|
|
|
|
# Some targets with different name have the same exporters
|
2013-11-25 16:32:46 +00:00
|
|
|
EXPORT_MAP = {}
|