binutils port to a new 16bit little endian uC

Aurélien Buhrig aurelien.buhrig@tiempo-ic.com
Tue Feb 19 09:36:00 GMT 2008


Hello,

I’m trying to port binutils (2.17) to a new architecture using CGEN.
The new architecture is a 16-bit uC. The instructions are therefore 16 bit
wide, possibly followed by a 8bit or 16 bit immediate value for the 2 word
instructions.

Everything is ok in big endian, but when I try to compile the binutils to
target a little endian uC, the two 16-bit instruction words are interpreted
as a 32 bit world. It results in inverting the two 16 bits words of the
instructions when encoding in the object file.

To sum up, a two word  instruction in big endian that would be AB CD in the
file, should be in little endian BA DC, but I have DC BA


Here is my cpu and isa definitions
(define-isa
  (name FOO)                        ; isa name
  (default-insn-bitsize 16)         ; instruction size
  (base-insn-bitsize 16)            ; minimum instruction size
  (default-insn-word-bitsize 16)    ; default instruction word size
)

(define-cpu
    (name FOObf)          
    (comment "FOO 16 Bit Processor Family")
    (endian little)       
    (word-bitsize 16)     
    ;(insn-chunk-bitsize 16)
)

I tried to add "insn-chunk-bitsize 16" but FOO-as returns "aborted" when I
try to compile asm files.
Any hint ??

Thanks,
Aurélien




More information about the Binutils mailing list