Skip to content

Commit 43ace93

Browse files
committed
removed KL05Z hw tests + mv KL05Z to TARGET_Freescale
1 parent 551f06b commit 43ace93

File tree

33 files changed

+135
-191
lines changed

33 files changed

+135
-191
lines changed

libraries/tests/KL05Z/lptmr/main.cpp

Lines changed: 0 additions & 46 deletions
This file was deleted.

libraries/tests/KL05Z/pit/main.cpp

Lines changed: 0 additions & 48 deletions
This file was deleted.

libraries/tests/KL05Z/rtc/main.cpp

Lines changed: 0 additions & 72 deletions
This file was deleted.

workspace_tools/targets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ def __init__(self):
6666
Target.__init__(self)
6767

6868
self.core = "Cortex-M0+"
69+
70+
self.extra_labels = ['Freescale']
6971

7072
self.supported_toolchains = ["ARM"]
7173

workspace_tools/tests.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -623,31 +623,6 @@
623623
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'MMA8451Q')],
624624
"mcu": ["KL25Z"],
625625
},
626-
627-
# KL05Z
628-
{
629-
"id": "KL05Z_1", "description": "KL05Z: LPTMR",
630-
"source_dir": join(TEST_DIR, "KL05Z", "lptmr"),
631-
"dependencies": [MBED_LIBRARIES],
632-
"supported": CORTEX_ARM_SUPPORT,
633-
"mcu": ["KL05Z"],
634-
},
635-
{
636-
"id": "KL05Z_2", "description": "KL05Z: PIT",
637-
"source_dir": join(TEST_DIR, "KL05Z", "pit"),
638-
"dependencies": [MBED_LIBRARIES],
639-
"supported": CORTEX_ARM_SUPPORT,
640-
"mcu": ["KL05Z"],
641-
},
642-
643-
{
644-
"id": "KL05Z_4", "description": "KL05Z: RTC",
645-
"source_dir": join(TEST_DIR, "KL05Z", "rtc"),
646-
"dependencies": [MBED_LIBRARIES],
647-
"mcu": ["KL05Z"],
648-
},
649-
650-
651626

652627
# Examples
653628
{
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import re
2+
from os.path import join
3+
4+
from workspace_tools.toolchains import mbedToolchain
5+
from workspace_tools.settings import ARM_BIN, ARM_INC, ARM_LIB, MY_ARM_CLIB, ARM_CPPLIB
6+
7+
8+
class ARM(mbedToolchain):
9+
LINKER_EXT = '.sct'
10+
LIBRARY_EXT = '.ar'
11+
12+
STD_LIB_NAME = "%s.ar"
13+
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+): (?P<severity>Warning|Error): (?P<message>.+)')
14+
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
15+
16+
def __init__(self, target, options=None, notify=None):
17+
mbedToolchain.__init__(self, target, options, notify)
18+
19+
if target.core == "Cortex-M0+":
20+
cpu = "Cortex-M0"
21+
elif target.core == "Cortex-M4":
22+
cpu = "Cortex-M4.fp"
23+
else:
24+
cpu = target.core
25+
26+
common = [join(ARM_BIN, "armcc"), "-c",
27+
"--cpu=%s" % cpu, "--gnu",
28+
"-Ospace", "--split_sections", "--apcs=interwork",
29+
"--brief_diagnostics", "--restrict"
30+
]
31+
32+
if "save-asm" in self.options:
33+
common.extend(["--asm", "--interleave"])
34+
<<<<<<< HEAD
35+
elif "debug-info" in self.options:
36+
common.extend(["--debug"])
37+
=======
38+
39+
if "debug-info" in self.options:
40+
common.append("-g")
41+
>>>>>>> master
42+
43+
common_c = [
44+
"--md", "--no_depend_system_headers",
45+
'-I%s' % ARM_INC
46+
]
47+
48+
self.asm = common
49+
self.cc = common + common_c + ["--c99"]
50+
self.cppc = common + common_c + ["--cpp", "--no_rtti"]
51+
52+
self.ld = [join(ARM_BIN, "armlink")]
53+
self.sys_libs = []
54+
55+
self.ar = join(ARM_BIN, "armar")
56+
self.elf2bin = join(ARM_BIN, "fromelf")
57+
58+
def remove_option(self, option):
59+
for tool in [self.asm, self.cc, self.cppc]:
60+
if option in tool:
61+
tool.remove(option)
62+
63+
def assemble(self, source, object):
64+
self.default_cmd(self.cc + ["-o", object, source])
65+
66+
def parse_dependencies(self, dep_path):
67+
dependencies = []
68+
for line in open(dep_path).readlines():
69+
match = ARM.DEP_PATTERN.match(line)
70+
if match is not None:
71+
dependencies.append(match.group('file'))
72+
return dependencies
73+
74+
def parse_output(self, output):
75+
for line in output.splitlines():
76+
match = ARM.DIAGNOSTIC_PATTERN.match(line)
77+
if match is not None:
78+
self.cc_info(
79+
match.group('severity').lower(),
80+
match.group('file'),
81+
match.group('line'),
82+
match.group('message')
83+
)
84+
85+
def archive(self, objects, lib_path):
86+
self.default_cmd([self.ar, '-r', lib_path] + objects)
87+
88+
def link(self, output, objects, libraries, lib_dirs, mem_map):
89+
args = ["-o", output, "--userlibpath", ",".join(lib_dirs), "--info=totals", "--list=.link_totals.txt"]
90+
if mem_map:
91+
args.extend(["--scatter", mem_map])
92+
93+
self.default_cmd(self.ld + args + objects + libraries + self.sys_libs)
94+
95+
def binary(self, elf, bin):
96+
self.default_cmd([self.elf2bin, '--bin', '-o', bin, elf])
97+
98+
99+
class ARM_STD(ARM):
100+
def __init__(self, target, options=None, notify=None):
101+
ARM.__init__(self, target, options, notify)
102+
self.ld.append("--libpath=%s" % ARM_LIB)
103+
104+
105+
class ARM_MICRO(ARM):
106+
PATCHED_LIBRARY = True
107+
108+
def __init__(self, target, options=None, notify=None):
109+
ARM.__init__(self, target, notify)
110+
111+
# Compiler
112+
self.asm += ["-D__MICROLIB"]
113+
self.cc += ["--library_type=microlib", "-D__MICROLIB"]
114+
self.cppc += ["--library_type=microlib", "-D__MICROLIB"]
115+
116+
# Linker
117+
self.ld.append("--library_type=microlib")
118+
119+
# We had to patch microlib to add C++ support
120+
# In later releases this patch should have entered mainline
121+
if ARM_MICRO.PATCHED_LIBRARY:
122+
self.ld.append("--noscanlib")
123+
124+
# System Libraries
125+
self.sys_libs.extend([join(MY_ARM_CLIB, lib+".l") for lib in ["mc_p", "mf_p", "m_ps"]])
126+
127+
if target.core == "Cortex-M3":
128+
self.sys_libs.extend([join(ARM_CPPLIB, lib+".l") for lib in ["cpp_ws", "cpprt_w"]])
129+
130+
elif target.core in ["Cortex-M0", "Cortex-M0+"]:
131+
self.sys_libs.extend([join(ARM_CPPLIB, lib+".l") for lib in ["cpp_ps", "cpprt_p"]])
132+
else:
133+
self.ld.append("--libpath=%s" % ARM_LIB)

0 commit comments

Comments
 (0)