AVR: gas: unusable assembler output and complicated ISR problem...
Nick Clifton
nickc@redhat.com
Mon Dec 20 15:15:42 GMT 2021
Hi Ian,
> I wish to compile C sources to assembler, modify the assembler, and then
> assemble and link object produced.
I am sure that you are aware of this, but just for the sake of other readers
I will say that mucking about with compiler produced assembler is a good way
to shoot yourself in the foot if you do not know what you are doing...
> __vector_36:
> __gcc_isr 1 ; // note b
> Is there some way to get gas to "preprocess" the file to expand the
> pseudo operations __gcci_isr* ?
No. Well yes, but I do not think that you are going to like it.
There is no way to get the preprocessed sources that you are talking
about. But there is a way to get the post-processed sources instead.
The trick is to disassemble the assembled output and use this as the
template for your editing...
% as irq.s -o irq.o -mgcc-isr
% objdump -d irq.o --no-addresses --no-show-raw-insn > irq.preprocessed.s
% cat irq.preprocessed.s
irq.o: file format elf32-avr
Disassembly of section .text:
<__vector_36>:
push r24
ldi r24, 0x05 ; 5
sts 0x0085, r24 ; 0x<__gcc_isr.n_pushed.001+0x800084>
pop r24
reti
(I have used a truncated version of irq.s for this demonstration...)
Cheers
Nick
PS. If you really want to modify the assembler so that it can generate
a pre-processed output, then your best bet is to look at the assembler
listing option (-a). But you will need to find some way to hook in back
end generated text, which I do not think has been implemented yet...
More information about the Binutils
mailing list