diff --git a/os/rt/include/chlists.h b/os/rt/include/chlists.h index bce7b39ca..6157e173d 100644 --- a/os/rt/include/chlists.h +++ b/os/rt/include/chlists.h @@ -539,7 +539,7 @@ static inline void ch_dlist_insert(ch_delta_list_t *dlhp, /* The delta list is scanned in order to find the correct position for this element. */ dlp = dlhp->next; - while (dlp->delta < delta) { + while (likely(dlp->delta < delta)) { /* Debug assert if the element is already in the list.*/ chDbgAssert(dlp != dlep, "element already in list"); diff --git a/os/rt/src/chvt.c b/os/rt/src/chvt.c index 46762f583..01db1bb45 100644 --- a/os/rt/src/chvt.c +++ b/os/rt/src/chvt.c @@ -479,20 +479,21 @@ void chVTDoTickI(void) { if (ch_dlist_isempty(&vtlp->dlist)) { vt_insert_first(vtlp, vtp, now, delay); - } - else { - /* Delay as delta from 'lasttime'. Note, it can overflow and the value - becomes lower than 'nowdelta'. In that case the delta is shortened - to make it fit the numeric range and the timer will be triggered - "nowdelta" cycles earlier.*/ - delta = nowdelta + delay; - if (delta < nowdelta) { - delta = delay; - } - /* Insert into delta list. */ - ch_dlist_insert(&vtlp->dlist, &vtp->dlist, delta); + return; } + + /* Delay as delta from 'lasttime'. Note, it can overflow and the value + becomes lower than 'nowdelta'. In that case the delta is shortened + to make it fit the numeric range and the timer will be triggered + "nowdelta" cycles earlier.*/ + delta = nowdelta + delay; + if (delta < nowdelta) { + delta = delay; + } + + /* Insert into delta list. */ + ch_dlist_insert(&vtlp->dlist, &vtp->dlist, delta); } } diff --git a/testrt/VT_STORM/cfg/stm32g474re_nucleo64/chconf.h b/testrt/VT_STORM/cfg/stm32g474re_nucleo64/chconf.h index 94d9d6de1..562ca15d2 100644 --- a/testrt/VT_STORM/cfg/stm32g474re_nucleo64/chconf.h +++ b/testrt/VT_STORM/cfg/stm32g474re_nucleo64/chconf.h @@ -587,7 +587,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) -#define CH_DBG_ENABLE_ASSERTS TRUE +#define CH_DBG_ENABLE_ASSERTS FALSE #endif /** diff --git a/testrt/VT_STORM/make/stm32g474re_nucleo64.make b/testrt/VT_STORM/make/stm32g474re_nucleo64.make index 9686ed02c..250bb0ae6 100644 --- a/testrt/VT_STORM/make/stm32g474re_nucleo64.make +++ b/testrt/VT_STORM/make/stm32g474re_nucleo64.make @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -Og -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). diff --git a/testrt/VT_STORM/source/vt_storm.c b/testrt/VT_STORM/source/vt_storm.c index f641083ef..bc1c3409d 100644 --- a/testrt/VT_STORM/source/vt_storm.c +++ b/testrt/VT_STORM/source/vt_storm.c @@ -283,9 +283,11 @@ void vt_storm_execute(const vt_storm_config_t *cfg) { /* Starting continuous timer.*/ vtcus = 0; - delay = TIME_US2I(120); + delay = TIME_US2I(128); saturated = false; do { + sysinterval_t decrease; + /* Starting sweepers.*/ chSysLock(); chVTSetI(&watchdog, TIME_MS2I(501), watchdog_cb, NULL); @@ -302,7 +304,7 @@ void vt_storm_execute(const vt_storm_config_t *cfg) { chVTSetI(&guard3, TIME_MS2I(250) + (CH_CFG_TIME_QUANTUM * 2), guard_cb, NULL); /* Letting them run for half second.*/ - chThdSleepS(TIME_MS2I(500)); + chThdSleepS(TIME_MS2I(100)); /* Stopping everything.*/ chVTResetI(&watchdog); @@ -326,13 +328,18 @@ void vt_storm_execute(const vt_storm_config_t *cfg) { palToggleLine(config->line); chprintf(cfg->out, "."); - if (delay >= TIME_US2I(1)) { - delay -= TIME_US2I(1); +// if (delay >= TIME_US2I(1)) { +// delay -= TIME_US2I(1); +// } + decrease = delay / (sysinterval_t)64; + if (decrease == (sysinterval_t)0) { + decrease = (sysinterval_t)1; } + delay = delay - decrease; } while (delay >= (sysinterval_t)VT_STORM_CFG_MIN_DELAY); if (saturated) { - chprintf(cfg->out, "\r\nSaturated at %u uS", TIME_I2US(delay)); + chprintf(cfg->out, "\r\nSaturated at %u uS %u ticks", TIME_I2US(delay), delay); chprintf(cfg->out, "\r\nContinuous ticks %u\r\n\r\n", vtcus); } else { diff --git a/testrt/VT_STORM/source/vt_storm.h b/testrt/VT_STORM/source/vt_storm.h index 8356baa62..40ef51041 100644 --- a/testrt/VT_STORM/source/vt_storm.h +++ b/testrt/VT_STORM/source/vt_storm.h @@ -41,7 +41,7 @@ * @brief Timings randomization. */ #if !defined(VT_STORM_CFG_RANDOMIZE) || defined(__DOXYGEN__) -#define VT_STORM_CFG_RANDOMIZE TRUE +#define VT_STORM_CFG_RANDOMIZE FALSE #endif /** @@ -62,7 +62,7 @@ * @brief Enable hammer timers. */ #if !defined(VT_STORM_CFG_HAMMERS) || defined(__DOXYGEN__) -#define VT_STORM_CFG_HAMMERS TRUE +#define VT_STORM_CFG_HAMMERS FALSE #endif /** @} */