This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Trouble assembling variant.S for sh3 on Linux/alpha


Stephen Williams wrote:

>The error below comes from trying to compile (actually assemble) variant.S
>now that I finally got the host tools built. The error message about the
>offset out of range applies to this line:
>
>_cyg_hal_cache_enable:
>        GOTO_NONCACHED_SHADOW
>        mov     #CYGARC_REG_CCR,r1   ; <-- here!
>        mov.l   @r1,r0
>        mov     #CYGARC_REG_CCR_CE,r2
>        mov.l   r2,@r1
>        nop
>        rts
>         nop
>
>CYGARC_REG_CCR is defined in mod_regs_cac.h as:
>
>#define CYGARC_REG_CCR                  0xffffffec
>
>...which just happens to be 4294967276 in decimal. Well, I think as should
>be expected to know that this is really -0x14 when talking to an sh3/4
>processor. I don't think I can get much more recent than this:

You really want 0xffffffec in r1.

The mov #CYGARC_REG_CCR,r1 uses a little trick. Since the SH3 can't store
0xffffffec as 32 bit immediate data, only the last byte 0xec will be coded
within the mov instruction word. This gets sign-extended to 32 bit, and
voila: You should have 0xffffffec in r1. Of course this only works if you
want 0xffffff in the upper bytes, which happens to be the case for several
SH3 control register locations.

The problem is, that with the definition CYGARC_REG_CCR you try to use a
long word instead of a byte for the mov #imm,R1. My assembler (x86, WinNT)
simply truncates this, yours doesn't seem to. Try using 0xec, but better
not change the original definiton CYGARC_REG_CCR, as it may be needed in 32
bit elsewhere. I fear your problem will also occur at several other locations.

Peter


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]