-
Notifications
You must be signed in to change notification settings - Fork 1k
Kill break warnings #1015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kill break warnings #1015
Conversation
"(void)(tmpreg);" is causing a lot of compiler warnings which is making it hard to see if there are any real problems. As best I can tell there is not a functional need for this variable.
|
Hi @Bob-the-Kuhn ,
To guaranty the APB clock cycle, driver perform a Read operation READ_REG. With the code you proposed, the result of read is not used, and the compiler may optimize it by removing associated the code. This is the reason why it is needed to put the result in volatile variable (__IO means volatile) and make a fake use of this result, to prevent compiler optimization. |
|
Thanks @ABOSTM for this explanation. I was not aware of this. |
|
I knew there had to be a good reason for the __IO and tmpreg. Keeping the needed read operation from being optimized out did not occur to me. I'm wondering if there are alternatives to guarantee the delay. How about: |
|
You should report it one level higher like @fpistm mention, in other way one need to fight with it every stm libs update. |
|
I'm uncertain as to how to proceed. From the text above it sounds like I should go through all the listed repositories and open an issue in each of them. Do NOT open a PR. But ... it appears that there have been almost zero issues or PRs opened against the listed repositories. To me that implies that requests for changes from the user community usually go through a different channel. What is the preferred method of asking for code changes? |
|
You could file an issue this will be take in account.
and mention it is the same in other STM32Cube. |
"(void)(tmpreg);" is causing a lot of compiler warnings which is making it hard to see if there are any real problems.
warning: conversion to void will not access object of type 'volatile uint32_t {aka volatile long unsigned int}'As best I can tell there is not a functional need for this variable.
I am using PlatformIO to compile. The GCC library JSON says: