[riot-notifications] [RIOT-OS/RIOT] periph/rtt: fix overflow in tick conversion macros (#15431)

Alexandre Abadie notifications at github.com
Wed Nov 11 17:43:09 CET 2020


@aabadie commented on this pull request.



> @@ -47,11 +49,28 @@ void cb(void *arg)
 int main(void)
 {
     puts("\nRIOT RTT low-level driver test");
-    puts("This test will display 'Hello' every 5 seconds\n");
+
+    puts("RTT configuration:");
+    printf("RTT_MAX_VALUE: 0x%08x\n", (unsigned)RTT_MAX_VALUE);
+    printf("RTT_FREQUENCY: %u\n\n", (unsigned)RTT_FREQUENCY);
+
+    puts("Testing the tick conversion");
+    for (unsigned i = 0; i < ARRAY_SIZE(_ticktest); i++) {
+        uint32_t sec = RTT_TICKS_TO_SEC(_ticktest[i]);
+        uint32_t ticks = RTT_SEC_TO_TICKS(sec);
+        printf("Trying to convert %u to seconds and back\n", (unsigned)_ticktest[i]);

```suggestion
        printf("Trying to convert %" PRIu32 " to seconds and back\n", _ticktest[i]);
```
and maybe also for line 55 ?
(I think this test should also work on 8bit AVR)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15431#pullrequestreview-528346479
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201111/3404e1c3/attachment-0001.htm>


More information about the notifications mailing list