You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "wiktorkwiatkowski (via GitHub)" <gi...@apache.org> on 2026/07/30 08:19:40 UTC

[PR] Watchdog mtest [mynewt-core]

wiktorkwiatkowski opened a new pull request, #3719:
URL: https://github.com/apache/mynewt-core/pull/3719

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] mtest: Add watchdog test [mynewt-core]

Posted by "sjanc (via GitHub)" <gi...@apache.org>.
sjanc commented on code in PR #3719:
URL: https://github.com/apache/mynewt-core/pull/3719#discussion_r3820762915


##########
test/mtest/mtest_watchdog/src/main.c:
##########
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os_time.h"
+#include "mtest_watchdog/mtest_watchdog.h"
+
+#define FIRST_BOOT_DONE 0xC001B007
+volatile int reset_count __attribute__((section(".noinit")));
+volatile int boot_status __attribute__((section(".noinit")));
+
+MTEST_INIT(watchdog_test)
+{
+    if (boot_status != FIRST_BOOT_DONE) {
+        reset_count = 0;
+        boot_status = FIRST_BOOT_DONE;
+        /* Readback required by STM32H723ZG to ensure data reaches DTCM */
+        (void)boot_status;
+    }
+}
+
+MTEST_SUITE(watchdog_test)
+{
+    MTEST_RUN_INIT(watchdog_test);
+    switch (reset_count) {
+    case 0:
+        watchdog_test_case_1();

Review Comment:
   switch is fine,  but comment if  fall-through is on purpose



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] mtest: Add watchdog test [mynewt-core]

Posted by "wiktorkwiatkowski (via GitHub)" <gi...@apache.org>.
wiktorkwiatkowski commented on code in PR #3719:
URL: https://github.com/apache/mynewt-core/pull/3719#discussion_r3820508808


##########
test/mtest/mtest_watchdog/src/main.c:
##########
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os_time.h"
+#include "mtest_watchdog/mtest_watchdog.h"
+
+#define FIRST_BOOT_DONE 0xC001B007
+volatile int reset_count __attribute__((section(".noinit")));
+volatile int boot_status __attribute__((section(".noinit")));
+
+MTEST_INIT(watchdog_test)
+{
+    if (boot_status != FIRST_BOOT_DONE) {
+        reset_count = 0;
+        boot_status = FIRST_BOOT_DONE;
+        /* Readback required by STM32H723ZG to ensure data reaches DTCM */
+        (void)boot_status;
+    }
+}
+
+MTEST_SUITE(watchdog_test)
+{
+    MTEST_RUN_INIT(watchdog_test);
+    switch (reset_count) {
+    case 0:
+        watchdog_test_case_1();

Review Comment:
   I can change the switch statement to something like this:
   ```
   if (reset_count == 0) { 
           watchdog_test_case_1();
           watchdog_test_case_2();
       } else if (reset_count == 1) {
           watchdog_test_case_2();
       } else {
           boot_status = 0;
           reset_count = 0;
       } 
   ```
   It will work the same but will get rid of the fallthrough in the switch statement.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] mtest: Add watchdog test [mynewt-core]

Posted by "sjanc (via GitHub)" <gi...@apache.org>.
sjanc merged PR #3719:
URL: https://github.com/apache/mynewt-core/pull/3719


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] mtest: Add watchdog test [mynewt-core]

Posted by "sjanc (via GitHub)" <gi...@apache.org>.
sjanc commented on code in PR #3719:
URL: https://github.com/apache/mynewt-core/pull/3719#discussion_r3795618073


##########
test/mtest/mtest_watchdog/src/main.c:
##########
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os_time.h"
+#include "mtest_watchdog/mtest_watchdog.h"
+
+#define FIRST_BOOT_DONE 0xC001B007
+volatile int reset_count __attribute__((section(".noinit")));
+volatile int boot_status __attribute__((section(".noinit")));
+
+MTEST_INIT(watchdog_test)
+{
+    if (boot_status != FIRST_BOOT_DONE) {
+        reset_count = 0;
+        boot_status = FIRST_BOOT_DONE;
+        /* Readback required by STM32H723ZG to ensure data reaches DTCM */
+        (void)boot_status;
+    }
+}
+
+MTEST_SUITE(watchdog_test)
+{
+    MTEST_RUN_INIT(watchdog_test);
+    switch (reset_count) {
+    case 0:
+        watchdog_test_case_1();

Review Comment:
   while those functions should never return I'd still add break for sake of coding style



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] mtest: Add watchdog test [mynewt-core]

Posted by "wiktorkwiatkowski (via GitHub)" <gi...@apache.org>.
wiktorkwiatkowski commented on code in PR #3719:
URL: https://github.com/apache/mynewt-core/pull/3719#discussion_r3820458970


##########
test/mtest/mtest_watchdog/src/main.c:
##########
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "sysinit/sysinit.h"
+#include "os/os_time.h"
+#include "mtest_watchdog/mtest_watchdog.h"
+
+#define FIRST_BOOT_DONE 0xC001B007
+volatile int reset_count __attribute__((section(".noinit")));
+volatile int boot_status __attribute__((section(".noinit")));
+
+MTEST_INIT(watchdog_test)
+{
+    if (boot_status != FIRST_BOOT_DONE) {
+        reset_count = 0;
+        boot_status = FIRST_BOOT_DONE;
+        /* Readback required by STM32H723ZG to ensure data reaches DTCM */
+        (void)boot_status;
+    }
+}
+
+MTEST_SUITE(watchdog_test)
+{
+    MTEST_RUN_INIT(watchdog_test);
+    switch (reset_count) {
+    case 0:
+        watchdog_test_case_1();

Review Comment:
   https://github.com/apache/mynewt-core/blob/2705534e37259f1684d6fc360adfc7b0bcd08da4/test/mtest/mtest_watchdog/src/watchdog_test_cases.c#L46-L48
   
   `watchdog_test_case_1();` actually does return when the time counter is at least 2x `WATCHDOG_INTERVAL`. 
   Adding a `break` statement would break the test flow, and `watchdog_test_case_2();` would never execute.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org