boards/ek-lm4f120x: Change internal LED macro for C2Rust compatibility#20831
Merged
mguetschow merged 2 commits intoRIOT-OS:masterfrom Aug 26, 2024
Merged
Conversation
e8f2168 to
121785b
Compare
C preprocessor defines in non-function form are assumed by C2Rust to be constant if they are an expression and not a statement; the LED_PORT was the only place in the code where that was wrong, and led to compiler errors due to the value not being constant. Altering the internal macro to use function form sidesteps that issue. The generally preferred alternative of using a `const` is unavailable in this case because the dereferencing operator is already part of the vendor header file cpu/stellaris_common/include/vendor/cortex-m4-def.h. The changed macro is documented as required by doccheck. The doccheck rule that grandfathered in the LED_PORT macro as allowed undocumented is not removed because it is also used in other board.h files.
121785b to
b802a19
Compare
chrysn
commented
Aug 23, 2024
|
|
||
| #define LED_PORT (GPIO_PORTF_DATA_R) | ||
| /** | ||
| * @brief Port used for `LED0_ON` and similar implementations |
Member
Author
There was a problem hiding this comment.
This is LED0_ON and not @ref LED0_ON because Doxygen could not resolve that.
mguetschow
approved these changes
Aug 26, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
With that applied, a bunch of BOARD_BLACKLIST entries can be removed (from all Rust Makefiles we have).
Testing procedure
I did not test LED blinking on that board as I don't have one, but the change should be sufficiently easy to verify on a theoretical level (supported by the compiler passing).