BinutilsHere is a working port of the binutils for the M68HC05 (including an assembler, linker and other object file tools). The newest patched source is available in the GIT repository.
The assembler supports the functions lo8, hi8, hlo8, hhi8, lo16 and h16 to extract a byte or word of an symbol value. The functions offset8 and offset16 return the offset of symbol in its section. The output format is ELF big endian. The syntax looks so:
test: lda %X,2 lda %X sta test lda $2Using X-Relativ addressing modes is indicated by writing %X, in front of the address (or only %X if %X,0 is meant).
For section names ending in .!!!!!, the !!!!! is changed in an unique number for the assembler run, to support the split of data section in non-contigouse sections. (The main work is done by the linker)
You should not use bsr and bra, use jsr and jmp instead. bsr will fail, if the subroutine is to far away. A to far away jump target for bra will be handled like a conditional jump. jsr and jmp are relaxed to bsr and bra by the linker, is it is possible.
The linker support relaxing, which is must be enabled to create compact code, because the assemblers chooses the longest instruction
variant by default, which should work in all cases. Short conditional branches are turned automatically in longer variants, if the
destination address is unknown or not reachable with relative addressing. Relative stabs line numbers will also be adjusted.
The option --move-sections is added, which supports moving input sections to an other input section, if one output section becomes to
big. The movement commands are given via the SYSLIB directive in the linker scripts, eg: