Arduino-Makefile icon indicating copy to clipboard operation
Arduino-Makefile copied to clipboard

Allow assembly source files with a lower-case .s extension

Open ryansuchocki opened this issue 8 years ago • 12 comments

I was very confused when I first tried to upload an assembly project using Arduino-mk, and it complained that there were no source files.

GCC (and hence, avr-gcc) allows assembly sources with either a lower-case or upper-case extension. I see no reason why Arduino-mk should require one or the other.

ryansuchocki avatar May 21 '16 19:05 ryansuchocki

no complaints from me, bit surprised this hasn't already been done, assumed it was case-insensitive wildcard i guess.

although isn't that assignment going to stop .S files from working?

sej7278 avatar May 21 '16 20:05 sej7278

You're right! I think I made some silly mistakes when I was testing this...

I'll try again :)

ryansuchocki avatar May 21 '16 21:05 ryansuchocki

you're not giving up on this are you @ryansuchocki ?

sej7278 avatar May 23 '16 19:05 sej7278

Temporarily... I was trying to comprehend the rest of the makefile, to see if this breaks something else, and I panicked!

ryansuchocki avatar May 24 '16 00:05 ryansuchocki

@ryansuchocki is this ready to merge - subject to updating HISTORY.md ?

sej7278 avatar Feb 19 '17 19:02 sej7278

@sudar can we merge this (manually fixing history i guess)?

edit: no, can't merge as it doesn't extend to the new sam/due support, still lots of use of .S there

sej7278 avatar Jun 12 '18 09:06 sej7278

@sej7278

no, can't merge as it doesn't extend to the new sam/due support, still lots of use of .S there

Is there a easy way to fix this ourself?

sudar avatar Jun 22 '18 04:06 sudar

@sudar actually probably just needs rebasing so it applies to lines 793, 799, 803, as we're only changing LOCAL_AS_SRCS provided by the user, not all instances of .S files (e.g. libraries, cores etc.)

sej7278 avatar Jun 22 '18 05:06 sej7278

I tried this, but I've no idea how to use a prebuilt assembly file with the makefile, so can't tell if it works. simply putting a blink.s file (from prior generated_assembly) in the project directory seems to break the build.

diff --git a/Arduino.mk b/Arduino.mk
index 979a039..cef790a 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -790,17 +790,17 @@ LOCAL_CPP_SRCS  ?= $(wildcard *.cpp)
 LOCAL_CC_SRCS   ?= $(wildcard *.cc)
 LOCAL_PDE_SRCS  ?= $(wildcard *.pde)
 LOCAL_INO_SRCS  ?= $(wildcard *.ino)
-LOCAL_AS_SRCS   ?= $(wildcard *.S)
+LOCAL_AS_SRCS   ?= $(wildcard *.S *.s)
 LOCAL_SRCS      = $(LOCAL_C_SRCS)   $(LOCAL_CPP_SRCS) \
                $(LOCAL_CC_SRCS)   $(LOCAL_PDE_SRCS) \
                $(LOCAL_INO_SRCS) $(LOCAL_AS_SRCS)
 LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.c.o)   $(LOCAL_CPP_SRCS:.cpp=.cpp.o) \
                $(LOCAL_CC_SRCS:.cc=.cc.o)   $(LOCAL_PDE_SRCS:.pde=.pde.o) \
-               $(LOCAL_INO_SRCS:.ino=.ino.o) $(LOCAL_AS_SRCS:.S=.S.o)
+               $(LOCAL_INO_SRCS:.ino=.ino.o) $(LOCAL_AS_SRCS:.%=.%.o)
 LOCAL_OBJS      = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
 
 ifeq ($(words $(LOCAL_SRCS)), 0)
-    $(error At least one source file (*.ino, *.pde, *.cpp, *c, *cc, *.S) is needed)
+    $(error At least one source file (*.ino, *.pde, *.cpp, *c, *cc, *.S, *.s) is needed)
 endif
 
 # CHK_SOURCES is used by flymake
diff --git a/HISTORY.md b/HISTORY.md
index 10b3e5e..1719e9a 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -14,6 +14,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
 - Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278)
 - Tweak: Update Windows usage documentation and allow non-relative paths (issue #519) (https://github.com/tuna-f1sh)
 - Tweak: Support Cygwin Unix Python and Windows installation on Windows to pass correct port binding. (https://github.com/tuna-f1sh)
+- Tweak: Allow source files with lower-case .s extension (https://github.com/ryansuchocki)
 - New: Added -fdiagnostics-color to \*STD flags (https://github.com/sej7278)
 - New: Made -fdiagnostics-color take a variiable DIAGNOSTICS_COLOR_WHEN: never, always, auto. (https://github.com/wingunder)
 - New: Add generation of tags file using ctags, which automatically includes project libs and Arduino core. (https://github.com/tuna-f1sh)

sej7278 avatar Jun 22 '18 13:06 sej7278

@sej7278

What are your thoughts on this PR?

Do you think we should rebase and test the changes as you suggested?

sudar avatar Sep 30 '18 15:09 sudar

we need an example at least, as we don't even know if it works....

sej7278 avatar Sep 30 '18 19:09 sej7278

@ryansuchocki

Can you give us some examples of how to use the changes that you are proposing?

sudar avatar Oct 07 '18 05:10 sudar