Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
uvision4.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 basename, join, dirname 00018 from project_generator_definitions.definitions import ProGenDef 00019 00020 from tools.export.exporters import Exporter, ExporterTargetsProperty 00021 from tools.targets import TARGET_MAP, TARGET_NAMES 00022 00023 # If you wish to add a new target, add it to project_generator_definitions, and then 00024 # define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``) 00025 # There are 2 default mbed templates (predefined settings) uvision.uvproj and uvproj_microlib.uvproj.tmpl 00026 class Uvision4 (Exporter ): 00027 """ 00028 Exporter class for uvision. This class uses project generator. 00029 """ 00030 # These 2 are currently for exporters backward compatiblity 00031 NAME = 'uvision' 00032 TOOLCHAIN = 'ARM' 00033 # PROGEN_ACTIVE contains information for exporter scripts that this is using progen 00034 PROGEN_ACTIVE = True 00035 00036 MBED_CONFIG_HEADER_SUPPORTED = True 00037 00038 @ExporterTargetsProperty 00039 def TARGETS(cls): 00040 if not hasattr(cls, "_targets_supported"): 00041 cls._targets_supported = [] 00042 progendef = ProGenDef('uvision') 00043 for target in TARGET_NAMES: 00044 try: 00045 if (progendef.is_supported(str(TARGET_MAP[target])) or 00046 progendef.is_supported(TARGET_MAP[target].progen['target'])): 00047 cls._targets_supported.append(target) 00048 except AttributeError: 00049 # target is not supported yet 00050 continue 00051 return cls._targets_supported 00052 00053 def get_toolchain (self): 00054 return TARGET_MAP[self.target].default_toolchain 00055 00056 def generate (self): 00057 """ Generates the project files """ 00058 project_data = self.progen_get_project_data() 00059 tool_specific = {} 00060 # Expand tool specific settings by uvision specific settings which are required 00061 try: 00062 if TARGET_MAP[self.target].progen['uvision']['template']: 00063 tool_specific['uvision'] = TARGET_MAP[self.target].progen['uvision'] 00064 except KeyError: 00065 # use default template 00066 # by the mbed projects 00067 tool_specific['uvision'] = { 00068 'template': [join(dirname(__file__), 'uvision.uvproj.tmpl')], 00069 } 00070 00071 project_data['tool_specific'] = {} 00072 project_data['tool_specific'].update(tool_specific) 00073 00074 # get flags from toolchain and apply 00075 project_data['misc'] = {} 00076 # need to make this a string for progen. Only adds preprocessor when "macros" set 00077 asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + ",".join( 00078 list(set(self.flags['asm_flags']))) 00079 # asm flags only, common are not valid within uvision project, they are armcc specific 00080 project_data['misc']['asm_flags'] = [asm_flag_string] 00081 # cxx flags included, as uvision have them all in one tab 00082 project_data['misc']['c_flags'] = list(set(['-D__ASSERT_MSG'] 00083 + self.flags['common_flags'] 00084 + self.flags['c_flags'] 00085 + self.flags['cxx_flags'])) 00086 # not compatible with c99 flag set in the template 00087 project_data['misc']['c_flags'].remove("--c99") 00088 # cpp is not required as it's implicit for cpp files 00089 project_data['misc']['c_flags'].remove("--cpp") 00090 # we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it 00091 project_data['misc']['c_flags'].remove("--no_vla") 00092 project_data['misc']['ld_flags'] = self.flags['ld_flags'] 00093 00094 project_data['build_dir'] = project_data['build_dir'] + '\\' + 'uvision4' 00095 self.progen_gen_file(project_data)
Generated on Tue Jul 12 2022 12:28:59 by
1.7.2
