Skip to content

Commit ade705a

Browse files
committed
Force preprocessing of asm for make_armc5
It seem to preprocess asm with the `.S` extension on linux, but the windows build of Arm Compiler 5 seems to omit the preprocessing step unless you have a `.sx` extension. Odd.
1 parent cda6250 commit ade705a

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

tools/export/makefile/Makefile.tmpl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,26 @@ all: $(PROJECT).bin $(PROJECT)-combined.hex size
9797
all: $(PROJECT).bin $(PROJECT).hex size
9898
{% endif %}
9999

100-
.asm.o:
101-
+@$(call MAKEDIR,$(dir $@))
102-
+@echo "Assemble: $(notdir $<)"
103-
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
104-
105100
.s.o:
106101
+@$(call MAKEDIR,$(dir $@))
107102
+@echo "Assemble: $(notdir $<)"
103+
{% if needs_asm_preproc %}
104+
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -E -o $(@:.o=.E.s) $<
105+
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $(@:.o=.E.s)
106+
{% else %}
108107
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
108+
{% endif %}
109+
109110

110111
.S.o:
111112
+@$(call MAKEDIR,$(dir $@))
112113
+@echo "Assemble: $(notdir $<)"
114+
{% if needs_asm_preproc %}
115+
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -E -o $(@:.o=.E.s) $<
116+
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $(@:.o=.E.s)
117+
{% else %}
113118
@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
119+
{% endif %}
114120

115121
.c.o:
116122
+@$(call MAKEDIR,$(dir $@))

tools/export/makefile/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Makefile(Exporter):
3535

3636
MBED_CONFIG_HEADER_SUPPORTED = True
3737

38+
PREPROCESS_ASM = False
39+
3840
POST_BINARY_WHITELIST = set([
3941
"MCU_NRF51Code.binary_hook",
4042
"TEENSY3_1Code.binary_hook",
@@ -96,6 +98,7 @@ def generate(self):
9698
'link_script_ext': self.toolchain.LINKER_EXT,
9799
'link_script_option': self.LINK_SCRIPT_OPTION,
98100
'user_library_flag': self.USER_LIBRARY_FLAG,
101+
'needs_asm_preproc': self.PREPROCESS_ASM,
99102
}
100103

101104
if hasattr(self.toolchain, "preproc"):
@@ -236,6 +239,7 @@ class Armc5(Arm):
236239
"""ARM Compiler 5 (armcc) specific makefile target"""
237240
NAME = 'Make-ARMc5'
238241
TOOLCHAIN = "ARM"
242+
PREPROCESS_ASM = True
239243

240244
class Armc6(Arm):
241245
"""ARM Compiler 6 (armclang) specific generic makefile target"""

0 commit comments

Comments
 (0)