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

Oleg Artamonov notifications at github.com
Thu Apr 11 18:31:17 CEST 2019


Hi Yes, it seems recent gcc optimizes it out as it can't see that variable can be changed between declaration and return This should work: https://github.com/unwireddevices/RIOT/commit/b8f4e59988ba28e02b9624dfd5821b55acf31507 -- Sincerely yours,Oleg Artamonov+7 (916) 631-34-90www.unwds.com   11.04.2019, 19:04, "Francisco" <notifications at github.com>:@kaspar030 I was dooing a final round of testing and found that the M0 catch wasn't working, well it was but the function was allwats returning 1. Looking in to it i found that:register uint32_t result __asm("r5") = 1;was being optimized in a way where result was always though to be 1. My fix was to load the register with 1 before assigning result to "r5". I'm honestly not very knowledge in assembly, so I would love your input on that fix, or a suggestion for a different one.    __asm__ volatile (
        "ldr  r5, =0x1   \n" /* load r5 with 1 to set result    */
    );

    /* R5 will be set to 0 by HardFault handler */
    /* to indicate HardFault has occured */
    register uint32_t result __asm("r5");
PS: didn't squash this late modification since I'm not sure why it wasn't a problem in the original branch, maybe my compiler version?—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

-- 
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#issuecomment-482188101
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190411/24e0ec85/attachment.html>


More information about the notifications mailing list