Page 1 of 1

Assembler output?

Posted: Sat Mar 02, 2019 3:40 am
by The_YongGrand
I'm trying to optimize a piece of code here, and trying all methods to add the "-S" into the project makefile, but the *.S files aren't being produced.

Is there an option where I can enable this?

Re: Assembler output?

Posted: Mon Mar 04, 2019 1:50 pm
by ESP_Dazz
If you're using Make, as Makefile will compile all *.c *.cpp *.cc *.S files in a component. Call make list-components to check if the component your assembly source file is located in is actually being built.

If you're using CMake, you'll need to add the assembly source file to your component's COMPONENT_SRCS.

Re: Assembler output?

Posted: Mon Mar 04, 2019 9:15 pm
by ESP_cermak
Let me just add a quick note about "-S" flag if one wanted the compiler to produce also assembly during compilation:

One of the method is to print out compiler commands using `make -n` and grepping out the exact module you want the assembly for.
Copy and paste this line to the command line and add argument '-S' (also optionally remove output specifier '-o module.o' at the end of the line otherwise your assembly file would be called module.o)
Also it's possible to do

Code: Select all

export EXTRA_CFLAGS="-S"
which would add the -S option to all comilations, but the build system would generate assembly instead of objects
and would finally break trying to link the assembly code (but you can find assembly files when looking into *.o files)