mirror of https://github.com/ARMmbed/mbed-os.git
65 lines
2.3 KiB
Python
65 lines
2.3 KiB
Python
"""
|
|
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.
|
|
"""
|
|
from os.path import basename, join, dirname
|
|
from project_generator_definitions.definitions import ProGenDef
|
|
|
|
from workspace_tools.export.exporters import Exporter
|
|
from workspace_tools.targets import TARGET_MAP, TARGET_NAMES
|
|
|
|
class Uvision4(Exporter):
|
|
"""
|
|
Exporter class for IAR Systems. This class uses project generator.
|
|
"""
|
|
# These 2 are currently for exporters backward compatiblity
|
|
NAME = 'uVision4'
|
|
TOOLCHAIN = 'ARM'
|
|
# PROGEN_ACTIVE contains information for exporter scripts that this is using progen
|
|
PROGEN_ACTIVE = True
|
|
|
|
# backward compatibility with our scripts
|
|
TARGETS = []
|
|
for target in TARGET_NAMES:
|
|
try:
|
|
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
|
|
ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])):
|
|
TARGETS.append(target)
|
|
except AttributeError:
|
|
# target is not supported yet
|
|
continue
|
|
|
|
|
|
def generate(self):
|
|
""" Generates the project files """
|
|
project_data = self.progen_get_project_data()
|
|
tool_specific = {}
|
|
# Expand tool specific settings by uivison specific settings which are required
|
|
try:
|
|
if TARGET_MAP[self.target].progen['uivison']['template']:
|
|
tool_specific['uivison'] = TARGET_MAP[self.target].progen['uivison']
|
|
except KeyError:
|
|
# use default template
|
|
# by the mbed projects
|
|
tool_specific['uvision'] = {
|
|
'template': [join(dirname(__file__), 'uvision.tmpl')],
|
|
}
|
|
|
|
project_data['tool_specific'] = {}
|
|
project_data['tool_specific'].update(tool_specific)
|
|
project_data['common']['macros'].append('__ASSERT_MSG')
|
|
self.progen_gen_file('uvision', project_data)
|
|
|