mirror of https://github.com/ARMmbed/mbed-os.git
Exporters - add progen to uvision
parent
906961d781
commit
c44cf7a04d
|
@ -14,199 +14,51 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
"""
|
"""
|
||||||
from exporters import Exporter
|
from os.path import basename, join, dirname
|
||||||
from os.path import basename
|
from project_generator_definitions.definitions import ProGenDef
|
||||||
|
|
||||||
|
from workspace_tools.export.exporters import Exporter
|
||||||
|
from workspace_tools.targets import TARGET_MAP, TARGET_NAMES
|
||||||
|
|
||||||
class Uvision4(Exporter):
|
class Uvision4(Exporter):
|
||||||
|
"""
|
||||||
|
Exporter class for IAR Systems. This class uses project generator.
|
||||||
|
"""
|
||||||
|
# These 2 are currently for exporters backward compatiblity
|
||||||
NAME = 'uVision4'
|
NAME = 'uVision4'
|
||||||
|
TOOLCHAIN = 'ARM'
|
||||||
|
# PROGEN_ACTIVE contains information for exporter scripts that this is using progen
|
||||||
|
PROGEN_ACTIVE = True
|
||||||
|
|
||||||
TARGETS = [
|
# backward compatibility with our scripts
|
||||||
'LPC1768',
|
TARGETS = []
|
||||||
'LPC11U24',
|
for target in TARGET_NAMES:
|
||||||
'LPC11U35_401',
|
try:
|
||||||
'LPC11U35_501',
|
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
|
||||||
'KL05Z',
|
ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])):
|
||||||
'KL25Z',
|
TARGETS.append(target)
|
||||||
'KL43Z',
|
except AttributeError:
|
||||||
'KL46Z',
|
# target is not supported yet
|
||||||
'K64F',
|
continue
|
||||||
'K22F',
|
|
||||||
'K20D50M',
|
|
||||||
'TEENSY3_1',
|
|
||||||
'LPC1347',
|
|
||||||
'LPC1114',
|
|
||||||
'LPC11C24',
|
|
||||||
'LPC4088',
|
|
||||||
'LPC4088_DM',
|
|
||||||
'LPC4330_M4',
|
|
||||||
'LPC4337',
|
|
||||||
'LPC812',
|
|
||||||
'LPC824',
|
|
||||||
'SSCI824',
|
|
||||||
'NUCLEO_F030R8',
|
|
||||||
'NUCLEO_F031K6',
|
|
||||||
'NUCLEO_F042K6',
|
|
||||||
'NUCLEO_F070RB',
|
|
||||||
'NUCLEO_F072RB',
|
|
||||||
'NUCLEO_F091RC',
|
|
||||||
'NUCLEO_F103RB',
|
|
||||||
'NUCLEO_F302R8',
|
|
||||||
'NUCLEO_F303K8',
|
|
||||||
'NUCLEO_F303RE',
|
|
||||||
'NUCLEO_F334R8',
|
|
||||||
'NUCLEO_F401RE',
|
|
||||||
'NUCLEO_F410RB',
|
|
||||||
'NUCLEO_F411RE',
|
|
||||||
'NUCLEO_F446RE',
|
|
||||||
'NUCLEO_F746ZG',
|
|
||||||
'NUCLEO_L053R8',
|
|
||||||
'NUCLEO_L073RZ',
|
|
||||||
'NUCLEO_L152RE',
|
|
||||||
'NUCLEO_L476RG',
|
|
||||||
'B96B_F446VE',
|
|
||||||
'UBLOX_C027',
|
|
||||||
'LPC1549',
|
|
||||||
'LPC11U68',
|
|
||||||
# Removed as uvision4_lpc11u35_501.uvproj.tmpl is missing.
|
|
||||||
#'LPC11U35_501',
|
|
||||||
'NRF51822',
|
|
||||||
'HRM1017',
|
|
||||||
'RBLAB_NRF51822',
|
|
||||||
'ARCH_PRO',
|
|
||||||
'ARCH_BLE',
|
|
||||||
'DISCO_F051R8',
|
|
||||||
'DISCO_F100RB',
|
|
||||||
'DISCO_F303VC',
|
|
||||||
'DISCO_F407VG',
|
|
||||||
'DISCO_F429ZI',
|
|
||||||
'DISCO_F469NI',
|
|
||||||
'DISCO_L053C8',
|
|
||||||
'DISCO_F334C8',
|
|
||||||
'DISCO_F746NG',
|
|
||||||
'DISCO_L476VG',
|
|
||||||
'MTS_GAMBIT',
|
|
||||||
'ARCH_MAX',
|
|
||||||
'MTS_MDOT_F405RG',
|
|
||||||
'NRF51_DK',
|
|
||||||
'NRF51_DONGLE',
|
|
||||||
'SEEED_TINY_BLE',
|
|
||||||
'LPC11U37H_401',
|
|
||||||
'DELTA_DFCM_NNN40',
|
|
||||||
'MAXWSNENV',
|
|
||||||
'MAX32600MBED',
|
|
||||||
'MOTE_L152RC',
|
|
||||||
'NZ32_SC151',
|
|
||||||
'SAMR21G18A',
|
|
||||||
'SAMD21J18A',
|
|
||||||
'SAMD21G18A',
|
|
||||||
'SAML21J18A',
|
|
||||||
]
|
|
||||||
|
|
||||||
USING_MICROLIB = [
|
|
||||||
'LPC11U24',
|
|
||||||
'LPC11U35_401',
|
|
||||||
'LPC11U35_501',
|
|
||||||
'LPC1114',
|
|
||||||
'LPC11C24',
|
|
||||||
'LPC812',
|
|
||||||
'LPC824',
|
|
||||||
'SSCI824',
|
|
||||||
'NUCLEO_F030R8',
|
|
||||||
'NUCLEO_F031K6',
|
|
||||||
'NUCLEO_F042K6',
|
|
||||||
'NUCLEO_F070RB',
|
|
||||||
'NUCLEO_F072RB',
|
|
||||||
'NUCLEO_F091RC',
|
|
||||||
'NUCLEO_F103RB',
|
|
||||||
'NUCLEO_F302R8',
|
|
||||||
'NUCLEO_F303K8',
|
|
||||||
'NUCLEO_F303RE',
|
|
||||||
'NUCLEO_F334R8',
|
|
||||||
'NUCLEO_F401RE',
|
|
||||||
'NUCLEO_F410RB',
|
|
||||||
'NUCLEO_F411RE',
|
|
||||||
'NUCLEO_F446RE',
|
|
||||||
'NUCLEO_F746ZG',
|
|
||||||
'NUCLEO_L053R8',
|
|
||||||
'NUCLEO_L073RZ',
|
|
||||||
'NUCLEO_L152RE',
|
|
||||||
'NUCLEO_L476RG',
|
|
||||||
'DISCO_F051R8',
|
|
||||||
'DISCO_F100RB',
|
|
||||||
'DISCO_F334C8',
|
|
||||||
'DISCO_F429ZI',
|
|
||||||
'DISCO_F469NI',
|
|
||||||
'DISCO_L053C8',
|
|
||||||
'DISCO_L476VG',
|
|
||||||
'B96B_F446VE',
|
|
||||||
'DISCO_F407VG',
|
|
||||||
'DISCO_F303VC',
|
|
||||||
'LPC1549',
|
|
||||||
'LPC11U68',
|
|
||||||
'LPC11U35_501',
|
|
||||||
'KL05Z',
|
|
||||||
'LPC11U37H_401',
|
|
||||||
'MOTE_L152RC',
|
|
||||||
'NZ32_SC151',
|
|
||||||
'SAMR21G18A',
|
|
||||||
'SAMD21J18A',
|
|
||||||
'SAMD21G18A',
|
|
||||||
'SAML21J18A',
|
|
||||||
'ARM_IOTSS_BEID',
|
|
||||||
'ARM_MPS2_M0',
|
|
||||||
'ARM_MPS2_M0P',
|
|
||||||
'ARM_MPS2_M3',
|
|
||||||
'ARM_MPS2_M4',
|
|
||||||
'ARM_MPS2_M7',
|
|
||||||
]
|
|
||||||
|
|
||||||
FILE_TYPES = {
|
|
||||||
'c_sources':'1',
|
|
||||||
'cpp_sources':'8',
|
|
||||||
's_sources':'2'
|
|
||||||
}
|
|
||||||
|
|
||||||
FLAGS = [
|
|
||||||
"--gnu", "--no_rtti",
|
|
||||||
]
|
|
||||||
|
|
||||||
# By convention uVision projects do not show header files in the editor:
|
|
||||||
# 'headers':'5',
|
|
||||||
|
|
||||||
def get_toolchain(self):
|
|
||||||
return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM'
|
|
||||||
|
|
||||||
def get_flags(self):
|
|
||||||
return self.FLAGS
|
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
source_files = {
|
""" Generates the project files """
|
||||||
'mbed': [],
|
project_data = self.progen_get_project_data()
|
||||||
'hal': [],
|
tool_specific = {}
|
||||||
'src': []
|
# Expand tool specific settings by uivison specific settings which are required
|
||||||
|
try:
|
||||||
|
if TARGET_MAP[self.target].progen['uivison']['template']:
|
||||||
|
tool_specific['uivison'] = TARGET_MAP[self.target].progen['uivison']
|
||||||
|
except KeyError:
|
||||||
|
# use default template
|
||||||
|
# by the mbed projects
|
||||||
|
tool_specific['uvision'] = {
|
||||||
|
'template': [join(dirname(__file__), 'uvision.tmpl')],
|
||||||
}
|
}
|
||||||
for r_type, n in Uvision4.FILE_TYPES.iteritems():
|
|
||||||
for file in getattr(self.resources, r_type):
|
project_data['tool_specific'] = {}
|
||||||
f = {'name': basename(file), 'type': n, 'path': file}
|
project_data['tool_specific'].update(tool_specific)
|
||||||
if file.startswith("mbed\\common"):
|
project_data['common']['macros'].append('__ASSERT_MSG')
|
||||||
source_files['mbed'].append(f)
|
self.progen_gen_file('uvision', project_data)
|
||||||
elif file.startswith("mbed\\targets"):
|
|
||||||
source_files['hal'].append(f)
|
|
||||||
else:
|
|
||||||
source_files['src'].append(f)
|
|
||||||
source_files = dict( [(k,v) for k,v in source_files.items() if len(v)>0])
|
|
||||||
ctx = {
|
|
||||||
'name': self.program_name,
|
|
||||||
'include_paths': self.resources.inc_dirs,
|
|
||||||
'scatter_file': self.resources.linker_script,
|
|
||||||
'object_files': self.resources.objects + self.resources.libraries,
|
|
||||||
'source_files': source_files.items(),
|
|
||||||
'symbols': self.get_symbols() + ['__ASSERT_MSG'],
|
|
||||||
'hex_files' : self.resources.hex_files,
|
|
||||||
'flags' : self.get_flags(),
|
|
||||||
}
|
|
||||||
target = self.target.lower()
|
|
||||||
# Project file
|
|
||||||
self.gen_file('uvision4_%s.uvproj.tmpl' % target, ctx, '%s.uvproj' % self.program_name)
|
|
||||||
self.gen_file('uvision4_%s.uvopt.tmpl' % target, ctx, '%s.uvopt' % self.program_name)
|
|
||||||
|
|
Loading…
Reference in New Issue