diff --git a/tools/export/iar/__init__.py b/tools/export/iar/__init__.py index 2702b5d358..067de8a234 100644 --- a/tools/export/iar/__init__.py +++ b/tools/export/iar/__init__.py @@ -9,16 +9,23 @@ import sys from tools.targets import TARGET_MAP from tools.export.exporters import Exporter, FailedBuildException import json +from tools.export.cmsis import DeviceCMSIS + class IAR(Exporter): NAME = 'iar' TOOLCHAIN = 'IAR' + #iar_definitions.json location def_loc = os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'tools','export', 'iar', 'iar_definitions.json') + #create a dictionary of the definitions with open(def_loc, 'r') as 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() if hasattr(obj, 'device_name') and obj.device_name in IAR_DEFS.keys()] @@ -52,6 +59,7 @@ class IAR(Exporter): return groups def iar_device(self): + """Retrieve info from iar_definitions.json""" device_name = TARGET_MAP[self.target].device_name device_info = self.IAR_DEFS[device_name] iar_defaults ={ @@ -67,9 +75,11 @@ class IAR(Exporter): return IARdevice(**iar_defaults) def format_file(self, file): + """Make IAR compatible path""" return join('$PROJ_DIR$',file) def format_src(self, srcs): + """Group source files""" grouped = self.group_project_files(srcs) for group, files in grouped.items(): 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') def generate(self): - """Generate the .ww and .ewp files""" - + """Generate the .eww, .ewd, and .ewp files""" srcs = self.resources.headers + self.resources.s_sources + \ self.resources.c_sources + self.resources.cpp_sources + \ self.resources.objects + self.resources.libraries @@ -95,11 +104,13 @@ class IAR(Exporter): 'linker_script': self.format_file(self.resources.linker_script), 'include_paths': [self.format_file(src) for src in self.resources.inc_dirs], '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) 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") def build(self): diff --git a/tools/export/iar/ewd.tmpl b/tools/export/iar/ewd.tmpl new file mode 100644 index 0000000000..6b9df733a6 --- /dev/null +++ b/tools/export/iar/ewd.tmpl @@ -0,0 +1,1492 @@ + + + + 2 + + mbed-os-example-blinky + + ARM + + 1 + + C-SPY + 2 + + 26 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + CMSISDAP_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + IJET_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + XDS100_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + + diff --git a/tools/export/iar/ewp.tmpl b/tools/export/iar/ewp.tmpl index 6e562f1b4d..0ffabd7a52 100644 --- a/tools/export/iar/ewp.tmpl +++ b/tools/export/iar/ewp.tmpl @@ -6,7 +6,7 @@ ARM - 0 + 1 General 3