3 Copyright (c) 2011-2013 ARM Limited
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
17 from exporters import Exporter
18 from os.path import basename
21 class Uvision4(Exporter):
59 # Removed as uvision4_lpc11u35_501.uvproj.tmpl is missing.
114 "--gnu", "--no_rtti",
117 # By convention uVision projects do not show header files in the editor:
120 def get_toolchain(self):
121 return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM'
132 for r_type, n in Uvision4.FILE_TYPES.iteritems():
133 for file in getattr(self.resources, r_type):
134 f = {'name': basename(file), 'type': n, 'path': file}
135 if file.startswith("mbed\\common"):
136 source_files['mbed'].append(f)
137 elif file.startswith("mbed\\targets"):
138 source_files['hal'].append(f)
140 source_files['src'].append(f)
141 source_files = dict( [(k,v) for k,v in source_files.items() if len(v)>0])
143 'name': self.program_name,
144 'include_paths': self.resources.inc_dirs,
145 'scatter_file': self.resources.linker_script,
146 'object_files': self.resources.objects + self.resources.libraries,
147 'source_files': source_files.items(),
148 'symbols': self.get_symbols() + ['__ASSERT_MSG'],
149 'hex_files' : self.resources.hex_files,
150 'flags' : self.get_flags(),
152 target = self.target.lower()
154 self.gen_file('uvision4_%s.uvproj.tmpl' % target, ctx, '%s.uvproj' % self.program_name)
155 self.gen_file('uvision4_%s.uvopt.tmpl' % target, ctx, '%s.uvopt' % self.program_name)