dhgdh

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by joey shelton

Committer:
nexpaq
Date:
Sat Sep 17 16:32:05 2016 +0000
Revision:
1:55a6170b404f
checking in for sharing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 1:55a6170b404f 1 """
nexpaq 1:55a6170b404f 2 mbed SDK
nexpaq 1:55a6170b404f 3 Copyright (c) 2011-2016 ARM Limited
nexpaq 1:55a6170b404f 4
nexpaq 1:55a6170b404f 5 Licensed under the Apache License, Version 2.0 (the "License");
nexpaq 1:55a6170b404f 6 you may not use this file except in compliance with the License.
nexpaq 1:55a6170b404f 7 You may obtain a copy of the License at
nexpaq 1:55a6170b404f 8
nexpaq 1:55a6170b404f 9 http://www.apache.org/licenses/LICENSE-2.0
nexpaq 1:55a6170b404f 10
nexpaq 1:55a6170b404f 11 Unless required by applicable law or agreed to in writing, software
nexpaq 1:55a6170b404f 12 distributed under the License is distributed on an "AS IS" BASIS,
nexpaq 1:55a6170b404f 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
nexpaq 1:55a6170b404f 14 See the License for the specific language governing permissions and
nexpaq 1:55a6170b404f 15 limitations under the License.
nexpaq 1:55a6170b404f 16 """
nexpaq 1:55a6170b404f 17 import uuid
nexpaq 1:55a6170b404f 18 from exporters import Exporter
nexpaq 1:55a6170b404f 19 from os.path import splitext, basename, dirname
nexpaq 1:55a6170b404f 20
nexpaq 1:55a6170b404f 21
nexpaq 1:55a6170b404f 22 class AtmelStudio(Exporter):
nexpaq 1:55a6170b404f 23 NAME = 'AtmelStudio'
nexpaq 1:55a6170b404f 24 TOOLCHAIN = 'GCC_ARM'
nexpaq 1:55a6170b404f 25
nexpaq 1:55a6170b404f 26 TARGETS = [
nexpaq 1:55a6170b404f 27 'SAMD21J18A',
nexpaq 1:55a6170b404f 28 'SAMR21G18A',
nexpaq 1:55a6170b404f 29 'SAMD21G18A',
nexpaq 1:55a6170b404f 30 'SAML21J18A',
nexpaq 1:55a6170b404f 31 'SAMG55J19',
nexpaq 1:55a6170b404f 32 ]
nexpaq 1:55a6170b404f 33
nexpaq 1:55a6170b404f 34 DOT_IN_RELATIVE_PATH = True
nexpaq 1:55a6170b404f 35
nexpaq 1:55a6170b404f 36 MBED_CONFIG_HEADER_SUPPORTED = True
nexpaq 1:55a6170b404f 37
nexpaq 1:55a6170b404f 38 def generate(self):
nexpaq 1:55a6170b404f 39
nexpaq 1:55a6170b404f 40 source_files = []
nexpaq 1:55a6170b404f 41 dirs = []
nexpaq 1:55a6170b404f 42 for r_type in ['s_sources', 'c_sources', 'cpp_sources']:
nexpaq 1:55a6170b404f 43 r = getattr(self.resources, r_type)
nexpaq 1:55a6170b404f 44 if r:
nexpaq 1:55a6170b404f 45 for source in r:
nexpaq 1:55a6170b404f 46 source_files.append(source[2:])
nexpaq 1:55a6170b404f 47 dirs.append(dirname(source[2:]))
nexpaq 1:55a6170b404f 48
nexpaq 1:55a6170b404f 49 source_folders = []
nexpaq 1:55a6170b404f 50 for e in dirs:
nexpaq 1:55a6170b404f 51 if e and e not in source_folders:
nexpaq 1:55a6170b404f 52 source_folders.append(e)
nexpaq 1:55a6170b404f 53
nexpaq 1:55a6170b404f 54 libraries = []
nexpaq 1:55a6170b404f 55 for lib in self.resources.libraries:
nexpaq 1:55a6170b404f 56 l, _ = splitext(basename(lib))
nexpaq 1:55a6170b404f 57 libraries.append(l[3:])
nexpaq 1:55a6170b404f 58
nexpaq 1:55a6170b404f 59 solution_uuid = '{' + str(uuid.uuid4()) + '}'
nexpaq 1:55a6170b404f 60 project_uuid = '{' + str(uuid.uuid4()) + '}'
nexpaq 1:55a6170b404f 61
nexpaq 1:55a6170b404f 62 ctx = {
nexpaq 1:55a6170b404f 63 'target': self.target,
nexpaq 1:55a6170b404f 64 'name': self.project_name,
nexpaq 1:55a6170b404f 65 'source_files': source_files,
nexpaq 1:55a6170b404f 66 'source_folders': source_folders,
nexpaq 1:55a6170b404f 67 'object_files': self.resources.objects,
nexpaq 1:55a6170b404f 68 'include_paths': self.resources.inc_dirs,
nexpaq 1:55a6170b404f 69 'library_paths': self.resources.lib_dirs,
nexpaq 1:55a6170b404f 70 'linker_script': self.resources.linker_script,
nexpaq 1:55a6170b404f 71 'libraries': libraries,
nexpaq 1:55a6170b404f 72 'symbols': self.toolchain.get_symbols(),
nexpaq 1:55a6170b404f 73 'solution_uuid': solution_uuid.upper(),
nexpaq 1:55a6170b404f 74 'project_uuid': project_uuid.upper()
nexpaq 1:55a6170b404f 75 }
nexpaq 1:55a6170b404f 76 ctx.update(self.flags)
nexpaq 1:55a6170b404f 77 target = self.target.lower()
nexpaq 1:55a6170b404f 78 self.gen_file('atmelstudio6_2.atsln.tmpl', ctx, '%s.atsln' % self.project_name)
nexpaq 1:55a6170b404f 79 self.gen_file('atmelstudio6_2.cppproj.tmpl', ctx, '%s.cppproj' % self.project_name)