Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong longcalls flag in 'ASFLAGS' #1314

Closed
hexeguitar opened this issue Feb 20, 2024 · 3 comments
Closed

Wrong longcalls flag in 'ASFLAGS' #1314

hexeguitar opened this issue Feb 20, 2024 · 3 comments

Comments

@hexeguitar
Copy link

Encountered this problem while trying to compile *.S assembly files. The process fails with message:
xtensa-esp32s3-elf-as: unrecognized option '-mlongcalls'
After digging deeper i found that the xtensa-esp32s3-elf-as accepts -longcalls and -no-longcalls flags only, without the -m used by the cpp compiler.
I did try to remove the '-mlongflags' from 'ASFLAGS' using extra scripts, however with no avail. It seems the -mlongcalls flag is added anyway in the build process.

I was also able to confirm that the assembly files do compile correctly when the command is invoked from terminal with correct flag set.

@valeros
Copy link
Member

valeros commented Feb 21, 2024

Hi @hexeguitar, are you sure it's .S (uppercase), not .s? If so, please provide a minimal project to reproduce the issue.

@hexeguitar
Copy link
Author

Oh, you're right. My files had lowercase extension. With uppercase all works fine.
Interestingly, the lowercase "s" files are also getting picked up by the asm compiler, yet always with the wrong flag. This happens on Linux and Windows.
To test it even an empty testasm.s file in the project triggers it, pio run -v output:

No dependencies
Building in release mode
xtensa-esp32s3-elf-as -mlongcalls -o .pio/build/esp32dev/src/testasm.s.o src/testasm.s
xtensa-esp32s3-elf-as: unrecognized option '-mlongcalls'

valeros added a commit that referenced this issue Feb 22, 2024
This way assembly sources that don't require preprocessing (.s)
will be run without generic compiler flags.

Issue #1314
@valeros
Copy link
Member

valeros commented Feb 22, 2024

The problem here is that IDF's build system used behind the scene doesn't provide default assembly flags as they always run both .S and .s (assembly with and without preprocessing respectively) through generic compiler. Their approach differs a bit from ours, so I've pushed a small fix to the dev branch, so that the build environment for the .s files won't contain any build flags by default. It means that you will need to set raw assembly flags via an extra script run in pre: mode, for example:

[env:esp32dev]
platform = espressif32
framework = espidf
board = esp32dev
extra_scripts = 
    pre:add_asmflags.py

add_asmflags.py:

Import ("env")

env.Append(
    ASFLAGS=["--longcalls"]
)

@valeros valeros closed this as completed Feb 22, 2024
jonathandreyer pushed a commit to jonathandreyer/platform-espressif32 that referenced this issue Nov 14, 2024
This way assembly sources that don't require preprocessing (.s)
will be run without generic compiler flags.

Issue platformio#1314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants