[ECOS] arm-elf-g++ ver3.2.1 problem

Ryos Suzuki ryos@sinby.com
Tue Dec 28 14:26:00 GMT 2004


Hi,

I am porting kaffe and openH323 to arm/eCos.
so I'm using arm-elf-g++ ver 3.2.1. however the compiler makes
bad codes with inline as following.

_Z4Readv:
        @ args = 0, pretend = 0, frame = 4
        @ frame_needed = 1, uses_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {fp, ip, lr, pc}
        sub     fp, ip, #4
        ldr     r3, .L36
        str     r3, [fp, #-16]   <---(A)
        sub     sp, sp, #4       <---(B)
        ....


(A) use stack before allocating an area on stack.
(B) allocate the area on the stack to use [fp, #-16].
if an interrupt has occurred after (A) and before (B), [fp, #-16]
 is broken since eCos intterrupt routine save context to the 
stack.

gcc-arm-elf ver 3.2.3 has same problem.
ver 3.3.4 3.3.5 and 3.4.3 make good codes. 
however I would like to use ver 3.2.X because there is other 
problem in 3.3.X and 3.4.X to compile eCos.
does anyone have good solution?

You can make the codes by compiling following c++ source.

#define INLINE inline 

class MyPWaitAndSignal {
  public:
    MyPWaitAndSignal(
      const MyPMutex & sem,   /// Semaphore descendent to wait/
signal.
      bool wait = true    /// Wait for semaphore before 
returning.
    );
    ~MyPWaitAndSignal();

  protected:
    MyPMutex & semaphore;
};

INLINE MyPWaitAndSignal::MyPWaitAndSignal(const MyPMutex & sem, 
bool wait)
  : semaphore((MyPMutex &)sem) // Break const (naughty but 
necessary)
  {
    if (wait)
      semaphore.Wait();
  }

inline MyPWaitAndSignal::~MyPWaitAndSignal()
  { semaphore.Signal(); }

//======================

void
Read( void )
{
        MyPWaitAndSignal mutex( rawChannelMutex );
        cyg_thread_yield();

        func();
}



--
Ryos Suzuki
ryos@sinby.com

Sinby Corporation
http://www.sinby.com

Japan 260-0031
chiba-ken chiba-shi chuo-ku 
sinchiba 3-7-6

TEL/FAX +81-43-244-9714


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list