Reputation: 2139
as
defaults to ELF. I have some PIC code I would like to assemble to just that - only the raw instructions, no sections, etc. I believe using nasm
you could achieve this by assembling with no options, and start your code with the BITS 32
directive (for a 32 bit architecture).
How to with as
?
System:
- Ubuntu 12.04.
- as 2.2.
- x86 32b
Upvotes: 2
Views: 448
Reputation:
as
can only generate ELF output, but you can convert an ELF binary to another format using objcopy
:
objcopy -O binary mybinary.elf mybinary.bin
It supports a number of other formats as well as "binary". In particular, it supports "ihex" to produce .hex
files, which some microcontroller programming tools may require.
Upvotes: 4