diff --git a/doxygen/history.dox b/doxygen/history.dox index 2b20bec7..d16f4c57 100644 --- a/doxygen/history.dox +++ b/doxygen/history.dox @@ -3,23 +3,23 @@ namespace QP { /** @page history Revision History @section qpcpp_5_9_8 Version 5.9.8, 2017-09-15 -This release fixes the QXK kernel [bug#182 " Inconsistent QXThread::post_() behavior with respect to the 'margin' parameter"](https://sourceforge.net/p/qpc/bugs/182/). - +This release fixes the QXK kernel [bug#182 " Inconsistent QXThread::post_() behavior with respect to the 'margin' parameter"](https://sourceforge.net/p/qpc/bugs/182/). + Also, the pre-condition assertion in the function QF::newRef_() (file `src/qf/qf_dyn.cpp`) has been modified to allow creating event references only for dynamic events `(e->poolId_ == 0)`. Modifed ARM Cortex-M examples with the GNU-ARM toolset to be compatible with C++ RTTI and C++ Exception handling, as follows: - + - removed definitions of `_init()` and `_fini()` from the GNU-ARM startup code for all supported boards in the `3rd_party` directory - added the empty definitions of `_init()` and `_fini()` to `mini_cpp.cpp` in the `3rd_party/gnu_cpp directory` - Modified all GNU-ARM linker scripts (.ld files) to add the following symbols: - + @verbatim __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; -@endverbatim +@endverbatim Provided C++ example with RTTI and Exception hanlding in the directory: `examples/arm-cm/dpp_efm32-slstk3401a/qxk/gnu_with-rtti` diff --git a/doxygen/metrics.dox b/doxygen/metrics.dox index 6e44012b..d5b6230f 100644 --- a/doxygen/metrics.dox +++ b/doxygen/metrics.dox @@ -9,7 +9,7 @@ License Type: Windows Single User License Licensed To : Quantum Leaps, LLC License No. : WS2975 License Date: Dec 15, 2013 - Build Date : Sep 2 2009 Run Date: Sep 15, 2017 + Build Date : Sep 2 2009 Run Date: Sep 24, 2017 (C)1996-2009 M Squared Technologies LLC ________________________________________________________________________ @@ -1064,11 +1064,9 @@ Parameters: (QEvt const * const e, uint_fast16_t const margin) Cyclomatic Complexity Vg Detail Function Base : 1 - Conditional if / else if: 5 - Logical or ( || ) : 1 - Logical and ( && ) : 1 - Complexity Param 2 Return 1 Cyclo Vg 8 Total 11 - LOC 59 eLOC 49 lLOC 34 Comment 63 Lines 81 + Conditional if / else if: 8 + Complexity Param 2 Return 1 Cyclo Vg 9 Total 12 + LOC 72 eLOC 58 lLOC 39 Comment 68 Lines 94 Function: QP::QActive::postLIFO Parameters: (QEvt const * const e) @@ -1129,27 +1127,27 @@ ~~ Total File Summary ~~ - LOC 218 eLOC 187 lLOC 105 Comment 230 Lines 412 + LOC 231 eLOC 196 lLOC 110 Comment 235 Lines 425 ------------------------------------------------------------------------ ~~ File Functional Summary ~~ File Function Count....: 9 - Total Function LOC.....: 192 Total Function Pts LOC : 4.1 - Total Function eLOC....: 162 Total Function Pts eLOC: 3.5 - Total Function lLOC....: 105 Total Function Pts lLOC: 2.0 + Total Function LOC.....: 205 Total Function Pts LOC : 4.4 + Total Function eLOC....: 171 Total Function Pts eLOC: 3.7 + Total Function lLOC....: 110 Total Function Pts lLOC: 2.1 Total Function Params .: 10 Total Function Return .: 9 - Total Cyclo Complexity : 25 Total Function Complex.: 44 + Total Cyclo Complexity : 26 Total Function Complex.: 45 ------ ----- ----- ------ ------ ----- - Max Function LOC ......: 59 Average Function LOC ..: 21.33 - Max Function eLOC .....: 49 Average Function eLOC .: 18.00 - Max Function lLOC .....: 34 Average Function lLOC .: 11.67 + Max Function LOC ......: 72 Average Function LOC ..: 22.78 + Max Function eLOC .....: 58 Average Function eLOC .: 19.00 + Max Function lLOC .....: 39 Average Function lLOC .: 12.22 ------ ----- ----- ------ ------ ----- Max Function Parameters: 2 Avg Function Parameters: 1.11 Max Function Returns ..: 1 Avg Function Returns ..: 1.00 Max Interface Complex. : 3 Avg Interface Complex. : 2.11 - Max Cyclomatic Complex.: 8 Avg Cyclomatic Complex.: 2.78 - Max Total Complexity ..: 11 Avg Total Complexity ..: 4.89 + Max Cyclomatic Complex.: 9 Avg Cyclomatic Complex.: 2.89 + Max Total Complexity ..: 12 Avg Total Complexity ..: 5.00 ________________________________________________________________________ End of File: ..\src\qf\qf_actq.cpp @@ -2233,9 +2231,9 @@ ~~ Total Project Summary ~~ - LOC 4867 eLOC 4313 lLOC 1882 Comment 6438 Lines 11588 + LOC 4880 eLOC 4322 lLOC 1887 Comment 6443 Lines 11601 Average per File, metric/37 files - LOC 131 eLOC 116 lLOC 50 Comment 174 Lines 313 + LOC 131 eLOC 116 lLOC 51 Comment 174 Lines 313 ------------------------------------------------------------------------ @@ -2675,8 +2673,8 @@ Function: QP::QActive::post_ Parameters: (QEvt const * const e, uint_fast16_t const margin) - Complexity Param 2 Return 1 Cyclo Vg 8 Total 11 - LOC 59 eLOC 49 lLOC 34 Comment 63 Lines 81 + Complexity Param 2 Return 1 Cyclo Vg 9 Total 12 + LOC 72 eLOC 58 lLOC 39 Comment 68 Lines 94 Function: QP::QActive::postLIFO Parameters: (QEvt const * const e) @@ -3136,26 +3134,26 @@ LOC 14 eLOC 11 lLOC 7 Comment 2 Lines 16 Total: Functions - LOC 2739 eLOC 2284 lLOC 1362 InCmp 340 CycloCmp 464 - Function Points FP(LOC) 46.7 FP(eLOC) 39.5 FP(lLOC) 23.8 + LOC 2752 eLOC 2293 lLOC 1367 InCmp 340 CycloCmp 465 + Function Points FP(LOC) 46.9 FP(eLOC) 39.7 FP(lLOC) 23.9 ------------------------------------------------------------------------ ~~ Project Functional Analysis ~~ - Total Functions .......: 175 Total Physical Lines ..: 3791 - Total LOC .............: 2739 Total Function Pts LOC : 46.7 - Total eLOC ............: 2284 Total Function Pts eLOC: 39.5 - Total lLOC.............: 1362 Total Function Pts lLOC: 23.8 - Total Cyclomatic Comp. : 464 Total Interface Comp. .: 340 + Total Functions .......: 175 Total Physical Lines ..: 3804 + Total LOC .............: 2752 Total Function Pts LOC : 46.9 + Total eLOC ............: 2293 Total Function Pts eLOC: 39.7 + Total lLOC.............: 1367 Total Function Pts lLOC: 23.9 + Total Cyclomatic Comp. : 465 Total Interface Comp. .: 340 Total Parameters ......: 165 Total Return Points ...: 175 - Total Comment Lines ...: 2692 Total Blank Lines .....: 513 + Total Comment Lines ...: 2697 Total Blank Lines .....: 514 ------ ----- ----- ------ ------ ----- - Avg Physical Lines ....: 21.66 - Avg LOC ...............: 15.65 Avg eLOC ..............: 13.05 - Avg lLOC ..............: 7.78 Avg Cyclomatic Comp. ..: 2.65 + Avg Physical Lines ....: 21.74 + Avg LOC ...............: 15.73 Avg eLOC ..............: 13.10 + Avg lLOC ..............: 7.81 Avg Cyclomatic Comp. ..: 2.66 Avg Interface Comp. ...: 1.94 Avg Parameters ........: 0.94 - Avg Return Points .....: 1.00 Avg Comment Lines .....: 15.38 + Avg Return Points .....: 1.00 Avg Comment Lines .....: 15.41 ------ ----- ----- ------ ------ ----- Max LOC ...............: 117 Max eLOC ..............: 100 Max lLOC ..............: 61 diff --git a/examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/Makefile b/examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/Makefile index de6cea74..f4aab2d1 100644 --- a/examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/Makefile +++ b/examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/Makefile @@ -122,7 +122,7 @@ QP_SRCS := \ qf_qeq.cpp \ qf_qmact.cpp \ qf_time.cpp \ - qk.cpp + qk.cpp QP_ASMS := \ qk_port.s diff --git a/ports/embos/qf_port.cpp b/ports/embos/qf_port.cpp index 1132f6f2..1cc8984f 100644 --- a/ports/embos/qf_port.cpp +++ b/ports/embos/qf_port.cpp @@ -2,8 +2,8 @@ /// @brief QF/C++ port to embOS (v4.00) kernel, all supported compilers /// @cond ////************************************************************************** -/// Last updated for version 5.9.3 -/// Last updated on 2017-06-19 +/// Last updated for version 5.9.8 +/// Last updated on 2017-09-20 /// /// Q u a n t u m L e a P s /// --------------------------- @@ -159,9 +159,24 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QF_CRIT_ENTRY_(); nFree = static_cast(m_eQueue.maxMsg - m_eQueue.nofMsg); - if (((margin == QF_NO_MARGIN) && (nFree > static_cast(0))) - || (nFree > static_cast(margin))) - { + if (margin == QF_NO_MARGIN) { + if (nFree > static_cast(0)) { + status = true; // can post + } + else { + status = false; // cannot post + Q_ERROR_ID(510); // must be able to post the event + } + } + else if (nFree > static_cast(margin)) { + status = true; // can post + } + else { + status = false; // cannot post + } + + if (status) { // can post the event? + QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_FIFO, QS::priv_.locFilter[QS::AO_OBJ], this) QS_TIME_(); // timestamp QS_OBJ_(sender); // the sender object @@ -179,15 +194,11 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QF_CRIT_EXIT_(); // posting to the embOS mailbox must succeed, see NOTE3 - Q_ALLEGE_ID(510, + Q_ALLEGE_ID(520, OS_PutMailCond(&m_eQueue, static_cast(&e)) == static_cast(0)); - - status = true; // report success } else { - // can tolerate dropping evts? - Q_ASSERT_ID(520, margin != QF_NO_MARGIN); QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_ATTEMPT, QS::priv_.locFilter[QS::AO_OBJ], this) @@ -201,8 +212,6 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QS_END_NOCRIT_() QF_CRIT_EXIT_(); - - status = false; // report failure } return status; diff --git a/ports/qt/guiapp.cpp b/ports/qt/guiapp.cpp index 02a6bf57..08d17e2f 100644 --- a/ports/qt/guiapp.cpp +++ b/ports/qt/guiapp.cpp @@ -3,7 +3,7 @@ /// @cond ///*************************************************************************** /// Last Updated for Version: QP 5.4.0/Qt 5.x -/// Last updated on 2015-05-03 +/// Last updated on 2017-09-20 /// /// Q u a n t u m L e a P s /// --------------------------- @@ -30,8 +30,8 @@ /// along with this program. If not, see . /// /// Contact information: -/// Web: www.state-machine.com -/// Email: info@state-machine.com +/// https://state-machine.com +/// mailto:info@state-machine.com ///*************************************************************************** /// @endcond diff --git a/ports/threadx/qf_port.cpp b/ports/threadx/qf_port.cpp index 5e540b7d..ebc4811f 100644 --- a/ports/threadx/qf_port.cpp +++ b/ports/threadx/qf_port.cpp @@ -2,8 +2,8 @@ /// @brief QF/C++ port to ThreadX, all supported compilers /// @cond ////************************************************************************** -/// Last updated for version 5.9.3 -/// Last updated on 2017-06-19 +/// Last updated for version 5.9.8 +/// Last updated on 2017-09-20 /// /// Q u a n t u m L e a P s /// --------------------------- @@ -143,9 +143,24 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, uint_fast16_t nFree = static_cast(m_eQueue.tx_queue_available_storage); - if (((margin == QF_NO_MARGIN) && (nFree > static_cast(0))) - || (nFree > static_cast(margin))) - { + if (margin == QF_NO_MARGIN) { + if (nFree > static_cast(0)) { + status = true; // can post + } + else { + status = false; // cannot post + Q_ERROR_ID(510); // must be able to post the event + } + } + else if (nFree > static_cast(margin)) { + status = true; // can post + } + else { + status = false; // cannot post + } + + if (status) { // can post the event? + QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_FIFO, QS::priv_.locFilter[QS::AO_OBJ], this) QS_TIME_(); // timestamp QS_OBJ_(sender); // the sender object @@ -164,15 +179,11 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QF_CRIT_EXIT_(); QEvt const *ep = const_cast(e); - Q_ALLEGE_ID(510, + Q_ALLEGE_ID(520, tx_queue_send(&m_eQueue, static_cast(&ep), TX_NO_WAIT) == TX_SUCCESS); - - status = true; // report success } else { - // can tolerate dropping evts? - Q_ASSERT_ID(520, margin != QF_NO_MARGIN); QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_ATTEMPT, QS::priv_.locFilter[QS::AO_OBJ], this) @@ -186,8 +197,6 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QS_END_NOCRIT_() QF_CRIT_EXIT_(); - - status = false; // report failure } return status; diff --git a/ports/ucos-ii/qf_port.cpp b/ports/ucos-ii/qf_port.cpp index 90feafb8..f7814e3f 100644 --- a/ports/ucos-ii/qf_port.cpp +++ b/ports/ucos-ii/qf_port.cpp @@ -2,8 +2,8 @@ /// @brief QF/C++ port to uC/OS-II (V2.92) kernel, all supported compilers /// @cond ////************************************************************************** -/// Last updated for version 5.9.3 -/// Last updated on 2017-06-19 +/// Last updated for version 5.9.8 +/// Last updated on 2017-09-20 /// /// Q u a n t u m L e a P s /// --------------------------- @@ -156,10 +156,26 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, reinterpret_cast(m_eQueue)->OSQSize - reinterpret_cast(m_eQueue)->OSNMsgs); - if (((margin == QF_NO_MARGIN) && (nFree > static_cast(0))) - || (nFree > static_cast(margin))) - { - QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_FIFO, QS::priv_.locFilter[QS::AO_OBJ], this) + if (margin == QF_NO_MARGIN) { + if (nFree > static_cast(0)) { + status = true; // can post + } + else { + status = false; // cannot post + Q_ERROR_ID(710); // must be able to post the event + } + } + else if (nFree > static_cast(margin)) { + status = true; // can post + } + else { + status = false; // cannot post + } + + if (status) { // can post the event? + + QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_FIFO, + QS::priv_.locFilter[QS::AO_OBJ], this) QS_TIME_(); // timestamp QS_OBJ_(sender); // the sender object QS_SIG_(e->sig); // the signal of the event @@ -176,14 +192,10 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QF_CRIT_EXIT_(); // posting the event to uC/OS-II message queue must succeed - Q_ALLEGE_ID(710, + Q_ALLEGE_ID(720, OSQPost(m_eQueue, const_cast(e)) == OS_ERR_NONE); - - status = true; // report success } else { - // can tolerate dropping evts? - Q_ASSERT_ID(520, margin != QF_NO_MARGIN); QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_ATTEMPT, QS::priv_.locFilter[QS::AO_OBJ], this) @@ -197,8 +209,6 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QS_END_NOCRIT_() QF_CRIT_EXIT_(); - - status = false; // report failure } return status; @@ -208,7 +218,8 @@ void QActive::postLIFO(QEvt const * const e) { QF_CRIT_STAT_ QF_CRIT_ENTRY_(); - QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_LIFO, QS::priv_.locFilter[QS::AO_OBJ], this) + QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_LIFO, + QS::priv_.locFilter[QS::AO_OBJ], this) QS_TIME_(); // timestamp QS_SIG_(e->sig); // the signal of this event QS_OBJ_(this); // this active object diff --git a/source/qf_actq.cpp b/source/qf_actq.cpp index 6d8fdd22..c033a3a6 100644 --- a/source/qf_actq.cpp +++ b/source/qf_actq.cpp @@ -9,7 +9,7 @@ /// @cond ///*************************************************************************** /// Last updated for version 5.9.8 -/// Last updated on 2017-09-07 +/// Last updated on 2017-09-20 /// /// Q u a n t u m L e a P s /// --------------------------- @@ -100,10 +100,23 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QF_CRIT_ENTRY_(); QEQueueCtr nFree = m_eQueue.m_nFree; // get volatile into the temporary - // margin available? - if (((margin == QF_NO_MARGIN) && (nFree > static_cast(0))) - || (nFree > static_cast(margin))) - { + if (margin == QF_NO_MARGIN) { + if (nFree > static_cast(0)) { + status = true; // can post + } + else { + status = false; // cannot post + Q_ERROR_ID(110); // must be able to post the event + } + } + else if (nFree > static_cast(margin)) { + status = true; // can post + } + else { + status = false; // cannot post + } + + if (status) { // can post the event? QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_FIFO, QS::priv_.locFilter[QS::AO_OBJ], this) diff --git a/src/qf/qf_actq.cpp b/src/qf/qf_actq.cpp index 6d8fdd22..c033a3a6 100644 --- a/src/qf/qf_actq.cpp +++ b/src/qf/qf_actq.cpp @@ -9,7 +9,7 @@ /// @cond ///*************************************************************************** /// Last updated for version 5.9.8 -/// Last updated on 2017-09-07 +/// Last updated on 2017-09-20 /// /// Q u a n t u m L e a P s /// --------------------------- @@ -100,10 +100,23 @@ bool QActive::post_(QEvt const * const e, uint_fast16_t const margin, QF_CRIT_ENTRY_(); QEQueueCtr nFree = m_eQueue.m_nFree; // get volatile into the temporary - // margin available? - if (((margin == QF_NO_MARGIN) && (nFree > static_cast(0))) - || (nFree > static_cast(margin))) - { + if (margin == QF_NO_MARGIN) { + if (nFree > static_cast(0)) { + status = true; // can post + } + else { + status = false; // cannot post + Q_ERROR_ID(110); // must be able to post the event + } + } + else if (nFree > static_cast(margin)) { + status = true; // can post + } + else { + status = false; // cannot post + } + + if (status) { // can post the event? QS_BEGIN_NOCRIT_(QS_QF_ACTIVE_POST_FIFO, QS::priv_.locFilter[QS::AO_OBJ], this)