[riot-notifications] [RIOT-OS/RIOT] cpu/saml21: Make Low-Power SRAM available to programs (#11486)

Dylan Laduranty notifications at github.com
Mon Sep 30 21:43:57 CEST 2019


dylad commented on this pull request.

I guess this PR is almost good to go !
Just some comments

> +
+    if (counter == 0) {
+        puts("\nBackup RAM test\n");
+        printf("This test will increment the counter by 1, "
+               "then enter deep sleep for %ds\n", SLEEP_SEC);
+    } else if (counter_noinit == counter) {
+        puts("WARNING: non-backup memory retained - did we really enter deep sleep?");
+    }
+
+    printf("counter: %d\n", ++counter);
+    counter_noinit = counter;
+
+    /* Some tools have trouble flashing MCUs in deep sleep.
+     * Wait a bit to make re-flashing / debugging easier.
+     */
+    xtimer_sleep(3);

This traditional delay is troublesome because you're suppose to see the counter increments by one every second but currently this is not the case.

> +{
+    /* We keep a copy of counter in the .noinit section (normal RAM).
+     * In the deepest sleep normal RAM is not retained, so if it matches
+     * counter anyway after wakeup, we did not sleep properly.
+     */
+    static int counter_noinit __attribute__((section(".noinit")));
+    static int counter __attribute__((section(".backup.bss")));
+
+    if (counter == 0) {
+        puts("\nBackup RAM test\n");
+        printf("This test will increment the counter by 1, "
+               "then enter deep sleep for %ds\n", SLEEP_SEC);
+    } else if (counter_noinit == counter) {
+        puts("WARNING: non-backup memory retained - did we really enter deep sleep?");
+    }
+

My personal taste would have place `#ifndef CPU_BACKUP_RAM_NOT_RETAINED` here so SAML21 platform doesn't display the counter before saying "aborting test". You may ignore this comment if you're fine this way.

-- 
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/11486#pullrequestreview-295205823
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190930/6db68004/attachment.htm>


More information about the notifications mailing list