Compiler error for SH7045?

Olaf Kaluza olaf at criseis.ruhr.de
Fri Apr 15 15:49:17 UTC 2011


Hi everyone,

I am using this compiler:

olaf] ~/sources/SH7045/test1: sh2a-gcc --version
sh2a-gcc (GCC) 4.5.1

I made my own testboard for an old SH2 (SH7045). It is working good!
But only if I use the compile without optimization:

CFLAGS          = -O0 -m2  -Wfloat-equal -Wunused-variable -Wa,-L

When I am using this:

CFLAGS          = -O2 -m2  -Wfloat-equal -Wunused-variable -Wa,-L

or this:

CFLAGS          = -O1 -m2  -Wfloat-equal -Wunused-variable -Wa,-L

I got an CPU Adress Error interrupt when using IRQ and the I am
leaving the IRQ-Subroutine.

For example I am using an empty irq-handler:

void INT_CMT_CMI0(void) __attribute__((interrupt_handler));
void INT_CMT_CMI0(void)
{
}

When I translate it with Optimiziation s,1 or 2 like this:

sh2-gcc  -O0 -m2  -c -o ticker.o ticker.c

I got this:

 

37:ticker.c      **** }
  29                            .loc 1 38 0
  30 0004 6FE3                  mov     r14,r15
  31 0006 6EF6                  mov.l   @r15+,r14
  32 0008 002B                  rte
  33 000a 0009                  nop
  34                            .cfi_endproc
  35                    .LFE0:
  36                            .size   _INT_CMT_CMI0, .-_INT_CMT_CMI0
  37                            .align 1

and everythink is okay. My program is working!

but when I use this:

sh2-gcc  -O2 -m2  -c -o ticker.o ticker.c

37:ticker.c      **** }
  28                            .loc 1 38 0
  29 0004 6FE3                  mov     r14,r15
  30 0006 002B                  rte
  31 0008 6EF6                  mov.l   @r15+,r14
  32                            .cfi_endproc
  33                    .LFE0:
  34                            .size   _INT_CMT_CMI0, .-_INT_CMT_CMI0
  35                            .align 1

on Line 30 or 31 my controller makes an exception to CPU-Adress error.

Is this a compiler error? Is there a compiler switch I can use to
avoid this problem? It is a little bit sad to develope a huge project
with -O0.

Olaf
 



More information about the superh-gnu-discuss mailing list