Return to Website   
Quantum Leaps Discussion Forum

Search the Forum for answers or post your questions to the
Quantum Leaps community



Return to Website

  Reply
  Forum

Subject:   Re: QP nano and AVR
Name:   Miro Samek
Date Posted:   May 2, 08 - 9:07 AM
Email:   miro@quantum-leaps.com
Website:   http://www.quantum-leaps.com
Message:   Carlo,

For the GNU AVR compiler (WinAVR), please for now comment out the Q_ROM macro from the definition of the QF_pCB_ variable, that is, replace

QActiveCB const Q_ROM * Q_ROM_VAR QF_pCB_; /* ptr to AO control block */


with

QActiveCB const /*Q_ROM*/ * Q_ROM_VAR QF_pCB_; /* ptr to AO control block */


Please note, though, that removing Q_ROM will break the code for other compilers. In particular, the IAR compiler for AVR will rightfully complain.

The issue here is that the GNU compiler uses the PROGMEM directive in a rather non-standard way. (The macro Q_ROM is defined as PROGMEM for WinAVR). Apparently, PROGMEM applies to the QF_pCB_ variable itself, whereas it should apply to the value pointed to by QF_pCB_ (just like the 'const' keyword). In other words, QF_pCB_ should be allocated in RAM, but it should point to objects allocated in ROM (PROGMEM). This confusion leads in WinAVR to the warnings "__progmem__ attribute ignored", which still remain in the QP-nano code.

Other commercial compilers, such as IAR for AVR, handle the distinction between the pointer variable and the object pointed to by the pointer correctly. (In case of the IAR compiler, Q_ROM is defined as __flash.)

The new upcoming version of QP-nano 4.0.01 will fix this problem for all compilers, by eliminating the QF_pCB_ variable. The change will be transparent to the application code.

Miro
Replies:    
Re: QP nano and AVR by Carlo · May 2, 08 - 11:01 AM


  Reply
  Forum


powered by Powered by Bravenet bravenet.com