mirror of https://github.com/ARMmbed/mbed-os.git
Initial commit - CoIDE for KL25Z
parent
fa9f5da469
commit
df403f2430
|
@ -20,7 +20,7 @@ from os import makedirs
|
|||
from shutil import copytree, rmtree
|
||||
|
||||
from workspace_tools.utils import mkdir
|
||||
from workspace_tools.export import uvision4, codesourcery, codered, gccarm, ds5_5, iar
|
||||
from workspace_tools.export import uvision4, codesourcery, codered, gccarm, ds5_5, iar, coide
|
||||
from workspace_tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException
|
||||
from workspace_tools.targets import EXPORT_MAP
|
||||
|
||||
|
@ -30,7 +30,8 @@ EXPORTERS = {
|
|||
'codesourcery': codesourcery.CodeSourcery,
|
||||
'gcc_arm': gccarm.GccArm,
|
||||
'ds5_5': ds5_5.DS5_5,
|
||||
'iar': iar.IAREmbeddedWorkbench
|
||||
'iar': iar.IAREmbeddedWorkbench,
|
||||
'coide' : coide.CoIDE
|
||||
}
|
||||
|
||||
ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN = """
|
||||
|
@ -51,16 +52,16 @@ def export(project_path, project_name, ide, target, destination='/tmp/', tempdir
|
|||
# Convention: we are using capitals for toolchain and target names
|
||||
if target is not None:
|
||||
target = target.upper()
|
||||
|
||||
|
||||
if tempdir is None:
|
||||
tempdir = tempfile.mkdtemp()
|
||||
|
||||
|
||||
if ide is None:
|
||||
# Simply copy everything, no project files to be generated
|
||||
for d in ['src', 'lib']:
|
||||
os.system("cp -r %s/* %s" % (join(project_path, d), tempdir))
|
||||
report = {'success': True}
|
||||
|
||||
|
||||
else:
|
||||
report = {'success': False}
|
||||
if ide not in EXPORTERS:
|
||||
|
@ -78,11 +79,11 @@ def export(project_path, project_name, ide, target, destination='/tmp/', tempdir
|
|||
report['success'] = True
|
||||
except OldLibrariesException, e:
|
||||
report['errormsg'] = ERROR_MESSAGE_NOT_EXPORT_LIBS
|
||||
|
||||
|
||||
zip_path = None
|
||||
if report['success']:
|
||||
zip_path = zip_working_directory_and_clean_up(tempdir, destination, project_name, clean)
|
||||
|
||||
|
||||
return zip_path, report
|
||||
|
||||
|
||||
|
@ -95,7 +96,7 @@ def copy_tree(src, dst, clean=True):
|
|||
rmtree(dst)
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
copytree(src, dst)
|
||||
|
||||
|
||||
|
@ -104,14 +105,14 @@ def setup_user_prj(user_dir, prj_path, lib_paths=None):
|
|||
Setup a project with the same directory structure of the mbed online IDE
|
||||
"""
|
||||
mkdir(user_dir)
|
||||
|
||||
|
||||
# Project Path
|
||||
copy_tree(prj_path, join(user_dir, "src"))
|
||||
|
||||
|
||||
# Project Libraries
|
||||
user_lib = join(user_dir, "lib")
|
||||
mkdir(user_lib)
|
||||
|
||||
|
||||
if lib_paths is not None:
|
||||
for lib_path in lib_paths:
|
||||
copy_tree(lib_path, join(user_lib, basename(lib_path)))
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
"""
|
||||
mbed SDK
|
||||
Copyright (c) 2014 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 exporters import Exporter
|
||||
from os.path import splitext, basename
|
||||
|
||||
|
||||
class CoIDE(Exporter):
|
||||
NAME = 'CoIDE'
|
||||
TARGETS = ['KL25Z']
|
||||
TOOLCHAIN = 'GCC_ARM'
|
||||
|
||||
def generate(self):
|
||||
to_be_compiled = []
|
||||
for r_type in ['s_sources', 'c_sources', 'cpp_sources']:
|
||||
r = getattr(self.resources, r_type)
|
||||
if r:
|
||||
for source in r:
|
||||
base, ext = splitext(source)
|
||||
to_be_compiled.append(base + '.o')
|
||||
|
||||
libraries = []
|
||||
for lib in self.resources.libraries:
|
||||
l, _ = splitext(basename(lib))
|
||||
libraries.append(l[3:])
|
||||
|
||||
ctx = {
|
||||
'name': self.program_name,
|
||||
'to_be_compiled': to_be_compiled,
|
||||
'include_paths': self.resources.inc_dirs,
|
||||
'library_paths': self.resources.lib_dirs,
|
||||
'scatter_file': self.resources.linker_script,
|
||||
'object_files': self.resources.objects,
|
||||
'symbols': self.toolchain.get_symbols()
|
||||
}
|
||||
target = self.target.lower()
|
||||
|
||||
# Project file
|
||||
self.gen_file('coide_%s.coproj.tmpl' % target, ctx, '.coproj')
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<Project version="2G - 1.7.5" name="{{name}}">
|
||||
<Target name="{{name}}" isCurrent="1">
|
||||
<Device manufacturerId="4" manufacturerName="Freescale" chipId="86" chipName="MKL25Z128VLK4" boardId="" boardName=""/>
|
||||
<BuildOption>
|
||||
<Compile>
|
||||
<Option name="OptimizationLevel" value="0"/>
|
||||
<Option name="UseFPU" value="0"/>
|
||||
<Option name="UserEditCompiler" value="-Wl, --specs=nano.specs -fno-common; -fmessage-length=0; -Wall; -fno-exceptions; -ffunction-sections; -fdata-sections; {% for s in symbols %}-D{{s}}; {% endfor %} -std=gnu++98"/>
|
||||
<Includepaths>
|
||||
<Includepath path="."/>
|
||||
<Includepath path="mbed"/>
|
||||
<Includepath path="mbed/target_kl25z"/>
|
||||
<Includepath path="mbed/target_kl25z/toolchain_gcc_arm"/>
|
||||
</Includepaths>
|
||||
<DefinedSymbols>
|
||||
<Define name="MKL25Z128VLK4"/>
|
||||
</DefinedSymbols>
|
||||
</Compile>
|
||||
<Link useDefault="0">
|
||||
<Option name="DiscardUnusedSection" value="0"/>
|
||||
<Option name="UserEditLinkder" value=""/>
|
||||
<Option name="UseMemoryLayout" value="0"/>
|
||||
<Option name="LTO" value="0"/>
|
||||
<Option name="IsNewStartupCode" value="1"/>
|
||||
<Option name="Library" value="Not use C Library"/>
|
||||
<Option name="nostartfiles" value="0"/>
|
||||
<Option name="UserEditLinker" value="C:/CooCox/CoIDE/workspace/{{name}}/mbed/target_kl25z/toolchain_gcc_arm/cmsis_nvic.o; C:/CooCox/CoIDE/workspace/{{name}}/mbed/target_kl25z/toolchain_gcc_arm/retarget.o; C:/CooCox/CoIDE/workspace/{{name}}/mbed/target_kl25z/toolchain_gcc_arm/startup_MKL25Z4.o; C:/CooCox/CoIDE/workspace/{{name}}/mbed/target_kl25z/toolchain_gcc_arm/system_MKL25Z4.o; -lmbed; -lstdc++; -lsupc++; -lm; -lc; -lgcc; -lnosys; -lmbed; -lstdc++; -lsupc++; -lm; -lc; -lgcc; -lnosys; "/>
|
||||
<LinkedLibraries/>
|
||||
<MemoryAreas debugInFlashNotRAM="1">
|
||||
<Memory name="IROM1" type="ReadOnly" size="0x00020000" startValue="0x00000000"/>
|
||||
<Memory name="IRAM1" type="ReadWrite" size="0x00001000" startValue="0x1FFFF000"/>
|
||||
<Memory name="IROM2" type="ReadOnly" size="" startValue=""/>
|
||||
<Memory name="IRAM2" type="ReadWrite" size="" startValue=""/>
|
||||
</MemoryAreas>
|
||||
<LocateLinkFile path="mbed/target_kl25z/toolchain_gcc_arm/mkl25z4.ld" type="0"/>
|
||||
</Link>
|
||||
<Output>
|
||||
<Option name="OutputFileType" value="0"/>
|
||||
<Option name="Path" value="./"/>
|
||||
<Option name="Name" value="{{name}}"/>
|
||||
<Option name="HEX" value="1"/>
|
||||
<Option name="BIN" value="1"/>
|
||||
</Output>
|
||||
<User>
|
||||
<UserRun name="Run#1" type="Before" checked="0" value=""/>
|
||||
<UserRun name="Run#1" type="After" checked="0" value=""/>
|
||||
</User>
|
||||
</BuildOption>
|
||||
<DebugOption>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.adapter" value="CMSIS-DAP"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.debugMode" value="SWD"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.clockDiv" value="1M"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.corerunToMain" value="1"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkgdbserver" value=""/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.userDefineGDBScript" value=""/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.targetEndianess" value="0"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkResetMode" value="Type 0: Normal"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.resetMode" value="SYSRESETREQ"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifSemihost" value="0"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.ifCacheRom" value="1"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.ipAddress" value="127.0.0.1"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.portNumber" value="2009"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.autoDownload" value="1"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.verify" value="1"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.downloadFuction" value="Erase Effected"/>
|
||||
<Option name="org.coocox.codebugger.gdbjtag.core.defaultAlgorithm" value="KLxx_128_PRG_NO_CFG.elf"/>
|
||||
</DebugOption>
|
||||
<ExcludeFile/>
|
||||
</Target>
|
||||
<Components path="./"/>
|
||||
<Files>
|
||||
<File name="main.cpp" path="main.cpp" type="1"/>
|
||||
</Files>
|
||||
</Project>
|
Loading…
Reference in New Issue