-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/riscv: model Kconfig #16909
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/riscv: model Kconfig #16909
Conversation
cpu/riscv_common/periph/Kconfig
Outdated
# TODO: this modules are actually just artifacts from the way periph_init_% | ||
# modules are handled in Makefile. We need to define them to keep the list the | ||
# same for now. We should be able to remove them later on. | ||
config MODULE_PERIPH_INIT_CLIC | ||
bool | ||
default MODULE_PERIPH_CLIC | ||
|
||
config MODULE_PERIPH_INIT_CORETIMER | ||
bool | ||
default MODULE_PERIPH_CORETIMER | ||
|
||
config MODULE_PERIPH_INIT_PLIC | ||
bool | ||
default MODULE_PERIPH_PLIC | ||
|
||
endif # MODULE_RISCV_COMMON_PERIPH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add them here as well
RIOT/makefiles/features_modules.inc.mk
Lines 13 to 18 in 7bfcda9
ifneq (,$(filter periph_init, $(USEMODULE))) | |
PERIPH_IGNORE_MODULES := \ | |
periph_init% \ | |
periph_common \ | |
periph_rtc_rtt \ | |
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, did not know that one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into the same a decided against adding modules just for the sake of it hahaha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now added in c9dc338
Generally looks good, lets trigger the ci! |
sys/Kconfig
Outdated
choice LIBC_IMPLEMENTATION | ||
bool "Libc implementation" | ||
depends on TEST_KCONFIG | ||
default MODULE_NEWLIB if USE_LIBC_NEWLIB | ||
default MODULE_PICOLIBC if USE_LIBC_PICOLIBC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an alternative proposal for this one, which uses less symbols:
choice LIBC_IMPLEMENTATION
bool "Libc implementation"
depends on TEST_KCONFIG
config MODULE_NEWLIB
bool "NewLib"
config MODULE_PICOLIBC
bool "Picolibc"
endchoice
The default can be chosen in riscv_common/Kconfig
as:
choice LIBC_IMPLEMENTATION
default MODULE_NEWLIB
endchoice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works this way only because there are no dependencies? Or would we be able to override it in any case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually depends on TEST_KCONFIG
, and that does not seem to be weakened when I tested locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find references to this behaviour in the official docs, but in Zephyr's docs they mention:
To change the default symbol of FOO to A, you would add the following definition to Kconfig.defconfig:
choice FOO default A endchoice
The Kconfig.defconfig method should be used when the dependencies of the choice might not be satisfied. In that case, you’re setting the default selection whenever the user makes the choice visible.
Something seems to be wrong with newlib and native |
select MODULE_PERIPH_PLIC if TEST_KCONFIG | ||
select MODULE_PERIPH_CORETIMER if MODULE_PERIPH_TIMER && HAS_PERIPH_CORETIMER | ||
select MODULE_PERIPH_RTT if MODULE_PERIPH_RTC && HAS_PERIPH_RTT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seem like ztimer_periph_rtc
is not the default backend in Makefile.dep
you could either force it in the application through Kconfig or add the following
ifneq (,$(filter ztimer_sec,$(USEMODULE)))
USEMODULE += ztimer
# native rtc is based on xtimer, no sense in using it and its actually buggy
ifeq (,$(filter native,$(BOARD)))
FEATURES_OPTIONAL += periph_rtc
endif
include $(RIOTMAKE)/features_check.inc.mk
ifneq (,$(filter periph_rtc,$(FEATURES_USED)))
USEMODULE += ztimer_periph_rtc
else
FEATURES_OPTIONAL += periph_rtt
include $(RIOTMAKE)/features_check.inc.mk
ifneq (,$(filter periph_rtt,$(FEATURES_USED)))
USEMODULE += ztimer_periph_rtt
else
USEMODULE += ztimer_periph_timer
endif
endif
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Added
select HAS_SSP | ||
|
||
select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG | ||
imply MODULE_NEWLIB_NANO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't TEST_KCONFIG
missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imply will not force it, if TEST_KCONFIG
is not there (or some other dependency for that matter), the symbol is not enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why this also works when picolibc is selected, newlib_nano would not be enabled in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last comment, but please squash afterwards
c9dc338
to
2d36f24
Compare
Squashed! |
@@ -108,3 +108,27 @@ ifneq (,$(filter ztimer_msec,$(USEMODULE))) | |||
USEMODULE += ztimer_periph_timer | |||
endif | |||
endif | |||
|
|||
ifneq (,$(filter ztimer_sec,$(USEMODULE))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benpicco how would this affet your rtc_rtt
concerns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, this is already an issue in master... so this does not make the problem worse..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to find a solution for this in a follow up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, please rebase and squash (
2d36f24
to
bda69da
Compare
Thanks for the review! |
Contribution description
This models the Kconfig modules for risc-v and adds two boards for the CI tests. For this I had to model libc modules, I'd like some feedback on those.
Testing procedure
Issues/PRs references
#16875