Skip to content

Commit 8081c39

Browse files
committed
Merge pull request #1557 from 0xc0170/dev_progen_iar
Exporter IAR - use progen for generating a project
2 parents 028465a + 7bdd089 commit 8081c39

File tree

123 files changed

+99
-211828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+99
-211828
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
url='https://github.com/mbedmicro/mbed',
4141
packages=find_packages(),
4242
license=LICENSE,
43-
install_requires=["PrettyTable>=0.7.2", "PySerial>=2.7", "IntelHex>=1.3", "colorama>=0.3.3", "Jinja2>=2.7.3", "project-generator>=0.8.4,<0.9.0"])
43+
install_requires=["PrettyTable>=0.7.2", "PySerial>=2.7", "IntelHex>=1.3", "colorama>=0.3.3", "Jinja2>=2.7.3", "project-generator>=0.8.8,<0.9.0"])
4444

4545
# Restore previous private_settings if needed
4646
if backup:

workspace_tools/export/exporters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def progen_get_project_data(self):
6262
self.resources.objects + self.resources.libraries,
6363
},
6464
'includes': {
65-
'Include Files': self.resources.headers,
65+
'Include Files': self.resources.headers + self.resources.inc_dirs,
6666
},
6767
'target': [TARGET_MAP[self.target].progen_target],
6868
'macros': self.get_symbols(),

workspace_tools/export/iar.eww.tmpl

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

workspace_tools/export/iar.py

Lines changed: 40 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
mbed SDK
3-
Copyright (c) 2011-2013 ARM Limited
3+
Copyright (c) 2011-2015 ARM Limited
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -14,109 +14,57 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17-
from workspace_tools.export.exporters import Exporter
1817
import re
1918
import os
19+
from project_generator_definitions.definitions import ProGenDef
20+
21+
from workspace_tools.export.exporters import Exporter
22+
from workspace_tools.targets import TARGET_MAP, TARGET_NAMES
23+
24+
# If you wish to add a new target, add it to project_generator_definitions, and then
25+
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
2026
class IAREmbeddedWorkbench(Exporter):
2127
"""
22-
Exporter class for IAR Systems.
28+
Exporter class for IAR Systems. This class uses project generator.
2329
"""
30+
# These 2 are currently for exporters backward compatiblity
2431
NAME = 'IAR'
2532
TOOLCHAIN = 'IAR'
33+
# PROGEN_ACTIVE contains information for exporter scripts that this is using progen
34+
PROGEN_ACTIVE = True
2635

27-
TARGETS = [
28-
'LPC1768',
29-
'LPC1347',
30-
'LPC11U24',
31-
'LPC11U35_401',
32-
'LPC11U35_501',
33-
#Removed LPCCAPPUCCINO linker file and startup file missing
34-
#'LPCCAPPUCCINO',
35-
'LPC1114',
36-
'LPC1549',
37-
'LPC812',
38-
'LPC4088',
39-
'LPC4088_DM',
40-
'LPC824',
41-
'UBLOX_C027',
42-
'ARCH_PRO',
43-
'K20D50M',
44-
'KL05Z',
45-
'KL25Z',
46-
'KL46Z',
47-
'K22F',
48-
'K64F',
49-
'NUCLEO_F030R8',
50-
'NUCLEO_F031K6',
51-
'NUCLEO_F042K6',
52-
'NUCLEO_F070RB',
53-
'NUCLEO_F072RB',
54-
'NUCLEO_F091RC',
55-
'NUCLEO_F103RB',
56-
'NUCLEO_F302R8',
57-
'NUCLEO_F303K8',
58-
'NUCLEO_F303RE',
59-
'NUCLEO_F334R8',
60-
'NUCLEO_F401RE',
61-
'NUCLEO_F410RB',
62-
'NUCLEO_F411RE',
63-
'NUCLEO_F446RE',
64-
'NUCLEO_L053R8',
65-
'NUCLEO_L073RZ',
66-
'NUCLEO_L152RE',
67-
'NUCLEO_L476RG',
68-
'DISCO_F429ZI',
69-
'DISCO_L053C8',
70-
'DISCO_F334C8',
71-
'DISCO_F469NI',
72-
'DISCO_F746NG',
73-
'DISCO_L476VG',
74-
'B96B_F446VE',
75-
#'STM32F407', Fails to build same for GCC
76-
'MAXWSNENV',
77-
'MAX32600MBED',
78-
'MTS_MDOT_F405RG',
79-
'MTS_MDOT_F411RE',
80-
'MTS_DRAGONFLY_F411RE',
81-
'NRF51822',
82-
'NRF51_DK',
83-
'NRF51_DONGLE',
84-
'DELTA_DFCM_NNN40',
85-
'SEEED_TINY_BLE',
86-
'HRM1017',
87-
'ARCH_BLE',
88-
'MOTE_L152RC',
89-
'EFM32PG_STK3401',
90-
'RZ_A1H',
91-
]
36+
# backward compatibility with our scripts
37+
TARGETS = []
38+
for target in TARGET_NAMES:
39+
try:
40+
if (ProGenDef('iar').is_supported(TARGET_MAP[target]) or
41+
ProGenDef('iar').is_supported(TARGET_MAP[target].progen_target)):
42+
TARGETS.append(target)
43+
except AttributeError:
44+
# target is not supported yet
45+
continue
9246

9347
def generate(self):
94-
"""
95-
Generates the project files
96-
"""
97-
sources = []
98-
sources += self.resources.c_sources
99-
sources += self.resources.cpp_sources
100-
sources += self.resources.s_sources
101-
102-
iar_files = IarFolder("", "", [])
103-
for source in sources:
104-
iar_files.insert_file(source)
105-
106-
ctx = {
107-
'name': self.program_name,
108-
'include_paths': self.resources.inc_dirs,
109-
'linker_script': self.resources.linker_script,
110-
'object_files': self.resources.objects,
111-
'libraries': self.resources.libraries,
112-
'symbols': self.get_symbols(),
113-
'source_files': iar_files.__str__(),
114-
'binary_files': self.resources.bin_files,
48+
""" Generates the project files """
49+
project_data = self.progen_get_project_data()
50+
# Expand tool specific settings by IAR specific settings which are required
51+
# by the mbed projects
52+
tool_specific = {
53+
'iar': {
54+
# We currently don't use misc, template sets those for us
55+
# 'misc': {
56+
# 'cxx_flags': ['--no_rtti', '--no_exceptions'],
57+
# 'c_flags': ['--diag_suppress=Pa050,Pa084,Pa093,Pa082'],
58+
# 'ld_flags': ['--skip_dynamic_initialization'],
59+
# },
60+
'template': [os.path.join(os.path.dirname(__file__), 'iar_template.ewp.tmpl')],
61+
}
11562
}
116-
self.gen_file('iar_%s.ewp.tmpl' % self.target.lower(), ctx, '%s.ewp' % self.program_name)
117-
self.gen_file('iar.eww.tmpl', ctx, '%s.eww' % self.program_name)
118-
self.gen_file('iar_%s.ewd.tmpl' % self.target.lower(), ctx, '%s.ewd' % self.program_name)
63+
project_data['tool_specific'] = {}
64+
project_data['tool_specific'].update(tool_specific)
65+
self.progen_gen_file('iar_arm', project_data)
11966

67+
# Currently not used, we should reuse folder_name to create virtual folders
12068
class IarFolder():
12169
"""
12270
This is a recursive folder object.

0 commit comments

Comments
 (0)