Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 """
switches 0:5c4d7b2438d3 2 mbed SDK
switches 0:5c4d7b2438d3 3 Copyright (c) 2014-2016 ARM Limited
switches 0:5c4d7b2438d3 4
switches 0:5c4d7b2438d3 5 Licensed under the Apache License, Version 2.0 (the "License");
switches 0:5c4d7b2438d3 6 you may not use this file except in compliance with the License.
switches 0:5c4d7b2438d3 7 You may obtain a copy of the License at
switches 0:5c4d7b2438d3 8
switches 0:5c4d7b2438d3 9 http://www.apache.org/licenses/LICENSE-2.0
switches 0:5c4d7b2438d3 10
switches 0:5c4d7b2438d3 11 Unless required by applicable law or agreed to in writing, software
switches 0:5c4d7b2438d3 12 distributed under the License is distributed on an "AS IS" BASIS,
switches 0:5c4d7b2438d3 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:5c4d7b2438d3 14 See the License for the specific language governing permissions and
switches 0:5c4d7b2438d3 15 limitations under the License.
switches 0:5c4d7b2438d3 16 """
switches 0:5c4d7b2438d3 17 from exporters import Exporter
switches 0:5c4d7b2438d3 18 from os.path import splitext, basename
switches 0:5c4d7b2438d3 19
switches 0:5c4d7b2438d3 20
switches 0:5c4d7b2438d3 21 class CoIDE(Exporter):
switches 0:5c4d7b2438d3 22 NAME = 'CoIDE'
switches 0:5c4d7b2438d3 23 TOOLCHAIN = 'GCC_ARM'
switches 0:5c4d7b2438d3 24
switches 0:5c4d7b2438d3 25 TARGETS = [
switches 0:5c4d7b2438d3 26 'KL25Z',
switches 0:5c4d7b2438d3 27 'KL05Z',
switches 0:5c4d7b2438d3 28 'LPC1768',
switches 0:5c4d7b2438d3 29 'ARCH_PRO',
switches 0:5c4d7b2438d3 30 'ARCH_MAX',
switches 0:5c4d7b2438d3 31 'UBLOX_C027',
switches 0:5c4d7b2438d3 32 'NUCLEO_L011K4',
switches 0:5c4d7b2438d3 33 'NUCLEO_L053R8',
switches 0:5c4d7b2438d3 34 'NUCLEO_L152RE',
switches 0:5c4d7b2438d3 35 'NUCLEO_F030R8',
switches 0:5c4d7b2438d3 36 'NUCLEO_F042K6',
switches 0:5c4d7b2438d3 37 'NUCLEO_F070RB',
switches 0:5c4d7b2438d3 38 'NUCLEO_F072RB',
switches 0:5c4d7b2438d3 39 'NUCLEO_F091RC',
switches 0:5c4d7b2438d3 40 'NUCLEO_F103RB',
switches 0:5c4d7b2438d3 41 'NUCLEO_F207ZG',
switches 0:5c4d7b2438d3 42 'NUCLEO_F302R8',
switches 0:5c4d7b2438d3 43 'NUCLEO_F303K8',
switches 0:5c4d7b2438d3 44 'NUCLEO_F303RE',
switches 0:5c4d7b2438d3 45 'NUCLEO_F334R8',
switches 0:5c4d7b2438d3 46 'NUCLEO_F303ZE',
switches 0:5c4d7b2438d3 47 'NUCLEO_F401RE',
switches 0:5c4d7b2438d3 48 'NUCLEO_F410RB',
switches 0:5c4d7b2438d3 49 'NUCLEO_F411RE',
switches 0:5c4d7b2438d3 50 'NUCLEO_F429ZI',
switches 0:5c4d7b2438d3 51 'NUCLEO_F446RE',
switches 0:5c4d7b2438d3 52 'NUCLEO_F446ZE',
switches 0:5c4d7b2438d3 53 'DISCO_L053C8',
switches 0:5c4d7b2438d3 54 'DISCO_F051R8',
switches 0:5c4d7b2438d3 55 'DISCO_F100RB',
switches 0:5c4d7b2438d3 56 'DISCO_F303VC',
switches 0:5c4d7b2438d3 57 'DISCO_F334C8',
switches 0:5c4d7b2438d3 58 'DISCO_F401VC',
switches 0:5c4d7b2438d3 59 'DISCO_F407VG',
switches 0:5c4d7b2438d3 60 'DISCO_F429ZI',
switches 0:5c4d7b2438d3 61 'DISCO_F469NI',
switches 0:5c4d7b2438d3 62 'MTS_MDOT_F405RG',
switches 0:5c4d7b2438d3 63 'MTS_MDOT_F411RE',
switches 0:5c4d7b2438d3 64 'MOTE_L152RC',
switches 0:5c4d7b2438d3 65 'NZ32_SC151',
switches 0:5c4d7b2438d3 66 ]
switches 0:5c4d7b2438d3 67
switches 0:5c4d7b2438d3 68 # seems like CoIDE currently supports only one type
switches 0:5c4d7b2438d3 69 FILE_TYPES = {
switches 0:5c4d7b2438d3 70 'c_sources':'1',
switches 0:5c4d7b2438d3 71 'cpp_sources':'1',
switches 0:5c4d7b2438d3 72 's_sources':'1'
switches 0:5c4d7b2438d3 73 }
switches 0:5c4d7b2438d3 74 FILE_TYPES2 = {
switches 0:5c4d7b2438d3 75 'headers':'1'
switches 0:5c4d7b2438d3 76 }
switches 0:5c4d7b2438d3 77
switches 0:5c4d7b2438d3 78 def generate(self):
switches 0:5c4d7b2438d3 79 self.resources.win_to_unix()
switches 0:5c4d7b2438d3 80 source_files = []
switches 0:5c4d7b2438d3 81 for r_type, n in CoIDE.FILE_TYPES.iteritems():
switches 0:5c4d7b2438d3 82 for file in getattr(self.resources, r_type):
switches 0:5c4d7b2438d3 83 source_files.append({
switches 0:5c4d7b2438d3 84 'name': basename(file), 'type': n, 'path': file
switches 0:5c4d7b2438d3 85 })
switches 0:5c4d7b2438d3 86 header_files = []
switches 0:5c4d7b2438d3 87 for r_type, n in CoIDE.FILE_TYPES2.iteritems():
switches 0:5c4d7b2438d3 88 for file in getattr(self.resources, r_type):
switches 0:5c4d7b2438d3 89 header_files.append({
switches 0:5c4d7b2438d3 90 'name': basename(file), 'type': n, 'path': file
switches 0:5c4d7b2438d3 91 })
switches 0:5c4d7b2438d3 92
switches 0:5c4d7b2438d3 93 libraries = []
switches 0:5c4d7b2438d3 94 for lib in self.resources.libraries:
switches 0:5c4d7b2438d3 95 l, _ = splitext(basename(lib))
switches 0:5c4d7b2438d3 96 libraries.append(l[3:])
switches 0:5c4d7b2438d3 97
switches 0:5c4d7b2438d3 98 if self.resources.linker_script is None:
switches 0:5c4d7b2438d3 99 self.resources.linker_script = ''
switches 0:5c4d7b2438d3 100
switches 0:5c4d7b2438d3 101 ctx = {
switches 0:5c4d7b2438d3 102 'name': self.project_name,
switches 0:5c4d7b2438d3 103 'source_files': source_files,
switches 0:5c4d7b2438d3 104 'header_files': header_files,
switches 0:5c4d7b2438d3 105 'include_paths': self.resources.inc_dirs,
switches 0:5c4d7b2438d3 106 'scatter_file': self.resources.linker_script,
switches 0:5c4d7b2438d3 107 'library_paths': self.resources.lib_dirs,
switches 0:5c4d7b2438d3 108 'object_files': self.resources.objects,
switches 0:5c4d7b2438d3 109 'libraries': libraries,
switches 0:5c4d7b2438d3 110 'symbols': self.toolchain.get_symbols()
switches 0:5c4d7b2438d3 111 }
switches 0:5c4d7b2438d3 112 target = self.target.lower()
switches 0:5c4d7b2438d3 113
switches 0:5c4d7b2438d3 114 # Project file
switches 0:5c4d7b2438d3 115 self.gen_file('coide_%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.project_name)