Skip to content

Commit 2615982

Browse files
committed
applied patch from mmahadevan108
- fixes invalid char '#' in linker script - added 'mbedclean'
1 parent 025b8d9 commit 2615982

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

tools/export/mcuxpresso/.cproject.tmpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<folderInfo id="com.crt.advproject.config.exe.{{opts['id']}}.{{opts['uid']['config']}}" name="/" resourcePath="">
2222
<toolChain id="com.crt.advproject.toolchain.exe.{{opts['id']}}.{{u.id}}" name="NXP MCU Tools" superClass="com.crt.advproject.toolchain.exe.{{opts['parent_id']}}">
2323
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.{{opts['id']}}.{{u.id}}" name="ARM-based MCU ({{opts['name']}})" superClass="com.crt.advproject.platform.exe.{{opts['id']}}"/>
24-
<builder buildPath="${workspace_loc:/{{name}}}/{{opts['name']}}" id="com.crt.advproject.builder.exe.{{opts['id']}}.{{u.id}}" keepEnvironmentInBuildfile="false" managedBuildOn="true" parallelBuildOn="true" parallelizationNumber="optimal" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.{{opts['id']}}"/>
24+
<builder buildPath="${workspace_loc:/{{name}}}/{{opts['name']}}" cleanBuildTarget="mbedclean" id="com.crt.advproject.builder.exe.{{opts['id']}}.{{u.id}}" incrementalBuildTarget="{{opts['ld']['script']}} all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.crt.advproject.builder.exe.{{opts['id']}}"/>
2525

2626
<tool id="com.crt.advproject.cpp.exe.{{opts['id']}}.{{opts['uid']['tool_cpp_compiler']}}" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.{{opts['id']}}">
2727
<option id="com.crt.advproject.cpp.specs.{{u.id}}" name="Specs" superClass="com.crt.advproject.cpp.specs" value="com.crt.advproject.cpp.specs.newlibnano" valueType="enumerated"/>
@@ -49,7 +49,7 @@
4949
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{file}}&quot;"/>
5050
{% endfor %}
5151
</option>
52-
52+
5353
{% if opts['common']['warnings.syntaxonly'] %}
5454
<option id="gnu.cpp.compiler.option.warnings.syntax.{{u.id}}" superClass="gnu.cpp.compiler.option.warnings.syntax" value="true" valueType="boolean"/>
5555
{% endif %}
@@ -74,14 +74,14 @@
7474
{% if opts['common']['warnings.conversion'] %}
7575
<option id="gnu.cpp.compiler.option.warnings.wconversion.{{u.id}}" name="Warn on implicit conversions (-Wconversion)" superClass="gnu.cpp.compiler.option.warnings.wconversion" value="true" valueType="boolean"/>
7676
{% endif %}
77-
77+
7878
{% if opts['common']['optimization.lto'] %}
7979
<option id="com.crt.advproject.cpp.lto.{{u.id}}" name="Enable Link-time optimization (-flto)" superClass="com.crt.advproject.cpp.lto" useByScannerDiscovery="false" value="true" valueType="boolean"/>
8080
{% endif %}
8181
{% if opts['common']['optimization.lto_objects'] %}
8282
<option id="com.crt.advproject.cpp.lto.fat.{{u.id}}" name="Fat lto objects (-ffat-lto-objects)" superClass="com.crt.advproject.cpp.lto.fat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
8383
{% endif %}
84-
84+
8585
{% if opts['cpp']['verbose'] %}
8686
<option id="gnu.cpp.compiler.option.other.verbose.{{u.id}}" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="true" valueType="boolean"/>
8787
{% endif %}
@@ -119,7 +119,7 @@
119119
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/{{file}}&quot;"/>
120120
{% endfor %}
121121
</option>
122-
122+
123123
{% if opts['common']['warnings.syntaxonly'] %}
124124
<option id="gnu.c.compiler.option.warnings.syntax.{{u.id}}" superClass="gnu.c.compiler.option.warnings.syntax" value="true" valueType="boolean"/>
125125
{% endif %}
@@ -157,7 +157,7 @@
157157
{% if opts['common']['optimization.lto_objects'] %}
158158
<option id="com.crt.advproject.gcc.lto.fat.{{u.id}}" name="Fat lto objects (-ffat-lto-objects)" superClass="com.crt.advproject.gcc.lto.fat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
159159
{% endif %}
160-
160+
161161
<option id="gnu.c.compiler.option.misc.other.{{u.id}}" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c {{opts['c']['other']}} {{opts['common']['warnings.other']}}" valueType="string"/>
162162
<inputType id="com.crt.advproject.compiler.input.{{opts['uid']['tool_c_compiler']}}" superClass="com.crt.advproject.compiler.input"/>
163163
</tool>
@@ -230,13 +230,13 @@
230230
{% if opts['ld']['other'] != '' %}
231231
<option id="gnu.cpp.link.option.flags.{{u.id}}" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="{{opts['ld']['other']}}" valueType="string"/>
232232
{% endif %}
233-
233+
234234
{% if opts['common']['optimization.lto'] %}
235235
<option id="com.crt.advproject.link.cpp.lto.{{u.id}}" superClass="com.crt.advproject.link.cpp.lto" useByScannerDiscovery="false" value="true" valueType="boolean"/>
236236
{% endif %}
237237

238-
<option id="com.crt.advproject.link.cpp.script.{{u.id}}" name="Linker script" superClass="com.crt.advproject.link.cpp.script" useByScannerDiscovery="false" value="${ProjDirPath}/{{opts['ld']['script']}}" valueType="string"/>
239-
238+
<option id="com.crt.advproject.link.cpp.script.{{u.id}}" name="Linker script" superClass="com.crt.advproject.link.cpp.script" useByScannerDiscovery="false" value="${ProjDirPath}/{{opts['name']}}/{{opts['ld']['script']}}" valueType="string"/>
239+
240240
<option id="com.crt.advproject.link.cpp.multicore.slave.{{u.id}}" name="Multicore configuration" superClass="com.crt.advproject.link.cpp.multicore.slave" useByScannerDiscovery="false"/>
241241
{% if opts['common']['arm.target.fpu.unit_nxp'] %}
242242
<option id="com.crt.advproject.link.cpp.fpu.{{u.id}}" name="Floating point" superClass="com.crt.advproject.link.cpp.fpu" useByScannerDiscovery="false" value="com.crt.advproject.link.cpp.fpu.{{opts['common']['arm.target.fpu.unit_nxp']}}" valueType="enumerated"/>

tools/export/mcuxpresso/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
Title: MCUXpresso exporter.
1818
19-
Description: Creates a managed build project that can be imported by
19+
Description: Creates a managed build project that can be imported by
2020
the MCUXpresso IDE from NXP
2121
2222
Based on GNU ARM Eclipse Exporter from Liviu Ionescu <[email protected]>
@@ -34,7 +34,7 @@
3434
from tools.utils import NotSupportedException
3535
from tools.build_api import prepare_toolchain
3636

37-
37+
3838
# =============================================================================
3939

4040

@@ -185,7 +185,7 @@ def generate(self):
185185
opts['ld']['object_files'] = objects
186186
opts['ld']['user_libraries'] = self.libraries
187187
opts['ld']['system_libraries'] = self.system_libraries
188-
opts['ld']['script'] = self.ld_script
188+
opts['ld']['script'] = "linker-script-%s.ld" % id
189189
opts['cpp_cmd'] = " ".join(toolchain.preproc)
190190

191191
# Unique IDs used in multiple places.
@@ -218,6 +218,8 @@ def generate(self):
218218
'.project', trim_blocks=True, lstrip_blocks=True)
219219
self.gen_file('mcuxpresso/{0}_cproject.tmpl'.format(target_name), jinja_ctx,
220220
'.cproject', trim_blocks=True, lstrip_blocks=True)
221+
self.gen_file('mcuxpresso/makefile.targets.tmpl', jinja_ctx,
222+
'makefile.targets', trim_blocks=True, lstrip_blocks=True)
221223
self.gen_file('mcuxpresso/mbedignore.tmpl', jinja_ctx, '.mbedignore')
222224

223225
print
@@ -230,9 +232,9 @@ def build(project_name, log_name="build_log.txt", cleanup=True):
230232
Headless build an Eclipse project.
231233
232234
The following steps are performed:
233-
- a temporary workspace is created,
235+
- a temporary workspace is created,
234236
- the project is imported,
235-
- a clean build of all configurations is performed and
237+
- a clean build of all configurations is performed and
236238
- the temporary workspace is removed.
237239
238240
The build results are in the Debug & Release folders.
@@ -326,8 +328,8 @@ def process_options(self, opts, flags_in):
326328
327329
Once identified, the options are removed from the command lines.
328330
329-
The options that were not identified are options that do not
330-
have CDT equivalents and will be passed in the 'Other options'
331+
The options that were not identified are options that do not
332+
have CDT equivalents and will be passed in the 'Other options'
331333
categories.
332334
333335
Although this process does not have a very complicated logic,
@@ -470,7 +472,7 @@ def process_options(self, opts, flags_in):
470472
self.remove_option(flags['ld_flags'], str)
471473
if opts['common']['arm.target.fpu.abi'] == 'hard':
472474
opts['common']['arm.target.fpu.unit_nxp'] += '.hard'
473-
475+
474476
# Default optimisation level for Release.
475477
opts['common']['optimization.level'] = '-Os'
476478

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# DO NOT REMOVE! Generated by the MCUXpresso exporter from an mBed project.
2+
3+
mbedclean:
4+
$(RM) $(OBJS)
5+
$(RM) $(CC_DEPS)$(C++_DEPS)$(C_UPPER_DEPS)$(CXX_DEPS)$(C_DEPS)$(CPP_DEPS)
6+
$(RM) $(EXECUTABLES) {{name}}.* linker-script-*.ld
7+
-@echo ' '
8+
9+
{% for config, data in options.iteritems() %}
10+
linker-script-{{config}}.ld: ../{{ld_script}}
11+
{{data.cpp_cmd}} {{data.ld.other}} $< -o $@
12+
{{name}}.elf: linker-script-{{config}}.ld
13+
{% endfor %}

0 commit comments

Comments
 (0)