mirror of https://github.com/ARMmbed/mbed-os.git
Correct syntax for mbed export in Py3
parent
59c46001ff
commit
14255ca113
|
@ -14,6 +14,9 @@ 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 __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
from os import remove, getcwd, chdir, mkdir
|
from os import remove, getcwd, chdir, mkdir
|
||||||
|
@ -162,7 +165,7 @@ class CMake(Exporter):
|
||||||
else:
|
else:
|
||||||
out_string += "FAILURE"
|
out_string += "FAILURE"
|
||||||
|
|
||||||
print out_string
|
print(out_string)
|
||||||
|
|
||||||
if log_name:
|
if log_name:
|
||||||
# Write the output to the log file
|
# Write the output to the log file
|
||||||
|
|
|
@ -21,6 +21,8 @@ the GNU ARM Eclipse plug-ins.
|
||||||
|
|
||||||
Author: Liviu Ionescu <ilg@livius.net>
|
Author: Liviu Ionescu <ilg@livius.net>
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import copy
|
import copy
|
||||||
|
@ -139,8 +141,6 @@ class GNUARMEclipse(Exporter):
|
||||||
# TODO: use some logger to display additional info if verbose
|
# TODO: use some logger to display additional info if verbose
|
||||||
|
|
||||||
libraries = []
|
libraries = []
|
||||||
# print 'libraries'
|
|
||||||
# print self.resources.libraries
|
|
||||||
for lib in self.resources.libraries:
|
for lib in self.resources.libraries:
|
||||||
l, _ = splitext(basename(lib))
|
l, _ = splitext(basename(lib))
|
||||||
libraries.append(l[3:])
|
libraries.append(l[3:])
|
||||||
|
@ -158,28 +158,22 @@ class GNUARMEclipse(Exporter):
|
||||||
# TODO: get the list from existing .cproject
|
# TODO: get the list from existing .cproject
|
||||||
build_folders = [s.capitalize() for s in profile_ids]
|
build_folders = [s.capitalize() for s in profile_ids]
|
||||||
build_folders.append('BUILD')
|
build_folders.append('BUILD')
|
||||||
# print build_folders
|
|
||||||
|
|
||||||
objects = [self.filter_dot(s) for s in self.resources.objects]
|
objects = [self.filter_dot(s) for s in self.resources.objects]
|
||||||
for bf in build_folders:
|
for bf in build_folders:
|
||||||
objects = [o for o in objects if not o.startswith(bf + '/')]
|
objects = [o for o in objects if not o.startswith(bf + '/')]
|
||||||
# print 'objects'
|
|
||||||
# print objects
|
|
||||||
|
|
||||||
self.compute_exclusions()
|
self.compute_exclusions()
|
||||||
|
|
||||||
self.include_path = [
|
self.include_path = [
|
||||||
self.filter_dot(s) for s in self.resources.inc_dirs]
|
self.filter_dot(s) for s in self.resources.inc_dirs]
|
||||||
print 'Include folders: {0}'.format(len(self.include_path))
|
|
||||||
|
|
||||||
self.as_defines = self.toolchain.get_symbols(True)
|
self.as_defines = self.toolchain.get_symbols(True)
|
||||||
self.c_defines = self.toolchain.get_symbols()
|
self.c_defines = self.toolchain.get_symbols()
|
||||||
self.cpp_defines = self.c_defines
|
self.cpp_defines = self.c_defines
|
||||||
print 'Symbols: {0}'.format(len(self.c_defines))
|
|
||||||
|
|
||||||
self.ld_script = self.filter_dot(
|
self.ld_script = self.filter_dot(
|
||||||
self.resources.linker_script)
|
self.resources.linker_script)
|
||||||
print 'Linker script: {0}'.format(self.ld_script)
|
|
||||||
|
|
||||||
self.options = {}
|
self.options = {}
|
||||||
for id in profile_ids:
|
for id in profile_ids:
|
||||||
|
@ -196,8 +190,6 @@ class GNUARMEclipse(Exporter):
|
||||||
opts['id'] = id
|
opts['id'] = id
|
||||||
opts['name'] = opts['id'].capitalize()
|
opts['name'] = opts['id'].capitalize()
|
||||||
|
|
||||||
print
|
|
||||||
print 'Build configuration: {0}'.format(opts['name'])
|
|
||||||
|
|
||||||
profile = profiles[id]
|
profile = profiles[id]
|
||||||
|
|
||||||
|
@ -215,12 +207,6 @@ class GNUARMEclipse(Exporter):
|
||||||
|
|
||||||
flags = self.toolchain_flags(toolchain)
|
flags = self.toolchain_flags(toolchain)
|
||||||
|
|
||||||
print 'Common flags:', ' '.join(flags['common_flags'])
|
|
||||||
print 'C++ flags:', ' '.join(flags['cxx_flags'])
|
|
||||||
print 'C flags:', ' '.join(flags['c_flags'])
|
|
||||||
print 'ASM flags:', ' '.join(flags['asm_flags'])
|
|
||||||
print 'Linker flags:', ' '.join(flags['ld_flags'])
|
|
||||||
|
|
||||||
# Most GNU ARM Eclipse options have a parent,
|
# Most GNU ARM Eclipse options have a parent,
|
||||||
# either debug or release.
|
# either debug or release.
|
||||||
if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']:
|
if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']:
|
||||||
|
@ -281,11 +267,6 @@ class GNUARMEclipse(Exporter):
|
||||||
"""
|
"""
|
||||||
jinja_ctx = self.create_jinja_ctx()
|
jinja_ctx = self.create_jinja_ctx()
|
||||||
|
|
||||||
print
|
|
||||||
print 'Create a GNU ARM Eclipse C++ managed project'
|
|
||||||
print 'Project name: {0}'.format(self.project_name)
|
|
||||||
print 'Target: {0}'.format(self.toolchain.target.name)
|
|
||||||
print 'Toolchain: {0}'.format(self.TOOLCHAIN)
|
|
||||||
|
|
||||||
self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx,
|
self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx,
|
||||||
'.project', trim_blocks=True, lstrip_blocks=True)
|
'.project', trim_blocks=True, lstrip_blocks=True)
|
||||||
|
@ -296,8 +277,7 @@ class GNUARMEclipse(Exporter):
|
||||||
self.gen_file_nonoverwrite('gnuarmeclipse/mbedignore.tmpl', jinja_ctx,
|
self.gen_file_nonoverwrite('gnuarmeclipse/mbedignore.tmpl', jinja_ctx,
|
||||||
'.mbedignore')
|
'.mbedignore')
|
||||||
|
|
||||||
print
|
print('Done. Import the \'{0}\' project in Eclipse.'.format(self.project_name))
|
||||||
print 'Done. Import the \'{0}\' project in Eclipse.'.format(self.project_name)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clean(_):
|
def clean(_):
|
||||||
|
@ -363,7 +343,7 @@ class GNUARMEclipse(Exporter):
|
||||||
if ret_code != 0:
|
if ret_code != 0:
|
||||||
ret_string += "FAILURE\n"
|
ret_string += "FAILURE\n"
|
||||||
|
|
||||||
print "%s\n%s\n%s\n%s" % (stdout_string, out, err_string, ret_string)
|
print("%s\n%s\n%s\n%s" % (stdout_string, out, err_string, ret_string))
|
||||||
|
|
||||||
if log_name:
|
if log_name:
|
||||||
# Write the output to the log file
|
# Write the output to the log file
|
||||||
|
@ -397,11 +377,9 @@ class GNUARMEclipse(Exporter):
|
||||||
file_names = [join(tools_path, "profiles", fn) for fn in os.listdir(
|
file_names = [join(tools_path, "profiles", fn) for fn in os.listdir(
|
||||||
join(tools_path, "profiles")) if fn.endswith(".json")]
|
join(tools_path, "profiles")) if fn.endswith(".json")]
|
||||||
|
|
||||||
# print file_names
|
|
||||||
|
|
||||||
profile_names = [basename(fn).replace(".json", "")
|
profile_names = [basename(fn).replace(".json", "")
|
||||||
for fn in file_names]
|
for fn in file_names]
|
||||||
# print profile_names
|
|
||||||
|
|
||||||
profiles = {}
|
profiles = {}
|
||||||
|
|
||||||
|
@ -435,7 +413,6 @@ class GNUARMEclipse(Exporter):
|
||||||
src) for src in self.resources.c_sources + self.resources.cpp_sources + self.resources.s_sources)]
|
src) for src in self.resources.c_sources + self.resources.cpp_sources + self.resources.s_sources)]
|
||||||
|
|
||||||
self.excluded_folders = set(self.resources.ignored_dirs) - set(self.resources.inc_dirs)
|
self.excluded_folders = set(self.resources.ignored_dirs) - set(self.resources.inc_dirs)
|
||||||
print 'Source folders: {0}, with {1} exclusions'.format(len(source_folders), len(self.excluded_folders))
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
@ -460,7 +437,6 @@ class GNUARMEclipse(Exporter):
|
||||||
node = nodes[k]
|
node = nodes[k]
|
||||||
parent_name = node['parent'][
|
parent_name = node['parent'][
|
||||||
'name'] if 'parent' in node.keys() else ''
|
'name'] if 'parent' in node.keys() else ''
|
||||||
print ' ' * depth, node['name'], node['is_used'], parent_name
|
|
||||||
if len(node['children'].keys()) != 0:
|
if len(node['children'].keys()) != 0:
|
||||||
self.dump_tree(node['children'], depth + 1)
|
self.dump_tree(node['children'], depth + 1)
|
||||||
|
|
||||||
|
@ -474,7 +450,6 @@ class GNUARMEclipse(Exporter):
|
||||||
break
|
break
|
||||||
node = node['parent']
|
node = node['parent']
|
||||||
path = '/'.join(parts)
|
path = '/'.join(parts)
|
||||||
print path, nodes[k]['is_used']
|
|
||||||
self.dump_paths(nodes[k]['children'], depth + 1)
|
self.dump_paths(nodes[k]['children'], depth + 1)
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
@ -504,14 +479,6 @@ class GNUARMEclipse(Exporter):
|
||||||
# Make a copy of the flags, to be one by one removed after processing.
|
# Make a copy of the flags, to be one by one removed after processing.
|
||||||
flags = copy.deepcopy(flags_in)
|
flags = copy.deepcopy(flags_in)
|
||||||
|
|
||||||
if False:
|
|
||||||
print
|
|
||||||
print 'common_flags', flags['common_flags']
|
|
||||||
print 'asm_flags', flags['asm_flags']
|
|
||||||
print 'c_flags', flags['c_flags']
|
|
||||||
print 'cxx_flags', flags['cxx_flags']
|
|
||||||
print 'ld_flags', flags['ld_flags']
|
|
||||||
|
|
||||||
# Initialise the 'last resort' options where all unrecognised
|
# Initialise the 'last resort' options where all unrecognised
|
||||||
# options will be collected.
|
# options will be collected.
|
||||||
opts['as']['other'] = ''
|
opts['as']['other'] = ''
|
||||||
|
@ -944,17 +911,6 @@ class GNUARMEclipse(Exporter):
|
||||||
opts['cpp']['other'] = opts['cpp']['other'].strip()
|
opts['cpp']['other'] = opts['cpp']['other'].strip()
|
||||||
opts['ld']['other'] = opts['ld']['other'].strip()
|
opts['ld']['other'] = opts['ld']['other'].strip()
|
||||||
|
|
||||||
if False:
|
|
||||||
print
|
|
||||||
print opts
|
|
||||||
|
|
||||||
print
|
|
||||||
print 'common_flags', flags['common_flags']
|
|
||||||
print 'asm_flags', flags['asm_flags']
|
|
||||||
print 'c_flags', flags['c_flags']
|
|
||||||
print 'cxx_flags', flags['cxx_flags']
|
|
||||||
print 'ld_flags', flags['ld_flags']
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def find_options(lst, option):
|
def find_options(lst, option):
|
||||||
tmp = [str for str in lst if str.startswith(option)]
|
tmp = [str for str in lst if str.startswith(option)]
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from os.path import sep, join, exists
|
from os.path import sep, join, exists
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
@ -181,7 +184,7 @@ class IAR(Exporter):
|
||||||
else:
|
else:
|
||||||
out_string += "FAILURE"
|
out_string += "FAILURE"
|
||||||
|
|
||||||
print out_string
|
print(out_string)
|
||||||
|
|
||||||
if log_name:
|
if log_name:
|
||||||
# Write the output to the log file
|
# Write the output to the log file
|
||||||
|
|
|
@ -14,6 +14,9 @@ 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 __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
from os.path import splitext, basename, relpath, join, abspath, dirname,\
|
from os.path import splitext, basename, relpath, join, abspath, dirname,\
|
||||||
exists
|
exists
|
||||||
from os import remove
|
from os import remove
|
||||||
|
@ -178,7 +181,7 @@ class Makefile(Exporter):
|
||||||
else:
|
else:
|
||||||
out_string += "FAILURE"
|
out_string += "FAILURE"
|
||||||
|
|
||||||
print out_string
|
print(out_string)
|
||||||
|
|
||||||
if log_name:
|
if log_name:
|
||||||
# Write the output to the log file
|
# Write the output to the log file
|
||||||
|
|
|
@ -22,6 +22,8 @@ the MCUXpresso IDE from NXP
|
||||||
Based on GNU ARM Eclipse Exporter from Liviu Ionescu <ilg@livius.net>
|
Based on GNU ARM Eclipse Exporter from Liviu Ionescu <ilg@livius.net>
|
||||||
modified for MCUXpresso by Johannes Stratmann <jojos62@online.de>
|
modified for MCUXpresso by Johannes Stratmann <jojos62@online.de>
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -39,9 +41,6 @@ from tools.utils import NotSupportedException
|
||||||
from tools.build_api import prepare_toolchain
|
from tools.build_api import prepare_toolchain
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
|
||||||
|
|
||||||
|
|
||||||
POST_BINARY_WHITELIST = set([
|
POST_BINARY_WHITELIST = set([
|
||||||
"TEENSY3_1Code.binary_hook",
|
"TEENSY3_1Code.binary_hook",
|
||||||
"MCU_NRF51Code.binary_hook",
|
"MCU_NRF51Code.binary_hook",
|
||||||
|
@ -73,12 +72,6 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
if not self.resources.linker_script:
|
if not self.resources.linker_script:
|
||||||
raise NotSupportedException("No linker script found.")
|
raise NotSupportedException("No linker script found.")
|
||||||
|
|
||||||
print
|
|
||||||
print 'Create a GNU ARM Eclipse C++ managed project'
|
|
||||||
print 'Project name: {0}'.format(self.project_name)
|
|
||||||
print 'Target: {0}'.format(self.toolchain.target.name)
|
|
||||||
print 'Toolchain: {0}'.format(self.TOOLCHAIN)
|
|
||||||
|
|
||||||
self.resources.win_to_unix()
|
self.resources.win_to_unix()
|
||||||
|
|
||||||
# TODO: use some logger to display additional info if verbose
|
# TODO: use some logger to display additional info if verbose
|
||||||
|
@ -115,16 +108,13 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
|
|
||||||
self.include_path = [
|
self.include_path = [
|
||||||
self.filter_dot(s) for s in self.resources.inc_dirs]
|
self.filter_dot(s) for s in self.resources.inc_dirs]
|
||||||
print 'Include folders: {0}'.format(len(self.include_path))
|
|
||||||
|
|
||||||
self.as_defines = self.toolchain.get_symbols(True)
|
self.as_defines = self.toolchain.get_symbols(True)
|
||||||
self.c_defines = self.toolchain.get_symbols()
|
self.c_defines = self.toolchain.get_symbols()
|
||||||
self.cpp_defines = self.c_defines
|
self.cpp_defines = self.c_defines
|
||||||
print 'Symbols: {0}'.format(len(self.c_defines))
|
|
||||||
|
|
||||||
self.ld_script = self.filter_dot(
|
self.ld_script = self.filter_dot(
|
||||||
self.resources.linker_script)
|
self.resources.linker_script)
|
||||||
print 'Linker script: {0}'.format(self.ld_script)
|
|
||||||
|
|
||||||
self.options = {}
|
self.options = {}
|
||||||
profile_ids.remove('develop')
|
profile_ids.remove('develop')
|
||||||
|
@ -143,7 +133,6 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
opts['name'] = opts['id'].capitalize()
|
opts['name'] = opts['id'].capitalize()
|
||||||
|
|
||||||
print
|
print
|
||||||
print 'Build configuration: {0}'.format(opts['name'])
|
|
||||||
|
|
||||||
profile = profiles[id]
|
profile = profiles[id]
|
||||||
|
|
||||||
|
@ -159,12 +148,6 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
|
|
||||||
flags = self.toolchain_flags(toolchain)
|
flags = self.toolchain_flags(toolchain)
|
||||||
|
|
||||||
print 'Common flags:', ' '.join(flags['common_flags'])
|
|
||||||
print 'C++ flags:', ' '.join(flags['cxx_flags'])
|
|
||||||
print 'C flags:', ' '.join(flags['c_flags'])
|
|
||||||
print 'ASM flags:', ' '.join(flags['asm_flags'])
|
|
||||||
print 'Linker flags:', ' '.join(flags['ld_flags'])
|
|
||||||
|
|
||||||
# Most GNU ARM Eclipse options have a parent,
|
# Most GNU ARM Eclipse options have a parent,
|
||||||
# either debug or release.
|
# either debug or release.
|
||||||
if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']:
|
if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']:
|
||||||
|
@ -227,8 +210,8 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
self.gen_file_nonoverwrite('mcuxpresso/mbedignore.tmpl', jinja_ctx,
|
self.gen_file_nonoverwrite('mcuxpresso/mbedignore.tmpl', jinja_ctx,
|
||||||
'.mbedignore')
|
'.mbedignore')
|
||||||
|
|
||||||
print
|
print('Done. Import the \'{0}\' project in MCUXpresso.'.format(
|
||||||
print 'Done. Import the \'{0}\' project in Eclipse.'.format(self.project_name)
|
self.project_name))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clean(_):
|
def clean(_):
|
||||||
|
@ -296,7 +279,7 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
else:
|
else:
|
||||||
ret_string = "FAILURE: build returned %s \n" % ret_code
|
ret_string = "FAILURE: build returned %s \n" % ret_code
|
||||||
|
|
||||||
print "%s\n%s\n%s\n%s" % (stdout_string, out, err_string, ret_string)
|
print("%s\n%s\n%s\n%s" % (stdout_string, out, err_string, ret_string))
|
||||||
|
|
||||||
if log_name:
|
if log_name:
|
||||||
# Write the output to the log file
|
# Write the output to the log file
|
||||||
|
@ -346,14 +329,6 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
# Make a copy of the flags, to be one by one removed after processing.
|
# Make a copy of the flags, to be one by one removed after processing.
|
||||||
flags = copy.deepcopy(flags_in)
|
flags = copy.deepcopy(flags_in)
|
||||||
|
|
||||||
if False:
|
|
||||||
print
|
|
||||||
print 'common_flags', flags['common_flags']
|
|
||||||
print 'asm_flags', flags['asm_flags']
|
|
||||||
print 'c_flags', flags['c_flags']
|
|
||||||
print 'cxx_flags', flags['cxx_flags']
|
|
||||||
print 'ld_flags', flags['ld_flags']
|
|
||||||
|
|
||||||
# Initialise the 'last resort' options where all unrecognised
|
# Initialise the 'last resort' options where all unrecognised
|
||||||
# options will be collected.
|
# options will be collected.
|
||||||
opts['as']['other'] = ''
|
opts['as']['other'] = ''
|
||||||
|
@ -733,15 +708,3 @@ class MCUXpresso(GNUARMEclipse):
|
||||||
opts['c']['other'] = opts['c']['other'].strip()
|
opts['c']['other'] = opts['c']['other'].strip()
|
||||||
opts['cpp']['other'] = opts['cpp']['other'].strip()
|
opts['cpp']['other'] = opts['cpp']['other'].strip()
|
||||||
opts['ld']['other'] = opts['ld']['other'].strip()
|
opts['ld']['other'] = opts['ld']['other'].strip()
|
||||||
|
|
||||||
if False:
|
|
||||||
print
|
|
||||||
print opts
|
|
||||||
|
|
||||||
print
|
|
||||||
print 'common_flags', flags['common_flags']
|
|
||||||
print 'asm_flags', flags['asm_flags']
|
|
||||||
print 'c_flags', flags['c_flags']
|
|
||||||
print 'cxx_flags', flags['cxx_flags']
|
|
||||||
print 'ld_flags', flags['ld_flags']
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
from __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import copy
|
import copy
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from os.path import relpath, join, exists, dirname, basename
|
from os.path import relpath, join, exists, dirname, basename
|
||||||
from os import makedirs
|
from os import makedirs, remove
|
||||||
from json import load
|
from json import load
|
||||||
|
|
||||||
from tools.export.exporters import Exporter, apply_supported_whitelist
|
from tools.export.exporters import Exporter, apply_supported_whitelist
|
||||||
|
@ -49,7 +52,7 @@ class GNUARMNetbeans(Exporter):
|
||||||
config_header = self.toolchain.get_config_header()
|
config_header = self.toolchain.get_config_header()
|
||||||
|
|
||||||
flags = {key + "_flags": copy.deepcopy(value) for key, value
|
flags = {key + "_flags": copy.deepcopy(value) for key, value
|
||||||
in toolchain.flags.iteritems()}
|
in toolchain.flags.items()}
|
||||||
if config_header:
|
if config_header:
|
||||||
config_header = relpath(config_header,
|
config_header = relpath(config_header,
|
||||||
self.resources.file_basepath[config_header])
|
self.resources.file_basepath[config_header])
|
||||||
|
@ -130,13 +133,8 @@ class GNUARMNetbeans(Exporter):
|
||||||
# Convert all Backslashes to Forward Slashes
|
# Convert all Backslashes to Forward Slashes
|
||||||
self.resources.win_to_unix()
|
self.resources.win_to_unix()
|
||||||
|
|
||||||
print 'Include folders: {0}'.format(len(self.resources.inc_dirs))
|
|
||||||
|
|
||||||
print 'Symbols: {0}'.format(len(self.toolchain.get_symbols()))
|
|
||||||
|
|
||||||
self.ld_script = self.filter_dot(
|
self.ld_script = self.filter_dot(
|
||||||
self.resources.linker_script)
|
self.resources.linker_script)
|
||||||
print 'Linker script: {0}'.format(self.ld_script)
|
|
||||||
|
|
||||||
# Read in all profiles, we'll extract compiler options.
|
# Read in all profiles, we'll extract compiler options.
|
||||||
profiles = self.get_all_profiles()
|
profiles = self.get_all_profiles()
|
||||||
|
@ -157,9 +155,6 @@ class GNUARMNetbeans(Exporter):
|
||||||
opts['id'] = prof_id
|
opts['id'] = prof_id
|
||||||
opts['name'] = opts['id'].capitalize()
|
opts['name'] = opts['id'].capitalize()
|
||||||
|
|
||||||
print
|
|
||||||
print 'Build configuration: {0}'.format(opts['name'])
|
|
||||||
|
|
||||||
profile = profiles[prof_id]
|
profile = profiles[prof_id]
|
||||||
|
|
||||||
# A small hack, do not bother with src_path again,
|
# A small hack, do not bother with src_path again,
|
||||||
|
@ -172,12 +167,6 @@ class GNUARMNetbeans(Exporter):
|
||||||
|
|
||||||
flags = self.toolchain_flags(toolchain)
|
flags = self.toolchain_flags(toolchain)
|
||||||
|
|
||||||
print 'Common flags:', ' '.join(flags['common_flags'])
|
|
||||||
print 'C++ flags:', ' '.join(flags['cxx_flags'])
|
|
||||||
print 'C flags:', ' '.join(flags['c_flags'])
|
|
||||||
print 'ASM flags:', ' '.join(flags['asm_flags'])
|
|
||||||
print 'Linker flags:', ' '.join(flags['ld_flags'])
|
|
||||||
|
|
||||||
opts['defines'] = self.get_defines_and_remove_from_flags(flags, 'common_flags')
|
opts['defines'] = self.get_defines_and_remove_from_flags(flags, 'common_flags')
|
||||||
opts['forced_includes'] = self.get_includes_and_remove_from_flags(flags, 'common_flags')
|
opts['forced_includes'] = self.get_includes_and_remove_from_flags(flags, 'common_flags')
|
||||||
opts['common'] = flags['common_flags']
|
opts['common'] = flags['common_flags']
|
||||||
|
@ -258,12 +247,6 @@ class GNUARMNetbeans(Exporter):
|
||||||
"""
|
"""
|
||||||
jinja_ctx = self.create_jinja_ctx()
|
jinja_ctx = self.create_jinja_ctx()
|
||||||
|
|
||||||
print
|
|
||||||
print 'Create a GNU ARM Netbeans C++ managed project'
|
|
||||||
print 'Project name: {0}'.format(self.project_name)
|
|
||||||
print 'Target: {0}'.format(self.toolchain.target.name)
|
|
||||||
print 'Toolchain: {0}'.format(self.TOOLCHAIN)
|
|
||||||
|
|
||||||
if not exists(join(self.export_dir, 'nbproject')):
|
if not exists(join(self.export_dir, 'nbproject')):
|
||||||
makedirs(join(self.export_dir, 'nbproject'))
|
makedirs(join(self.export_dir, 'nbproject'))
|
||||||
|
|
||||||
|
@ -273,8 +256,7 @@ class GNUARMNetbeans(Exporter):
|
||||||
'.mbedignore')
|
'.mbedignore')
|
||||||
self.gen_file('nb/Makefile.tmpl', jinja_ctx, 'Makefile')
|
self.gen_file('nb/Makefile.tmpl', jinja_ctx, 'Makefile')
|
||||||
|
|
||||||
print
|
print('Done. Import the \'{0}\' project in Netbeans.'.format(self.project_name))
|
||||||
print 'Done. Import the \'{0}\' project in Netbeans.'.format(self.project_name)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clean(_):
|
def clean(_):
|
||||||
|
|
|
@ -14,6 +14,8 @@ 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 __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
from os.path import splitext, basename, join
|
from os.path import splitext, basename, join
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -420,10 +422,10 @@ class Sw4STM32(GNUARMEclipse):
|
||||||
if not self.resources.linker_script:
|
if not self.resources.linker_script:
|
||||||
raise NotSupportedException("No linker script found.")
|
raise NotSupportedException("No linker script found.")
|
||||||
|
|
||||||
print ('\nCreate a System Workbench for STM32 managed project')
|
print('\nCreate a System Workbench for STM32 managed project')
|
||||||
print ('Project name: {0}'.format(self.project_name))
|
print('Project name: {0}'.format(self.project_name))
|
||||||
print ('Target: {0}'.format(self.toolchain.target.name))
|
print('Target: {0}'.format(self.toolchain.target.name))
|
||||||
print ('Toolchain: {0}'.format(self.TOOLCHAIN) + '\n')
|
print('Toolchain: {0}'.format(self.TOOLCHAIN) + '\n')
|
||||||
|
|
||||||
self.resources.win_to_unix()
|
self.resources.win_to_unix()
|
||||||
|
|
||||||
|
@ -444,19 +446,18 @@ class Sw4STM32(GNUARMEclipse):
|
||||||
self.c_defines = [s.replace('"', '"')
|
self.c_defines = [s.replace('"', '"')
|
||||||
for s in self.toolchain.get_symbols()]
|
for s in self.toolchain.get_symbols()]
|
||||||
self.cpp_defines = self.c_defines
|
self.cpp_defines = self.c_defines
|
||||||
print 'Symbols: {0}'.format(len(self.c_defines))
|
|
||||||
|
|
||||||
self.include_path = []
|
self.include_path = []
|
||||||
for s in self.resources.inc_dirs:
|
for s in self.resources.inc_dirs:
|
||||||
self.include_path.append("../" + self.filter_dot(s))
|
self.include_path.append("../" + self.filter_dot(s))
|
||||||
print ('Include folders: {0}'.format(len(self.include_path)))
|
print('Include folders: {0}'.format(len(self.include_path)))
|
||||||
|
|
||||||
self.compute_exclusions()
|
self.compute_exclusions()
|
||||||
|
|
||||||
print ('Exclude folders: {0}'.format(len(self.excluded_folders)))
|
print('Exclude folders: {0}'.format(len(self.excluded_folders)))
|
||||||
|
|
||||||
ld_script = self.filter_dot(self.resources.linker_script)
|
ld_script = self.filter_dot(self.resources.linker_script)
|
||||||
print ('Linker script: {0}'.format(ld_script))
|
print('Linker script: {0}'.format(ld_script))
|
||||||
|
|
||||||
lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs]
|
lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs]
|
||||||
|
|
||||||
|
@ -473,9 +474,6 @@ class Sw4STM32(GNUARMEclipse):
|
||||||
opts['id'] = id
|
opts['id'] = id
|
||||||
opts['name'] = opts['id'].capitalize()
|
opts['name'] = opts['id'].capitalize()
|
||||||
|
|
||||||
# TODO: Add prints to log or console in verbose mode.
|
|
||||||
#print ('\nBuild configuration: {0}'.format(opts['name']))
|
|
||||||
|
|
||||||
profile = profiles[id]
|
profile = profiles[id]
|
||||||
|
|
||||||
# A small hack, do not bother with src_path again,
|
# A small hack, do not bother with src_path again,
|
||||||
|
@ -489,13 +487,6 @@ class Sw4STM32(GNUARMEclipse):
|
||||||
|
|
||||||
flags = self.toolchain_flags(toolchain)
|
flags = self.toolchain_flags(toolchain)
|
||||||
|
|
||||||
# TODO: Add prints to log or console in verbose mode.
|
|
||||||
# print 'Common flags:', ' '.join(flags['common_flags'])
|
|
||||||
# print 'C++ flags:', ' '.join(flags['cxx_flags'])
|
|
||||||
# print 'C flags:', ' '.join(flags['c_flags'])
|
|
||||||
# print 'ASM flags:', ' '.join(flags['asm_flags'])
|
|
||||||
# print 'Linker flags:', ' '.join(flags['ld_flags'])
|
|
||||||
|
|
||||||
# Most GNU ARM Eclipse options have a parent,
|
# Most GNU ARM Eclipse options have a parent,
|
||||||
# either debug or release.
|
# either debug or release.
|
||||||
if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']:
|
if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']:
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from os.path import sep, normpath, join, exists
|
from os.path import sep, normpath, join, exists
|
||||||
import ntpath
|
import ntpath
|
||||||
|
@ -12,9 +15,6 @@ from tools.targets import TARGET_MAP
|
||||||
from tools.export.exporters import Exporter, apply_supported_whitelist
|
from tools.export.exporters import Exporter, apply_supported_whitelist
|
||||||
from tools.export.cmsis import DeviceCMSIS
|
from tools.export.cmsis import DeviceCMSIS
|
||||||
|
|
||||||
cache_d = False
|
|
||||||
|
|
||||||
|
|
||||||
class DeviceUvision(DeviceCMSIS):
|
class DeviceUvision(DeviceCMSIS):
|
||||||
"""Uvision Device class, inherits CMSIS Device class
|
"""Uvision Device class, inherits CMSIS Device class
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class Uvision(Exporter):
|
||||||
grouped = self.group_project_files(srcs)
|
grouped = self.group_project_files(srcs)
|
||||||
for group, files in grouped.items():
|
for group, files in grouped.items():
|
||||||
grouped[group] = sorted(list(self.uv_files(files)),
|
grouped[group] = sorted(list(self.uv_files(files)),
|
||||||
key=lambda (_, __, name): name.lower())
|
key=lambda tuple: tuple[2].lower())
|
||||||
return grouped
|
return grouped
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -205,8 +205,6 @@ class Uvision(Exporter):
|
||||||
def generate(self):
|
def generate(self):
|
||||||
"""Generate the .uvproj file"""
|
"""Generate the .uvproj file"""
|
||||||
cache = Cache(True, False)
|
cache = Cache(True, False)
|
||||||
if cache_d:
|
|
||||||
cache.cache_descriptors()
|
|
||||||
|
|
||||||
srcs = self.resources.headers + self.resources.s_sources + \
|
srcs = self.resources.headers + self.resources.s_sources + \
|
||||||
self.resources.c_sources + self.resources.cpp_sources + \
|
self.resources.c_sources + self.resources.cpp_sources + \
|
||||||
|
@ -216,7 +214,7 @@ class Uvision(Exporter):
|
||||||
# project_files => dict of generators - file group to generator of
|
# project_files => dict of generators - file group to generator of
|
||||||
# UVFile tuples defined above
|
# UVFile tuples defined above
|
||||||
'project_files': sorted(list(self.format_src(srcs).items()),
|
'project_files': sorted(list(self.format_src(srcs).items()),
|
||||||
key=lambda (group, _): group.lower()),
|
key=lambda tuple: tuple[0].lower()),
|
||||||
'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'),
|
'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'),
|
||||||
'device': DeviceUvision(self.target),
|
'device': DeviceUvision(self.target),
|
||||||
}
|
}
|
||||||
|
@ -262,7 +260,7 @@ class Uvision(Exporter):
|
||||||
|
|
||||||
# Print the log file to stdout
|
# Print the log file to stdout
|
||||||
with open(log_name, 'r') as f:
|
with open(log_name, 'r') as f:
|
||||||
print f.read()
|
print(f.read())
|
||||||
|
|
||||||
# Cleanup the exported and built files
|
# Cleanup the exported and built files
|
||||||
if cleanup:
|
if cleanup:
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# 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 __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
|
|
||||||
from os.path import join, exists, realpath, relpath, basename, isfile, splitext
|
from os.path import join, exists, realpath, relpath, basename, isfile, splitext
|
||||||
from os import makedirs, listdir, remove, rmdir
|
from os import makedirs, listdir, remove, rmdir
|
||||||
|
@ -46,7 +49,7 @@ class VSCode(Makefile):
|
||||||
self.gen_file('vscode/%s.tmpl' % file, ctx,
|
self.gen_file('vscode/%s.tmpl' % file, ctx,
|
||||||
'.vscode/%s.json' % file)
|
'.vscode/%s.json' % file)
|
||||||
else:
|
else:
|
||||||
print 'Keeping existing %s.json' % file
|
print('Keeping existing %s.json' % file)
|
||||||
|
|
||||||
# So.... I want all .h and .hpp files in self.resources.inc_dirs
|
# So.... I want all .h and .hpp files in self.resources.inc_dirs
|
||||||
all_directories = []
|
all_directories = []
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
""" The CLI entry point for exporting projects from the mbed tools to any of the
|
""" The CLI entry point for exporting projects from the mbed tools to any of the
|
||||||
supported IDEs or project structures.
|
supported IDEs or project structures.
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import, print_function
|
from __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from os.path import (join, abspath, dirname, exists, basename, normpath,
|
from os.path import (join, abspath, dirname, exists, basename, normpath,
|
||||||
realpath, relpath, basename)
|
realpath, relpath, basename)
|
||||||
|
@ -105,7 +107,7 @@ def main():
|
||||||
|
|
||||||
targetnames = TARGET_NAMES
|
targetnames = TARGET_NAMES
|
||||||
targetnames.sort()
|
targetnames.sort()
|
||||||
toolchainlist = EXPORTERS.keys()
|
toolchainlist = list(EXPORTERS.keys())
|
||||||
toolchainlist.sort()
|
toolchainlist.sort()
|
||||||
|
|
||||||
parser.add_argument("-m", "--mcu",
|
parser.add_argument("-m", "--mcu",
|
||||||
|
@ -259,7 +261,7 @@ def main():
|
||||||
cls.clean(basename(abspath(options.source_dir[0])))
|
cls.clean(basename(abspath(options.source_dir[0])))
|
||||||
except (NotImplementedError, IOError, OSError):
|
except (NotImplementedError, IOError, OSError):
|
||||||
pass
|
pass
|
||||||
for f in EXPORTERS.values()[0].CLEAN_FILES:
|
for f in list(EXPORTERS.values())[0].CLEAN_FILES:
|
||||||
try:
|
try:
|
||||||
remove(f)
|
remove(f)
|
||||||
except (IOError, OSError):
|
except (IOError, OSError):
|
||||||
|
|
|
@ -14,6 +14,9 @@ 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 __future__ import print_function, absolute_import
|
||||||
|
from builtins import str
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from os.path import join, dirname, splitext, basename, exists, relpath
|
from os.path import join, dirname, splitext, basename, exists, relpath
|
||||||
|
@ -196,7 +199,7 @@ class ARM(mbedToolchain):
|
||||||
Side Effects:
|
Side Effects:
|
||||||
This method MAY write a new scatter file to disk
|
This method MAY write a new scatter file to disk
|
||||||
"""
|
"""
|
||||||
with open(scatter_file, "rb") as input:
|
with open(scatter_file, "r") as input:
|
||||||
lines = input.readlines()
|
lines = input.readlines()
|
||||||
if (lines[0].startswith(self.SHEBANG) or
|
if (lines[0].startswith(self.SHEBANG) or
|
||||||
not lines[0].startswith("#!")):
|
not lines[0].startswith("#!")):
|
||||||
|
@ -206,7 +209,7 @@ class ARM(mbedToolchain):
|
||||||
self.SHEBANG += " -I %s" % relpath(dirname(scatter_file),
|
self.SHEBANG += " -I %s" % relpath(dirname(scatter_file),
|
||||||
base_path)
|
base_path)
|
||||||
if self.need_update(new_scatter, [scatter_file]):
|
if self.need_update(new_scatter, [scatter_file]):
|
||||||
with open(new_scatter, "wb") as out:
|
with open(new_scatter, "w") as out:
|
||||||
out.write(self.SHEBANG)
|
out.write(self.SHEBANG)
|
||||||
out.write("\n")
|
out.write("\n")
|
||||||
out.write("".join(lines[1:]))
|
out.write("".join(lines[1:]))
|
||||||
|
|
Loading…
Reference in New Issue