[riot-notifications] [RIOT-OS/RIOT] cpu/cortexm_common: function to check address validity (#11358)

Alexandre Abadie notifications at github.com
Mon Apr 8 21:18:37 CEST 2019


aabadie requested changes on this pull request.

Just a couple of small things. I think comments from #10051 are addressed by this PR.

Maybe also add a couple of kinetis in the list of whitelisted boards (there are only stm32 and sam for the moment) ?
I also think an automated python test script could be added in a follow-up PR.

> @@ -0,0 +1,16 @@
+APPLICATION = cortexm_address_check

This variable is not needed

> +    static const uint32_t BFARVALID_MASK = (0x80 << SCB_CFSR_BUSFAULTSR_Pos);
+
+    bool is_valid = true;
+
+    /* Clear BFARVALID flag */
+    SCB->CFSR |= BFARVALID_MASK;
+
+    /* Ignore BusFault by enabling BFHFNMIGN and disabling interrupts */
+    uint32_t mask = __get_FAULTMASK();
+    __disable_fault_irq();
+    SCB->CCR |= SCB_CCR_BFHFNMIGN_Msk;
+
+    *address;
+    /* Check BFARVALID flag */
+    if ((SCB->CFSR & BFARVALID_MASK) != 0)
+    {

This curly brace should be at the end of previous line

> +#include "shell.h"
+
+static int cmd_check(int argc, char **argv)
+{
+    if (argc < 2) {
+        printf("usage: %s <hex address>\n", argv[0]);
+        printf("\t example: %s 0x08080000\n", argv[0]);
+        return 1;
+    }
+
+    char *address;
+    uint32_t address_value = strtol(argv[1], NULL, 0);
+
+    address = (char *)address_value;
+
+    if (cpu_check_address(address))

missing curly brace (we use it even for single line blocks)

-- 
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/11358#pullrequestreview-224034937
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190408/95cc2b75/attachment.html>


More information about the notifications mailing list