mirror of https://github.com/ARMmbed/mbed-os.git
Refactor uvision. Add support for CMSIS project files
parent
448205ac87
commit
6fd1c77727
|
@ -19,18 +19,14 @@ from os.path import join, exists, basename
|
|||
from shutil import copytree, rmtree, copy
|
||||
import yaml
|
||||
|
||||
from tools.export import uvision4, uvision5, codered, makefile, ds5_5, iar
|
||||
from tools.export import codered, ds5_5, iar, makefile
|
||||
from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
|
||||
from tools.export import sw4stm32, e2studio, zip, cdt
|
||||
from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt
|
||||
from tools.export.exporters import OldLibrariesException, FailedBuildException
|
||||
from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP
|
||||
|
||||
from project_generator_definitions.definitions import ProGenDef
|
||||
from tools.targets import TARGET_NAMES
|
||||
|
||||
EXPORTERS = {
|
||||
'uvision': uvision5.Uvision5,
|
||||
'uvision4': uvision4.Uvision4, # deprecated - to be removed in future version
|
||||
'uvision5': uvision5.Uvision5,
|
||||
'uvision5': uvision.Uvision,
|
||||
'lpcxpresso': codered.CodeRed,
|
||||
'gcc_arm': makefile.GccArm,
|
||||
'make_gcc_arm': makefile.GccArm,
|
||||
|
@ -48,7 +44,8 @@ EXPORTERS = {
|
|||
'eclipse_gcc_arm' : cdt.EclipseGcc,
|
||||
'eclipse_iar' : cdt.EclipseIAR,
|
||||
'eclipse_armc5' : cdt.EclipseArmc5,
|
||||
'zip' : zip.ZIP
|
||||
'zip' : zip.ZIP,
|
||||
'cmsis' : cmsis.CMSIS
|
||||
}
|
||||
|
||||
ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN = """
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
import os
|
||||
from os.path import sep
|
||||
from itertools import groupby
|
||||
from xml.etree.ElementTree import Element, tostring
|
||||
from xml.dom.minidom import parseString
|
||||
import ntpath
|
||||
import re
|
||||
|
||||
from ArmPackManager import Cache
|
||||
|
||||
from tools.targets import TARGET_MAP
|
||||
from tools.export.exporters import Exporter, TargetNotSupportedException
|
||||
|
||||
cache_d = False
|
||||
|
||||
|
||||
class fileCMSIS():
|
||||
"""CMSIS file class.
|
||||
|
||||
Encapsulates information necessary for files in cpdsc project file"""
|
||||
file_types = {'.cpp': 'sourceCpp', '.c': 'sourceC', '.s': 'sourceAsm',
|
||||
'.obj': 'object', '.o': 'object', '.lib': 'library',
|
||||
'.ar': 'linkerScript', '.h': 'header', '.sct': 'linkerScript'}
|
||||
|
||||
def __init__(self, loc, name):
|
||||
#print loc
|
||||
_, ext = os.path.splitext(loc)
|
||||
self.type = self.file_types[ext.lower()]
|
||||
self.loc = loc
|
||||
self.name = name
|
||||
|
||||
|
||||
class DeviceCMSIS():
|
||||
"""CMSIS Device class
|
||||
|
||||
Encapsulates target information retrieved by arm-pack-manager"""
|
||||
def __init__(self, target, use_generic_cpu=False):
|
||||
cache = Cache(True, False)
|
||||
if cache_d:
|
||||
cache.cache_descriptors()
|
||||
|
||||
t = TARGET_MAP[target]
|
||||
self.core = t.core
|
||||
try:
|
||||
cpu_name = t.device_name
|
||||
target_info = cache.index[cpu_name]
|
||||
# Target does not have device name or pdsc file
|
||||
except:
|
||||
try:
|
||||
# Try to find the core as a generic CMSIS target
|
||||
cpu_name = self.cpu_cmsis()
|
||||
target_info = cache.index[cpu_name]
|
||||
except:
|
||||
raise TargetNotSupportedException("Target not in CMSIS packs")
|
||||
|
||||
self.url = target_info['pdsc_file']
|
||||
self.pack_url, self.pack_id = ntpath.split(self.url)
|
||||
self.dname = cpu_name
|
||||
self.dfpu = target_info['processor']['fpu']
|
||||
self.dvendor = target_info['vendor']
|
||||
self.dendian = target_info['processor'].get('endianness','Little-endian')
|
||||
self.debug_interface = self.find_debug()
|
||||
self.debug_svd = target_info.get('debug', '')
|
||||
self.compile_header = target_info['compile']['header']
|
||||
|
||||
def find_debug(self):
|
||||
debug_map ={
|
||||
'STMicroelectronics':'ST-Link',
|
||||
'Silicon Labs':'J-LINK',
|
||||
'Nuvoton':'NULink'
|
||||
}
|
||||
reg = "([\w\s]+):?\d*?"
|
||||
m = re.search(reg, self.dvendor)
|
||||
vendor_match = m.group(1) if m else None
|
||||
return debug_map.get(vendor_match, "CMSIS-DAP")
|
||||
|
||||
def cpu_cmsis(self):
|
||||
#Cortex-M4F => ARMCM4_FP, Cortex-M0+ => ARMCM0P
|
||||
cpu = self.core
|
||||
cpu = cpu.replace("Cortex-","ARMC")
|
||||
cpu = cpu.replace("+","P")
|
||||
cpu = cpu.replace("F","_FP")
|
||||
return cpu
|
||||
|
||||
class CMSIS(Exporter):
|
||||
NAME = 'cmsis'
|
||||
TOOLCHAIN = 'ARM'
|
||||
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
|
||||
if "ARM" in obj.supported_toolchains]
|
||||
|
||||
def make_key(self, src):
|
||||
"""turn a source file into its group name"""
|
||||
key = src.name.split(sep)[0]
|
||||
if key == ".":
|
||||
key = os.path.basename(os.path.realpath(self.export_dir))
|
||||
return key
|
||||
|
||||
def group_project_files(self, sources, root_element):
|
||||
"""Recursively group the source files by their encompassing directory"""
|
||||
|
||||
data = sorted(sources, key=self.make_key)
|
||||
for group, files in groupby(data, self.make_key):
|
||||
new_srcs = []
|
||||
for f in list(files):
|
||||
spl = f.name.split(sep)
|
||||
if len(spl)==2:
|
||||
file_element = Element('file',
|
||||
attrib={
|
||||
'category':f.type,
|
||||
'name': f.loc})
|
||||
root_element.append(file_element)
|
||||
else:
|
||||
f.name = os.path.join(*spl[1:])
|
||||
new_srcs.append(f)
|
||||
if new_srcs:
|
||||
group_element = Element('group',attrib={'name':group})
|
||||
root_element.append(self.group_project_files(new_srcs,
|
||||
group_element))
|
||||
return root_element
|
||||
|
||||
def generate(self):
|
||||
|
||||
srcs = self.resources.headers + self.resources.s_sources + \
|
||||
self.resources.c_sources + self.resources.cpp_sources + \
|
||||
self.resources.objects + self.resources.libraries + \
|
||||
[self.resources.linker_script]
|
||||
srcs = [fileCMSIS(src, src) for src in srcs if src]
|
||||
ctx = {
|
||||
'name': self.project_name,
|
||||
'project_files': tostring(self.group_project_files(srcs, Element('files'))),
|
||||
'device': DeviceCMSIS(self.target),
|
||||
'date': ''
|
||||
}
|
||||
# TODO: find how to keep prettyxml from adding xml version to this blob
|
||||
#dom = parseString(ctx['project_files'])
|
||||
#ctx['project_files'] = dom.toprettyxml(indent="\t")
|
||||
|
||||
self.gen_file('cmsis/cpdsc.tmpl', ctx, 'project.cpdsc')
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PACK.xsd">
|
||||
<vendor>Keil</vendor>
|
||||
<name>{{name}}</name>
|
||||
<description>Exported mbed project.</description>
|
||||
<url>{{device.url}}</url>
|
||||
|
||||
<releases>
|
||||
<release version="5.20.0.2">Generated</release>
|
||||
</releases>
|
||||
<create>
|
||||
<project name="{{name}}" documentation="">
|
||||
<target Dendian="{{device.dendian}}" Dfpu="{{device.dfpu}}" Dname="{{device.dname}}" Dvendor="{{device.dvendor}}">
|
||||
<output debug="1" name="{{name}}" type="exe"/>
|
||||
<debugProbe name="{{device.debug_interface}}" protocol="jtag"/>
|
||||
</target>
|
||||
{{project_files}}
|
||||
</project>
|
||||
</create>
|
||||
</package>
|
|
@ -2,10 +2,11 @@
|
|||
import os
|
||||
import sys
|
||||
import logging
|
||||
from os.path import join, dirname, relpath
|
||||
from os.path import join, dirname, relpath, basename, realpath
|
||||
from itertools import groupby
|
||||
from jinja2 import FileSystemLoader
|
||||
from jinja2.environment import Environment
|
||||
import copy
|
||||
|
||||
from tools.targets import TARGET_MAP
|
||||
from project_generator.tools import tool
|
||||
|
@ -73,11 +74,20 @@ class Exporter(object):
|
|||
self.resources = resources
|
||||
self.generated_files = [join(self.TEMPLATE_DIR,"GettingStarted.html")]
|
||||
self.builder_files_dict = {}
|
||||
self.add_config()
|
||||
|
||||
def get_toolchain(self):
|
||||
"""A helper getter function that we should probably eliminate"""
|
||||
return self.TOOLCHAIN
|
||||
|
||||
def add_config(self):
|
||||
"""Add the containgin directory of mbed_config.h to include dirs"""
|
||||
config = self.toolchain.get_config_header()
|
||||
if config:
|
||||
self.resources.inc_dirs.append(
|
||||
dirname(relpath(config,
|
||||
self.resources.file_basepath[config])))
|
||||
|
||||
@property
|
||||
def flags(self):
|
||||
"""Returns a dictionary of toolchain flags.
|
||||
|
@ -89,7 +99,7 @@ class Exporter(object):
|
|||
common_flags - common options
|
||||
"""
|
||||
config_header = self.toolchain.get_config_header()
|
||||
flags = {key + "_flags": value for key, value
|
||||
flags = {key + "_flags": copy.deepcopy(value) for key, value
|
||||
in self.toolchain.flags.iteritems()}
|
||||
asm_defines = ["-D" + symbol for symbol in self.toolchain.get_symbols(True)]
|
||||
c_defines = ["-D" + symbol for symbol in self.toolchain.get_symbols()]
|
||||
|
@ -217,3 +227,23 @@ class Exporter(object):
|
|||
logging.debug("Generating: %s", target_path)
|
||||
open(target_path, "w").write(target_text)
|
||||
self.generated_files += [target_path]
|
||||
|
||||
def make_key(self, src):
|
||||
"""From a source file, extract group name
|
||||
Positional Arguments:
|
||||
src - the src's location
|
||||
"""
|
||||
key = basename(dirname(src))
|
||||
if key == ".":
|
||||
key = basename(realpath(self.export_dir))
|
||||
return key
|
||||
|
||||
def group_project_files(self, sources):
|
||||
"""Group the source files by their encompassing directory
|
||||
Positional Arguments:
|
||||
sources - array of sourc locations
|
||||
|
||||
Returns a dictionary of {group name: list of source locations}
|
||||
"""
|
||||
data = sorted(sources, key=self.make_key)
|
||||
return {k: list(g) for k,g in groupby(data, self.make_key)}
|
||||
|
|
|
@ -1,403 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
|
||||
|
||||
<SchemaVersion>1.1</SchemaVersion>
|
||||
|
||||
<Header>###This file was automagically generated by mbed.org. For more information, see http://mbed.org/handbook/Exporting-To-Uvision </Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>mbed FRDM-KL25Z</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>MKL25Z128xxx4</Device>
|
||||
<Vendor>Freescale Semiconductor</Vendor>
|
||||
<Cpu>IRAM(0x1FFFF000-0x1FFFFFFF) IRAM2(0x20000000-0x20002FFF) IROM(0x0-0x1FFFF) CLOCK(8000000) CPUTYPE("Cortex-M0+") ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile>"STARTUP\Freescale\Kinetis\startup_MKL25Z4.s" ("Freescale MKL25Zxxxxxx4 Startup Code")</StartupFile>
|
||||
<FlashDriverDll>ULP2CM3(-O2510 -S0 -C0 -FO15 -FD20000000 -FC800 -FN1 -FF0MK_P128_48MHZ -FS00 -FL020000)</FlashDriverDll>
|
||||
<DeviceId>6533</DeviceId>
|
||||
<RegisterFile>MKL25Z4.H</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>SFD\Freescale\Kinetis\MKL25Z4.sfr</SFDFile>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath>Freescale\Kinetis\</RegisterFilePath>
|
||||
<DBRegisterFilePath>Freescale\Kinetis\</DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\build\</OutputDirectory>
|
||||
<OutputName>MBED_11</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin --output=@L.bin !L</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments></SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0+</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments></TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0+</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
<Simulator>
|
||||
<UseSimulator>0</UseSimulator>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>1</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
|
||||
</Simulator>
|
||||
<Target>
|
||||
<UseTarget>1</UseTarget>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>0</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>14</TargetSelection>
|
||||
<SimDlls>
|
||||
<CpuDll></CpuDll>
|
||||
<CpuDllArguments></CpuDllArguments>
|
||||
<PeripheralDll></PeripheralDll>
|
||||
<PeripheralDllArguments></PeripheralDllArguments>
|
||||
<InitializationFile></InitializationFile>
|
||||
</SimDlls>
|
||||
<TargetDlls>
|
||||
<CpuDll></CpuDll>
|
||||
<CpuDllArguments></CpuDllArguments>
|
||||
<PeripheralDll></PeripheralDll>
|
||||
<PeripheralDllArguments></PeripheralDllArguments>
|
||||
<InitializationFile></InitializationFile>
|
||||
<Driver>BIN\CMSIS_AGDI.dll</Driver>
|
||||
</TargetDlls>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4105</DriverSelection>
|
||||
</Flash1>
|
||||
<Flash2>BIN\CMSIS_AGDI.dll</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M0+"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>0</RvdsVP>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>0</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x1ffff000</StartAddress>
|
||||
<Size>0x1000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x3000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>1</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>0</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define> </Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath> </IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>0</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x10000000</DataAddressRange>
|
||||
<ScatterFile>mbed\TARGET_KL25Z\TOOLCHAIN_ARM_STD\MKL25Z4.sct</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>
|
||||
</Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
|
||||
<Group>
|
||||
<GroupName>src</GroupName>
|
||||
<Files>
|
||||
</Files>
|
||||
</Group>
|
||||
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,165 @@
|
|||
import os
|
||||
from os.path import sep, normpath, join, exists
|
||||
import ntpath
|
||||
import copy
|
||||
from collections import namedtuple
|
||||
from distutils.spawn import find_executable
|
||||
import subprocess
|
||||
|
||||
from ArmPackManager import Cache
|
||||
|
||||
from tools.targets import TARGET_MAP
|
||||
from tools.export.exporters import Exporter, FailedBuildException
|
||||
from tools.export.cmsis import DeviceCMSIS
|
||||
|
||||
cache_d = False
|
||||
|
||||
|
||||
class DeviceUvision(DeviceCMSIS):
|
||||
"""Uvision Device class, inherits CMSIS Device class
|
||||
|
||||
Encapsulates information necessary for uvision project targets"""
|
||||
def __init__(self, target, use_generic_cpu=False):
|
||||
DeviceCMSIS.__init__(self, target, use_generic_cpu)
|
||||
dev_format = "$$Device:{0}${1}"
|
||||
self.svd = ''
|
||||
if self.debug_svd:
|
||||
self.svd = dev_format.format(self.dname, self.debug_svd)
|
||||
self.reg_file = dev_format.format(self.dname, self.compile_header)
|
||||
self.debug_interface = self.uv_debug()
|
||||
|
||||
def uv_debug(self):
|
||||
"""Return a namedtuple of information about uvision debug settings"""
|
||||
UVDebug = namedtuple('UVDebug',['bin_loc','core_flag'])
|
||||
|
||||
# CortexMXn => pCMX
|
||||
cpu = self.core.replace("Cortex-", "C")
|
||||
cpu = cpu.replace("+", "")
|
||||
cpu = cpu.replace("F", "")
|
||||
cpu_flag = "p"+cpu
|
||||
|
||||
# Locations found in Keil_v5/TOOLS.INI
|
||||
debuggers = {"st-link":'STLink\\ST-LINKIII-KEIL_SWO.dll',
|
||||
"j-link":'Segger\\JL2CM3.dll',
|
||||
"cmsis-dap":'BIN\\CMSIS_AGDI.dll',
|
||||
"nulink":'NULink\\Nu_Link.dll'}
|
||||
binary = debuggers[self.debug_interface.lower()]
|
||||
return UVDebug(binary, cpu_flag)
|
||||
|
||||
|
||||
class Uvision(Exporter):
|
||||
"""Keil Uvision class
|
||||
|
||||
This class encapsulates information to be contained in a Uvision
|
||||
project file (.uvprojx).
|
||||
The needed information can be viewed in uvision.tmpl
|
||||
"""
|
||||
NAME = 'cmsis'
|
||||
TOOLCHAIN = 'ARM'
|
||||
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
|
||||
if "ARM" in obj.supported_toolchains]
|
||||
#File associations within .uvprojx file
|
||||
file_types = {'.cpp': 8, '.c': 1, '.s': 2,
|
||||
'.obj': 3, '.o': 3, '.lib': 4,
|
||||
'.ar': 4, '.h': 5, '.sct': 4}
|
||||
|
||||
def uv_file(self, loc):
|
||||
"""Return a namedtuple of information about project file
|
||||
Positional Arguments:
|
||||
loc - the file's location
|
||||
|
||||
.uvprojx XML for project file:
|
||||
<File>
|
||||
<FileType>{{file.type}}</FileType>
|
||||
<FileName>{{file.name}}</FileName>
|
||||
<FilePath>{{file.loc}}</FilePath>
|
||||
</File>
|
||||
"""
|
||||
UVFile = namedtuple('UVFile', ['type','loc','name'])
|
||||
_, ext = os.path.splitext(loc)
|
||||
type = self.file_types[ext.lower()]
|
||||
name = ntpath.basename(normpath(loc))
|
||||
return UVFile(type, loc, name)
|
||||
|
||||
def format_flags(self):
|
||||
"""Format toolchain flags for Uvision"""
|
||||
flags = copy.deepcopy(self.flags)
|
||||
asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + \
|
||||
",".join(flags['asm_flags'])
|
||||
# asm flags only, common are not valid within uvision project,
|
||||
# they are armcc specific
|
||||
flags['asm_flags'] = asm_flag_string
|
||||
# cxx flags included, as uvision have them all in one tab
|
||||
flags['c_flags'] = list(set(['-D__ASSERT_MSG']
|
||||
+ flags['common_flags']
|
||||
+ flags['c_flags']
|
||||
+ flags['cxx_flags']))
|
||||
# not compatible with c99 flag set in the template
|
||||
try: flags['c_flags'].remove("--c99")
|
||||
except ValueError: pass
|
||||
# cpp is not required as it's implicit for cpp files
|
||||
try: flags['c_flags'].remove("--cpp")
|
||||
except ValueError: pass
|
||||
# we want no-vla for only cxx, but it's also applied for C in IDE,
|
||||
# thus we remove it
|
||||
try: flags['c_flags'].remove("--no_vla")
|
||||
except ValueError: pass
|
||||
flags['c_flags'] =" ".join(flags['c_flags'])
|
||||
return flags
|
||||
|
||||
def format_src(self, srcs):
|
||||
"""Make sources into the named tuple for use in the template"""
|
||||
grouped = self.group_project_files(srcs)
|
||||
for group, files in grouped.items():
|
||||
grouped[group] = [self.uv_file(src) for src in files]
|
||||
return grouped
|
||||
|
||||
def generate(self):
|
||||
"""Generate the .uvproj file"""
|
||||
cache = Cache(True, False)
|
||||
if cache_d:
|
||||
cache.cache_descriptors()
|
||||
|
||||
srcs = self.resources.headers + self.resources.s_sources + \
|
||||
self.resources.c_sources + self.resources.cpp_sources + \
|
||||
self.resources.objects + self.resources.libraries
|
||||
|
||||
ctx = {
|
||||
'name': self.project_name,
|
||||
'project_files': self.format_src(srcs),
|
||||
'linker_script':self.resources.linker_script,
|
||||
'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'),
|
||||
'device': DeviceUvision(self.target)
|
||||
}
|
||||
ctx.update(self.format_flags())
|
||||
self.gen_file('uvision/uvision.tmpl', ctx, self.project_name+".uvprojx")
|
||||
|
||||
def build(self):
|
||||
ERRORLEVEL = {
|
||||
0: 'success (0 warnings, 0 errors)',
|
||||
1: 'warnings',
|
||||
2: 'errors',
|
||||
3: 'fatal errors',
|
||||
11: 'cant write to project file',
|
||||
12: 'device error',
|
||||
13: 'error writing',
|
||||
15: 'error reading xml file',
|
||||
}
|
||||
success = 0
|
||||
warn = 1
|
||||
if find_executable("UV4"):
|
||||
uv_exe = "UV4.exe"
|
||||
else:
|
||||
uv_exe = join('C:', sep,
|
||||
'Keil_v5', 'UV4', 'UV4.exe')
|
||||
if not exists(uv_exe):
|
||||
raise Exception("UV4.exe not found. Add to path.")
|
||||
cmd = [uv_exe, '-r', '-j0', '-o', join(self.export_dir,'build_log.txt'), join(self.export_dir,self.project_name+".uvprojx")]
|
||||
ret_code = subprocess.call(cmd)
|
||||
if ret_code != success and ret_code != warn:
|
||||
# Seems like something went wrong.
|
||||
raise FailedBuildException("Project: %s build failed with the status: %s" % (
|
||||
self.project_name, ERRORLEVEL.get(ret_code, "Unknown")))
|
||||
else:
|
||||
return "Project: %s build succeeded with the status: %s" % (
|
||||
self.project_name, ERRORLEVEL.get(ret_code, "Unknown"))
|
|
@ -1,25 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>1.1</SchemaVersion>
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>###This file was automagically generated by mbed.org. For more information, see http://mbed.org/handbook/Exporting-To-Uvision </Header>
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>ARM BEETLE SoC</TargetName>
|
||||
<TargetName>{{name}}</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM3</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<Cpu>IROM(0x00000000,0x40000) IRAM(0x20000200,0x1FE00) CPUTYPE("Cortex-M3") CLOCK(24000000) ESEL ELITTLE</Cpu>
|
||||
<Device>{{device.dname}}</Device>
|
||||
<Vendor>{{device.dvendor}}</Vendor>
|
||||
<PackID>{{device.pack_id}}</PackID>
|
||||
<PackURL>{{device.pack_url}}</PackURL>
|
||||
<Cpu></Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<FlashDriverDll>{{device.flash_dll}}</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM3$Device\ARM\ARMCM3\Include\ARMCM3.h</RegisterFile>
|
||||
<RegisterFile>{{device.reg_file}}</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
|
@ -29,7 +31,8 @@
|
|||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<SFDFile>{{device.svd}}</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
|
@ -43,14 +46,14 @@
|
|||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\build\</OutputDirectory>
|
||||
<OutputName></OutputName>
|
||||
<OutputDirectory>.\.build\uvision5\</OutputDirectory>
|
||||
<OutputName>{{name}}</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
<ListingPath>.\build</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
|
@ -71,11 +74,13 @@
|
|||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>$K\ARM\ARMCC\bin\fromelf.exe --bin --output=.\build\@L.bin !L</UserProg1Name>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
|
@ -102,14 +107,14 @@
|
|||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDllName></SimDllName>
|
||||
<SimDllArguments> </SimDllArguments>
|
||||
<SimDlgDll>DCM.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM3</SimDlgDllArguments>
|
||||
<SimDlgDllArguments></SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDllArguments></TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM3</TargetDlgDllArguments>
|
||||
<TargetDlgDllArguments>-{{device.debug_interface.core_flag}}</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
|
@ -144,7 +149,7 @@
|
|||
<RestoreSysVw>1</RestoreSysVw>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>1</TargetSelection>
|
||||
<TargetSelection>0</TargetSelection>
|
||||
<SimDlls>
|
||||
<CpuDll></CpuDll>
|
||||
<CpuDllArguments></CpuDllArguments>
|
||||
|
@ -158,7 +163,7 @@
|
|||
<PeripheralDll></PeripheralDll>
|
||||
<PeripheralDllArguments></PeripheralDllArguments>
|
||||
<InitializationFile></InitializationFile>
|
||||
<Driver>BIN\UL2CM3.DLL</Driver>
|
||||
<Driver>{{device.debug_interface.bin_loc}}</Driver>
|
||||
</TargetDlls>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
|
@ -167,8 +172,8 @@
|
|||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4096</DriverSelection>
|
||||
<Capability>0</Capability>
|
||||
<DriverSelection>-1</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
|
@ -208,7 +213,7 @@
|
|||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M3"</AdsCpuType>
|
||||
<AdsCpuType>"Cortex-M4"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
|
@ -217,12 +222,12 @@
|
|||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>0</RvdsVP>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<EndSel>0</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
|
@ -260,11 +265,11 @@
|
|||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
|
@ -275,15 +280,16 @@
|
|||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
{
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
<StartAddress>0</StartAddress>
|
||||
<Size>0</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
<StartAddress>0</StartAddress>
|
||||
<Size>0</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
|
@ -291,27 +297,27 @@
|
|||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
<Size>0x20000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT5>
|
||||
|
@ -333,19 +339,19 @@
|
|||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
<Size>0x2000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
<StartAddress>0x1fffe000</StartAddress>
|
||||
<Size>0x2000</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>4</Optim>
|
||||
<interw>0</interw>
|
||||
<Optim>2</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>0</OneElfS>
|
||||
|
@ -354,20 +360,27 @@
|
|||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>2</wLevel>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--gnu --no_rtti </MiscControls>
|
||||
<MiscControls>{{c_flags}}</MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
<IncludePath>{{include_paths}}</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<interw>0</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
|
@ -376,8 +389,9 @@
|
|||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<uClangAs>0</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<MiscControls>{{asm_flags}}</MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
|
@ -388,41 +402,35 @@
|
|||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<RepFail>0</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<ScatterFile></ScatterFile>
|
||||
<TextAddressRange>0</TextAddressRange>
|
||||
<DataAddressRange>0</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>{{linker_script}}</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>
|
||||
--entry=Reset_Handler
|
||||
</Misc>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
{% for group, files in project_files.iteritems() %}
|
||||
<Group>
|
||||
<GroupName></GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName></FileName>
|
||||
<FileType></FileType>
|
||||
<FilePath></FilePath>
|
||||
<FileOption>
|
||||
<FileArmAds>
|
||||
<Cads>
|
||||
<VariousControls>
|
||||
<MiscControls>--c99</MiscControls>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
</FileArmAds>
|
||||
</FileOption>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<GroupName>{{group}}</GroupName>
|
||||
<Files>
|
||||
{% for file in files %}
|
||||
<File>
|
||||
<FileType>{{file.type}}</FileType>
|
||||
<FileName>{{file.name}}</FileName>
|
||||
<FilePath>{{file.loc}}</FilePath>
|
||||
</File>
|
||||
{% endfor %}
|
||||
</Files>
|
||||
</Group>
|
||||
{% endfor %}
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
|
@ -1,99 +0,0 @@
|
|||
"""
|
||||
mbed SDK
|
||||
Copyright (c) 2011-2016 ARM Limited
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
from os.path import basename, join, dirname
|
||||
from project_generator_definitions.definitions import ProGenDef
|
||||
|
||||
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
||||
from tools.utils import remove_if_in
|
||||
|
||||
# If you wish to add a new target, add it to project_generator_definitions, and then
|
||||
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
|
||||
# There are 2 default mbed templates (predefined settings) uvision.uvproj and uvproj_microlib.uvproj.tmpl
|
||||
class Uvision4(Exporter):
|
||||
"""
|
||||
Exporter class for uvision. This class uses project generator.
|
||||
"""
|
||||
# These 2 are currently for exporters backward compatiblity
|
||||
NAME = 'uvision'
|
||||
TOOLCHAIN = 'ARM'
|
||||
# PROGEN_ACTIVE contains information for exporter scripts that this is using progen
|
||||
PROGEN_ACTIVE = True
|
||||
|
||||
MBED_CONFIG_HEADER_SUPPORTED = True
|
||||
|
||||
@ExporterTargetsProperty
|
||||
def TARGETS(cls):
|
||||
if not hasattr(cls, "_targets_supported"):
|
||||
cls._targets_supported = []
|
||||
progendef = ProGenDef('uvision')
|
||||
for target in TARGET_NAMES:
|
||||
try:
|
||||
if (progendef.is_supported(str(TARGET_MAP[target])) or
|
||||
progendef.is_supported(TARGET_MAP[target].progen['target'])):
|
||||
cls._targets_supported.append(target)
|
||||
except AttributeError:
|
||||
# target is not supported yet
|
||||
continue
|
||||
return cls._targets_supported
|
||||
|
||||
def get_toolchain(self):
|
||||
return TARGET_MAP[self.target].default_toolchain
|
||||
|
||||
def generate(self):
|
||||
""" Generates the project files """
|
||||
|
||||
print "WARNING: exporting to uVision4 is deprecated and will be removed in a future version"
|
||||
|
||||
project_data = self.progen_get_project_data()
|
||||
tool_specific = {}
|
||||
# Expand tool specific settings by uvision specific settings which are required
|
||||
try:
|
||||
if TARGET_MAP[self.target].progen['uvision']['template']:
|
||||
tool_specific['uvision'] = TARGET_MAP[self.target].progen['uvision']
|
||||
except KeyError:
|
||||
# use default template
|
||||
# by the mbed projects
|
||||
tool_specific['uvision'] = {
|
||||
'template': [join(dirname(__file__), 'uvision.uvproj.tmpl')],
|
||||
}
|
||||
|
||||
project_data['tool_specific'] = {}
|
||||
project_data['tool_specific'].update(tool_specific)
|
||||
|
||||
# get flags from toolchain and apply
|
||||
project_data['misc'] = {}
|
||||
# need to make this a string for progen. Only adds preprocessor when "macros" set
|
||||
asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + ",".join(
|
||||
list(set(self.flags['asm_flags'])))
|
||||
# asm flags only, common are not valid within uvision project, they are armcc specific
|
||||
project_data['misc']['asm_flags'] = [asm_flag_string]
|
||||
# cxx flags included, as uvision have them all in one tab
|
||||
project_data['misc']['c_flags'] = list(set(['-D__ASSERT_MSG']
|
||||
+ self.flags['common_flags']
|
||||
+ self.flags['c_flags']
|
||||
+ self.flags['cxx_flags']))
|
||||
# not compatible with c99 flag set in the template
|
||||
remove_if_in(project_data['misc']['c_flags'], "--c99")
|
||||
# cpp is not required as it's implicit for cpp files
|
||||
remove_if_in(project_data['misc']['c_flags'], "--cpp")
|
||||
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it
|
||||
remove_if_in(project_data['misc']['c_flags'], "--no_vla")
|
||||
project_data['misc']['ld_flags'] = self.flags['ld_flags']
|
||||
|
||||
project_data['build_dir'] = project_data['build_dir'] + '\\' + 'uvision4'
|
||||
self.progen_gen_file(project_data)
|
|
@ -1,97 +0,0 @@
|
|||
"""
|
||||
mbed SDK
|
||||
Copyright (c) 2016 ARM Limited
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
from os.path import basename, join, dirname
|
||||
from project_generator_definitions.definitions import ProGenDef
|
||||
|
||||
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
||||
from tools.utils import remove_if_in
|
||||
|
||||
# If you wish to add a new target, add it to project_generator_definitions, and then
|
||||
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
|
||||
# There are 2 default mbed templates (predefined settings) uvision.uvproj and uvproj_microlib.uvproj.tmpl
|
||||
class Uvision5(Exporter):
|
||||
"""
|
||||
Exporter class for uvision5. This class uses project generator.
|
||||
"""
|
||||
# These 2 are currently for exporters backward compatiblity
|
||||
NAME = 'uvision5'
|
||||
TOOLCHAIN = 'ARM'
|
||||
# PROGEN_ACTIVE contains information for exporter scripts that this is using progen
|
||||
PROGEN_ACTIVE = True
|
||||
|
||||
MBED_CONFIG_HEADER_SUPPORTED = True
|
||||
|
||||
@ExporterTargetsProperty
|
||||
def TARGETS(cls):
|
||||
if not hasattr(cls, "_targets_supported"):
|
||||
cls._targets_supported = []
|
||||
progendef = ProGenDef('uvision5')
|
||||
for target in TARGET_NAMES:
|
||||
try:
|
||||
if (progendef.is_supported(str(TARGET_MAP[target])) or
|
||||
progendef.is_supported(TARGET_MAP[target].progen['target'])):
|
||||
cls._targets_supported.append(target)
|
||||
except AttributeError:
|
||||
# target is not supported yet
|
||||
continue
|
||||
return cls._targets_supported
|
||||
|
||||
def get_toolchain(self):
|
||||
return TARGET_MAP[self.target].default_toolchain
|
||||
|
||||
def generate(self):
|
||||
""" Generates the project files """
|
||||
project_data = self.progen_get_project_data()
|
||||
tool_specific = {}
|
||||
# Expand tool specific settings by uvision specific settings which are required
|
||||
try:
|
||||
if TARGET_MAP[self.target].progen['uvision5']['template']:
|
||||
tool_specific['uvision5'] = TARGET_MAP[self.target].progen['uvision5']
|
||||
except KeyError:
|
||||
# use default template
|
||||
# by the mbed projects
|
||||
tool_specific['uvision5'] = {
|
||||
'template': [join(dirname(__file__), 'uvision.uvproj.tmpl')],
|
||||
}
|
||||
|
||||
#project_data['template'] = [tool_specific['uvision5']['template']]
|
||||
project_data['tool_specific'] = {}
|
||||
project_data['tool_specific'].update(tool_specific)
|
||||
|
||||
# get flags from toolchain and apply
|
||||
project_data['misc'] = {}
|
||||
asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + ",".join(list(set(self.flags['asm_flags'])))
|
||||
# asm flags only, common are not valid within uvision project, they are armcc specific
|
||||
project_data['misc']['asm_flags'] = [asm_flag_string]
|
||||
# cxx flags included, as uvision have them all in one tab
|
||||
project_data['misc']['c_flags'] = list(set(['-D__ASSERT_MSG']
|
||||
+ self.flags['common_flags']
|
||||
+ self.flags['c_flags']
|
||||
+ self.flags['cxx_flags']))
|
||||
# not compatible with c99 flag set in the template
|
||||
remove_if_in(project_data['misc']['c_flags'], "--c99")
|
||||
# cpp is not required as it's implicit for cpp files
|
||||
remove_if_in(project_data['misc']['c_flags'], "--cpp")
|
||||
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it
|
||||
remove_if_in(project_data['misc']['c_flags'], "--no_vla")
|
||||
# not compatible with c99 flag set in the template
|
||||
project_data['misc']['ld_flags'] = self.flags['ld_flags']
|
||||
|
||||
i = 0
|
||||
project_data['build_dir'] = project_data['build_dir'] + '\\' + 'uvision5'
|
||||
self.progen_gen_file(project_data)
|
Loading…
Reference in New Issue