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

cpu/stm32: Add clock config for mp1 to kconfig #17521

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

MrKevinWeiss
Copy link
Contributor

Contribution description

This adds the clock config and makes kconfig work for the stm32mp1 based boards (currently only stm32mp157c-dk2).
U also added some way to print the values of the macros... Maybe we would leave it in, especially for some of the more complex things.

Testing procedure

murdock passes and kconfig binaries match.

Issues/PRs references

#14975

@MrKevinWeiss MrKevinWeiss requested a review from aabadie January 14, 2022 13:20
@github-actions github-actions bot added Area: boards Area: Board ports Area: CI Area: Continuous Integration of RIOT components Area: cpu Area: CPU/MCU ports Area: Kconfig Area: Kconfig integration Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Jan 14, 2022
@MrKevinWeiss
Copy link
Contributor Author

This was done in something of a hurry but seems to work locally. Maybe @aabadie can give it a quick look to make sure I am on track before I make it nice and clean.

I would also like to know if I should update the ranges for some of these, this MP1 has huge available ranges it seems.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good is @gdoffe could test this PR and try to customize the clock parameters and see if the firmware is usable (at least stdio should work).

You could look at the testing procedure in #15632 as an example.

@@ -15,3 +15,10 @@ config BOARD_STM32MP157C_DK2
# Put defined MCU peripherals here (in alphabetical order)
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_PERIPH_GPIO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be already selected at CPU level ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I think I was just trying to copy what was in the makefile FEATURES_PROVIDED. Fixed.

Comment on lines 131 to 145
#ifdef SHOW_MACRO_VALUES_WITH_PRAGMA_MESSAGE
#pragma message "The values after cfg_clock_default.h applied"
#pragma message "CONFIG_CLOCK_PLL_M: " XSTR(CONFIG_CLOCK_PLL_M)
#pragma message "CONFIG_BOARD_HAS_HSE: " XSTR(CLOCK_HSE)
#pragma message "CONFIG_CLOCK_PLL_N: " XSTR(CONFIG_CLOCK_PLL_N)
#pragma message "CONFIG_CLOCK_PLL_P: " XSTR(CONFIG_CLOCK_PLL_P)
#pragma message "CONFIG_CLOCK_PLL_Q: " XSTR(CONFIG_CLOCK_PLL_Q)
#pragma message "CONFIG_CLOCK_PLL_R: " XSTR(CONFIG_CLOCK_PLL_R)
#pragma message "CONFIG_CLOCK_MCU_DIV: " XSTR(CONFIG_CLOCK_MCU_DIV)
#pragma message "CONFIG_CLOCK_APB1_DIV: " XSTR(CONFIG_CLOCK_APB1_DIV)
#pragma message "CONFIG_CLOCK_APB2_DIV: " XSTR(CONFIG_CLOCK_APB2_DIV)
#pragma message "CONFIG_CLOCK_APB3_DIV: " XSTR(CONFIG_CLOCK_APB3_DIV)
#pragma message "CLOCK_CORECLOCK: " XSTR(CLOCK_CORECLOCK)
#endif /* SHOW_MACRO_VALUES_WITH_PRAGMA_MESSAGE */

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears twice in this file, is this expected ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was more meant for a before and after picture, this way we could know if a value was applied by something else such as kconfig or another override vs applied by this file. This one is actually pretty easy to view but others can be a bit tricky (at least for me).

I also don't know if we want this in, it is a bit ugly I find. Maybe there is a more clever way of doing this though in order to resolve macros.

Copy link
Contributor

@aabadie aabadie Jan 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better remove it for now. In my previous clock rework PRs, I printed the values at runtime, which is less handy but ensures that the generated firmware is valid (correct core clock, etc).

@MrKevinWeiss MrKevinWeiss force-pushed the pr/kconfig/stm32mp1clock branch from be81bb9 to 68e94ea Compare February 3, 2022 11:21
@MrKevinWeiss
Copy link
Contributor Author

rebased and cleanup

@fjmolinas
Copy link
Contributor

@aabadie I think none of us sadly has the hardware, but this PR is stalling Kconfig migration, can we go with this one and hopefully @gdoffe will have time in the near future to test and then we can eventually fix if something is off

@gdoffe
Copy link
Contributor

gdoffe commented Feb 4, 2022

@aabadie I think none of us sadly has the hardware, but this PR is stalling Kconfig migration, can we go with this one and hopefully @gdoffe will have time in the near future to test and then we can eventually fix if something is off

Hi all,

I think it is the most reasonable choice @fjmolinas. I still have the hardware, I will do it with pleasure, but most certainly in coming weeks rather than in coming days.

@MrKevinWeiss
Copy link
Contributor Author

This also doesn't effect the make based building so I guess it is low risk. If we get it in then maybe @gdoffe tests in a few weeks, if things are ok great, if not we can fix it later. Lets just try not to forget (something that happens quite often with me).

@MrKevinWeiss MrKevinWeiss added CI: full build disable CI build filter CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Feb 7, 2022
@fjmolinas
Copy link
Contributor

This also doesn't effect the make based building so I guess it is low risk. If we get it in then maybe @gdoffe tests in a few weeks, if things are ok great, if not we can fix it later. Lets just try not to forget (something that happens quite often with me).

Lets go with this then!

Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK!

@fjmolinas
Copy link
Contributor

@aabadie are you ok with merging? (didn't hit auto-merge yet)

@aabadie aabadie enabled auto-merge February 7, 2022 09:14
@aabadie
Copy link
Contributor

aabadie commented Feb 7, 2022

are you ok with merging? (didn't hit auto-merge yet)

Yes (auto-merge enabled :) )

@aabadie aabadie merged commit 4e007d3 into RIOT-OS:master Feb 7, 2022
@MrKevinWeiss MrKevinWeiss deleted the pr/kconfig/stm32mp1clock branch February 7, 2022 10:48
@OlegHahm OlegHahm added this to the Release 2022.04 milestone Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: CI Area: Continuous Integration of RIOT components Area: cpu Area: CPU/MCU ports Area: Kconfig Area: Kconfig integration CI: full build disable CI build filter CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants