Knight KE / Mbed OS Game_Master
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers __init__.py Source File

__init__.py

00001 """
00002 mbed SDK
00003 Copyright (c) 2011-2016 ARM Limited
00004 
00005 Licensed under the Apache License, Version 2.0 (the "License");
00006 you may not use this file except in compliance with the License.
00007 You may obtain a copy of the License at
00008 
00009     http://www.apache.org/licenses/LICENSE-2.0
00010 
00011 Unless required by applicable law or agreed to in writing, software
00012 distributed under the License is distributed on an "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 See the License for the specific language governing permissions and
00015 limitations under the License.
00016 """
00017 from os.path import splitext, basename
00018 from os import remove
00019 
00020 from tools.export.exporters import Exporter, deprecated_exporter
00021 
00022 
00023 @deprecated_exporter
00024 class KDS(Exporter ):
00025     NAME = 'Kinetis Design Studio'
00026     TOOLCHAIN = 'GCC_ARM'
00027 
00028     TARGETS = [
00029         'K64F',
00030         'HEXIWEAR',
00031         'K22F',
00032     ]
00033 
00034     def generate(self):
00035         libraries = []
00036         for lib in self.resources.libraries:
00037             l, _ = splitext(basename(lib))
00038             libraries.append(l[3:])
00039 
00040         ctx = {
00041             'name': self.project_name,
00042             'include_paths': self.resources.inc_dirs,
00043             'linker_script': self.resources.linker_script,
00044             'object_files': self.resources.objects,
00045             'libraries': libraries,
00046             'symbols': self.toolchain.get_symbols()
00047         }
00048         self.gen_file('kds/%s_project.tmpl' % self.target.lower(), ctx, '.project')
00049         self.gen_file('kds/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')
00050         self.gen_file('kds/launch.tmpl', ctx, '%s.launch' % self.project_name)
00051 
00052     @staticmethod
00053     def clean(project_name):
00054         remove('%s.launch' % project_name)