Skip to content
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

chore(PeriphDrivers): Replace pow() with left shift in MAX32670 and MAX32672 UART drivers #1217

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

ttmut
Copy link
Contributor

@ttmut ttmut commented Oct 8, 2024

Description

Since aon_clk_div is an integer, pow(2, aon_clk_div) can be replaced with (1 << aon_clk_div) in MXC_UART_SetFrequency. This eliminates the need to include <math.h> in UART driver.

Motive

Zephyr uses its own math library which provides an implementation of pow(). When running batch tests, however, it switches to a minimal implementation of the C library that does not include the pow() function. As a result, UART drivers cannot be compiled and tests fail.

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.
  • (Optional) Link any related GitHub issues using a keyword
  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.

pow(2, aon_clk_div) can be replaced with (1 << aon_clk_div) to eliminate
the need to include <math.h>.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
@github-actions github-actions bot added MAX32670 Related to the MAX32670 (ME15) MAX32672 Related to the MAX32672 (ME21) MAX32675 Related to the MAX32675 (ME16) labels Oct 8, 2024
@ttmut
Copy link
Contributor Author

ttmut commented Oct 8, 2024

Is this change reasonable for you, @Jake-Carter, @sihyung-maxim?

Thanks.

@ttmut ttmut changed the title chore(PeriphDrivers): Replace pow() with left shift in MAX32672 and MAX32675 UART drivers chore(PeriphDrivers): Replace pow() with left shift in MAX32670 and MAX32672 UART drivers Oct 8, 2024
@sihyung-maxim sihyung-maxim merged commit 3630152 into main Oct 8, 2024
15 checks passed
@sihyung-maxim sihyung-maxim deleted the chore/uart_aod branch October 8, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MAX32670 Related to the MAX32670 (ME15) MAX32672 Related to the MAX32672 (ME21) MAX32675 Related to the MAX32675 (ME16)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants