Conversation
This rename EFM32_LEUART_ENABLED to CONFIG_EFM32_FEATURE_LEUART. For backwards compatibility (for the time being), efm32-features.mk is still included if CONFIG_KCONFIG_CPU_EFM32 is undefined.
leandrolanzieri
left a comment
There was a problem hiding this comment.
Nice to start having CPUs in Kconfig! Changes look good, just some comments.
| # should override them from the command line, or in your Makefile. Note that | ||
| # some features may not be applicable to all EFM32 boards or CPUs. | ||
| export EFM32_LEUART_ENABLED ?= 1 | ||
| export CONFIG_EFM32_FEATURE_LEUART ?= 1 |
There was a problem hiding this comment.
I think we should keep the CONFIG_ namespace in Makefile variables for Kconfig generated symbols.
There was a problem hiding this comment.
True, but that would break backwards compatibility. Since Kconfig is still optional, I need to have a default value for this option, right?
If I would remove it, support for LEUART would always be disabled.
There was a problem hiding this comment.
But the only use for this variable is to set a CFLAG when Kconfig is not being used. So you can just keep the old name for the Makefile variable, and only check for its value if Kconfig was not used:
ifndef CONFIG_KCONFIG_CPU_EFM32
ifeq (1,$(EFM32_FEATURE_LEUART))
CFLAGS += -DCONFIG_EFM32_FEATURE_LEUART=1
endif
endif| @@ -0,0 +1,11 @@ | |||
| # Copyright (c) 2019 HAW Hamburg | |||
There was a problem hiding this comment.
| # Copyright (c) 2019 HAW Hamburg | |
| # Copyright (c) 2020 Bas Stottelaar <[email protected]> |
There was a problem hiding this comment.
It was copy-paste, so I did not change the copyright. I don't mind taking it though ;-)
| @@ -1,4 +1,6 @@ | |||
| include $(RIOTCPU)/efm32/efm32-features.mk | |||
| ifndef CONFIG_KCONFIG_CPU_EFM32 | |||
There was a problem hiding this comment.
Is the conditional include necessary? When setting the CFLAG in line you are already checking for CONFIG_KCONFIG_CPU_EFM32
There was a problem hiding this comment.
If I understand correctly, setting CONFIG_KCONFIG_CPU_EFM32 indicates that Kconfig was used. In that case, I don't want to include the default value.
| # For now, get used modules as macros from this file (see kconfig.mk) | ||
| osource "$(KCONFIG_GENERATED_DEPENDENCIES)" | ||
|
|
||
| rsource "cpu/Kconfig" |
There was a problem hiding this comment.
@leandrolanzieri Is it planned that the board will also be selected via Kconfig?
If not, at least the board must be specified at make command line, so the CPU is known. In this case I wonder if it wouldn't be better to include the CPU configuration as follows
| rsource "cpu/Kconfig" | |
| # The CPU may declare new symbols as well | |
| osource "$(RIOTBASE)/cpu/$(CPU)/Kconfig" | |
This would avoid the user having to select the CPU from a list. He would only have one top-level menu entry for the specified CPU, provided the CPU has a `Kconfig' file.
There was a problem hiding this comment.
@leandrolanzieri Is it planned that the board will also be selected via Kconfig?
We can move towards this, but not just yet as it has huge implications in the resolution of module dependencies.
If not, at least the board must be specified at make command line, so the CPU is known.
The configurator gets executed after $(BOARD) and $(CPU) being defined, always.
This would avoid the user having to select the CPU from a list. He would only have one top-level menu entry for the specified CPU, provided the CPU has a `Kconfig' file.
I think the way @basilfx is adding the menuconfig entry is correct, as it depends on the modules defined for EFM32 CPUs. That means that the user will only see the entry for the CPU that's being used. Right now this is not for selecting a particular CPU but to configure its parameters.
There was a problem hiding this comment.
Ok, my concern is the usability. To configure the CPU, you have to select the CPU in main, then you have to enable the CPU for configuration first, and then you can enter into the CPU configuration
CPU --->
[*] Configure EFM32 CPU (NEW) --->
Features --->
[ ] Enable EMLIB assertions (NEW)
If there is only one CPU at the same time, why not to add Configure EFM32 CPU (NEW) directly to the main menu.
I'm just asking because I have the same issue for ESPs and solved it in different way. If you define that there should only be menu entries in the main menu and no menuconfig entries, that would be fine with me and I would do it in the same for the ESPs.
There was a problem hiding this comment.
We could, in the root Kconfig file, do:
rsource "$(RIOTCPU)/*/Kconfig"
But if we then start having 'common' Kconfig files then this will add more than one entry in the Top level. Maybe then having a CPU menu is better.
Also for that we can just include every CPU using glob patterns:
# in /cpu/Kconfig
menu "CPU"
rsource "*/Kconfig"
endmenu
There was a problem hiding this comment.
I tried the latter, it works. So it is not necessary to include each cpu/*/Kconfig file separately.
|
@leandrolanzieri next steps to move? |
|
In #13377 it was decided to go with the approach proposed by @gschorcht, so this needs rebasing now to adapt to it. |
|
@leandrolanzieri @basilfx is this still valid? |
|
The PR is valid but needs some rebasing and adaption |
|
It seems that #14310 also addressed the Kconfig support for EFM32 and is already merged. Is this PR still relevant or should it be closed ? |
This PR exposes in addition a couple of configurations: So those changes are still valid. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
This is my attempt to get acquainted with Kconfig. I tried to migrate the existing EFM32 features into Kconfig, while still being backwards compatible (note that some of the features are part of the documentation, e.g. this example).
Testing procedure
There are currently two config options available.
To test
EFM32_FEATURE_LEUART, use thetests/cpu_efm32_features. Without Kconfig, this compiles as-is. When using Kconfig, deliberatly setEFM32_FEATURE_LEUART=yand notice that compilation will fail (as intended).To test
EFM32_EMLIB_ASSERTIONS, run (for instance)QUIET=0 BOARD=slstk3401a make -C examples/defaultand observe that-DDEBUG_EFMis not added toCFLAGS. Then setEFM32_EMLIB_ASSERTIONS=yand compile again. This time, the flag is present (and the resulting binary is now a bit bigger).Issues/PRs references
None