Just wondering if there is a way to fine tune the build process in Arduino Studio (1.8.16) when hitting the Sketch > Verify/Compile button?
The problem is that I have an assembly file (.S) in my project, but when you go to compile, it gets renamed temporarily to have an extension ".S.cpp" buy the IDE, causing an error to be thrown.
In file included from c:\users\user\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:272:0,
from c:\users\user\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from sketch\oscillate_pin.S.cpp:1:
The workaround I have been using is to change the extension to something that Arduino Studio doesn't recognise before I launch the program (e.g. ._S). This stops the IDE adding it to the project and leaves just the .ino file in the editor. After this, I then change the extension of the '.S' back.
Once this is done the program will compile and launch correctly. So I was wondering if there was a batch file or something that controls the build process to prevent any .S files being renamed to .S.cpp.
I just came up with a bit of a temporary workaround by making a batch file, which seems to do the job. But if there is a better way, I'd love to know it.
In the meantime, this is the workaround. It prevents the .S file from appearing in Arduino Studio and allows the project to compile properly. The downside is to edit the assembly file, you need to use a different editor.
Looking at the posts after the one you linked, other people were experiencing a similar issue which never got resolved either. Maybe a bug crept in to a subsequent IDE build which was never fixed?
The process I am using is identical to the post you linked though, with an .ino C file and .S asm file.
Works perfectly is the .S file isn't in the editor (which seems can only be achieved if the file isn't present on launch of the editor), but as soon as the file is present in the editor.
I have about 20 different combined C and ASM projects and the failure rate is 100% on any computer. Tested on Windows 10 and 11 also. Very easy problem to replicate.
Cool. Mac though, so different platform really. Would be interested to see what a fellow Windows user experiences.
Did a clean install of Windows 10 on this computer last weekend in fact, installed Arduino Studio, created an .ino and and .S file and failed instantly. That was without transferring any of my old files back whatsoever. Completely clean system.
Same thing, rename the .S to something else, launch the editor, name it back, and all good (for that session).
No probs at all! Thanks for taking a look though. Much appreciated!
I have the 'workaround' anyway, so it's not the end of the world. Still be interested to see if other Windows users can replicate. Happens on every Windows box I use.
At the end of the day it's really just a minor annoyance.
If I rename the file to "zzzzz.S" it appears in the editor after the ino file and does infact compile correctly. So there is definitely a bug in the editor.
the IDE expects exact capitalisation to match the enclosing folder's name for the main .ino
Oscillate_Pin
Oscillate_Pin.ino
whatever.S
the other files can be before or after alphabetically it does not matter. Just ensure this rule is enforced (as you can see in my image in #5, the .S file is before alphabetically but appears after the .ino file in the IDE tabs)
Will certainly make things a lot more seamless that's for sure!
Having great fun learning the ASM side of these chips BTW. I particularly like being able to control the ATMega chips down to the exact clock cycle (down to the 62.5nS chunk anyway).