The following patch fixes chRegNextThread() when CH_CFG_USE_DYNAMIC == FALSE. It sets ntp to a value on the else statement.
Thanks!
Code: Select all
diff --git a/os/rt/src/chregistry.c b/os/rt/src/chregistry.c
index be0a40c6a..5318d9392 100644
--- a/os/rt/src/chregistry.c
+++ b/os/rt/src/chregistry.c
@@ -164,18 +164,18 @@ thread_t *chRegNextThread(thread_t *tp) {
if (nqp == REG_HEADER(currcore)) {
ntp = NULL;
}
-#if CH_CFG_USE_DYNAMIC == TRUE
else {
uint8_t *p = (uint8_t *)nqp;
/*lint -save -e413 [1.3] Safe to subtract a calculated offset.*/
ntp = (thread_t *)(p - __CH_OFFSETOF(thread_t, rqueue));
/*lint -restore*/
+#if CH_CFG_USE_DYNAMIC == TRUE
chDbgAssert(ntp->refs < (trefs_t)255, "too many references");
ntp->refs++;
- }
#endif
+ }
chSysUnlock();
#if CH_CFG_USE_DYNAMIC == TRUE
chThdRelease(tp);