mirror of https://github.com/ARMmbed/mbed-os.git
IAR debugging and docstrings
parent
ce1939b74f
commit
b074ee14c2
|
@ -9,16 +9,23 @@ import sys
|
||||||
from tools.targets import TARGET_MAP
|
from tools.targets import TARGET_MAP
|
||||||
from tools.export.exporters import Exporter, FailedBuildException
|
from tools.export.exporters import Exporter, FailedBuildException
|
||||||
import json
|
import json
|
||||||
|
from tools.export.cmsis import DeviceCMSIS
|
||||||
|
|
||||||
class IAR(Exporter):
|
class IAR(Exporter):
|
||||||
NAME = 'iar'
|
NAME = 'iar'
|
||||||
TOOLCHAIN = 'IAR'
|
TOOLCHAIN = 'IAR'
|
||||||
|
|
||||||
|
#iar_definitions.json location
|
||||||
def_loc = os.path.join(
|
def_loc = os.path.join(
|
||||||
os.path.dirname(os.path.abspath(__file__)), '..', '..', '..',
|
os.path.dirname(os.path.abspath(__file__)), '..', '..', '..',
|
||||||
'tools','export', 'iar', 'iar_definitions.json')
|
'tools','export', 'iar', 'iar_definitions.json')
|
||||||
|
|
||||||
|
#create a dictionary of the definitions
|
||||||
with open(def_loc, 'r') as f:
|
with open(def_loc, 'r') as f:
|
||||||
IAR_DEFS = json.load(f)
|
IAR_DEFS = json.load(f)
|
||||||
|
|
||||||
|
#supported targets have a device name and corresponding definition in
|
||||||
|
#iar_definitions.json
|
||||||
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
|
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
|
||||||
if hasattr(obj, 'device_name') and
|
if hasattr(obj, 'device_name') and
|
||||||
obj.device_name in IAR_DEFS.keys()]
|
obj.device_name in IAR_DEFS.keys()]
|
||||||
|
@ -52,6 +59,7 @@ class IAR(Exporter):
|
||||||
return groups
|
return groups
|
||||||
|
|
||||||
def iar_device(self):
|
def iar_device(self):
|
||||||
|
"""Retrieve info from iar_definitions.json"""
|
||||||
device_name = TARGET_MAP[self.target].device_name
|
device_name = TARGET_MAP[self.target].device_name
|
||||||
device_info = self.IAR_DEFS[device_name]
|
device_info = self.IAR_DEFS[device_name]
|
||||||
iar_defaults ={
|
iar_defaults ={
|
||||||
|
@ -67,9 +75,11 @@ class IAR(Exporter):
|
||||||
return IARdevice(**iar_defaults)
|
return IARdevice(**iar_defaults)
|
||||||
|
|
||||||
def format_file(self, file):
|
def format_file(self, file):
|
||||||
|
"""Make IAR compatible path"""
|
||||||
return join('$PROJ_DIR$',file)
|
return join('$PROJ_DIR$',file)
|
||||||
|
|
||||||
def format_src(self, srcs):
|
def format_src(self, srcs):
|
||||||
|
"""Group source files"""
|
||||||
grouped = self.group_project_files(srcs)
|
grouped = self.group_project_files(srcs)
|
||||||
for group, files in grouped.items():
|
for group, files in grouped.items():
|
||||||
grouped[group] = [self.format_file(src) for src in files]
|
grouped[group] = [self.format_file(src) for src in files]
|
||||||
|
@ -79,8 +89,7 @@ class IAR(Exporter):
|
||||||
return self.SPECIAL_TEMPLATES.get(self.target.lower(), 'iar/ewp.tmpl')
|
return self.SPECIAL_TEMPLATES.get(self.target.lower(), 'iar/ewp.tmpl')
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
"""Generate the .ww and .ewp files"""
|
"""Generate the .eww, .ewd, and .ewp files"""
|
||||||
|
|
||||||
srcs = self.resources.headers + self.resources.s_sources + \
|
srcs = self.resources.headers + self.resources.s_sources + \
|
||||||
self.resources.c_sources + self.resources.cpp_sources + \
|
self.resources.c_sources + self.resources.cpp_sources + \
|
||||||
self.resources.objects + self.resources.libraries
|
self.resources.objects + self.resources.libraries
|
||||||
|
@ -95,11 +104,13 @@ class IAR(Exporter):
|
||||||
'linker_script': self.format_file(self.resources.linker_script),
|
'linker_script': self.format_file(self.resources.linker_script),
|
||||||
'include_paths': [self.format_file(src) for src in self.resources.inc_dirs],
|
'include_paths': [self.format_file(src) for src in self.resources.inc_dirs],
|
||||||
'device': self.iar_device(),
|
'device': self.iar_device(),
|
||||||
'ewp': sep+self.project_name + ".ewp"
|
'ewp': sep+self.project_name + ".ewp",
|
||||||
|
'debugger': DeviceCMSIS(self.target).debug_interface.replace('-','').upper()
|
||||||
}
|
}
|
||||||
ctx.update(flags)
|
ctx.update(flags)
|
||||||
|
|
||||||
self.gen_file('iar/eww.tmpl', ctx, self.project_name+".eww")
|
self.gen_file('iar/eww.tmpl', ctx, self.project_name+".eww")
|
||||||
|
self.gen_file('iar/ewd.tmpl', ctx, self.project_name + ".ewd")
|
||||||
self.gen_file(self.get_ewp_template(), ctx, self.project_name + ".ewp")
|
self.gen_file(self.get_ewp_template(), ctx, self.project_name + ".ewp")
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@
|
||||||
<toolchain>
|
<toolchain>
|
||||||
<name>ARM</name>
|
<name>ARM</name>
|
||||||
</toolchain>
|
</toolchain>
|
||||||
<debug>0</debug>
|
<debug>1</debug>
|
||||||
<settings>
|
<settings>
|
||||||
<name>General</name>
|
<name>General</name>
|
||||||
<archiveVersion>3</archiveVersion>
|
<archiveVersion>3</archiveVersion>
|
||||||
|
|
Loading…
Reference in New Issue