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

pkg/cryptoauthlib: model in kconfig #18011

Merged
merged 3 commits into from
May 4, 2022

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Apr 26, 2022

Contribution description

As the title says. The changes are pretty straight forward.

Something I don't quite understand is why I have to explicitly select MODULE_ZTIMER_PERIPH_TIMER as ztimer backend. I thought the backend would be selected automatically (apparently there's another use of choice involved...)

Testing procedure

Green Murdock

Issues/PRs references

None

@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 26, 2022
@github-actions github-actions bot added Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework labels Apr 26, 2022
@aabadie aabadie force-pushed the pr/pkg/cryptoauthlib_kconfig branch from 3eba7c8 to 6d03149 Compare April 26, 2022 09:38
Copy link
Contributor

@Einhornhool Einhornhool left a comment

Choose a reason for hiding this comment

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

In general this works, but I added some change suggestions

Comment on lines 17 to 19
select MODULE_ZTIMER
select MODULE_ZTIMER_USEC
select MODULE_ZTIMER_PERIPH_TIMER
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
select MODULE_ZTIMER
select MODULE_ZTIMER_USEC
select MODULE_ZTIMER_PERIPH_TIMER
select ZTIMER_USEC

Here you can just use this

Copy link
Contributor

Choose a reason for hiding this comment

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

What about this suggestion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That doesn't work (I tried): there were missing ztimer dependencies on some platform (comparing the output of info-modules with and without Kconfig).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, it's ZTIMER_USEC, not MODULE_ZTIMER_USEC. I think I tried the latter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it is a workaround to avoid a circular dependency related to xtimer and ztimer. Hopefully will go away once we switch over

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I pushed that suggestion as well. And squashed.

Comment on lines 8 to 28
config PACKAGE_CRYPTOAUTHLIB
bool "Microchip CryptoAuthentication Library package"
depends on TEST_KCONFIG
select MODULE_AUTO_INIT_SECURITY
select MODULE_CRYPTOAUTHLIB_CONTRIB

config MODULE_CRYPTOAUTHLIB_CONTRIB
bool
depends on TEST_KCONFIG
select MODULE_ZTIMER
select MODULE_ZTIMER_USEC
select MODULE_ZTIMER_PERIPH_TIMER
select MODULE_PERIPH_I2C
select MODULE_PERIPH_I2C_RECONFIGURE if HAS_PERIPH_I2C_RECONFIGURE

config MODULE_CRYPTOAUTHLIB_TEST
bool "Module for cryptoauthlib tests"
depends on TEST_KCONFIG
select MODULE_CRYPTOAUTHLIB_TEST_JWT
select MODULE_CRYPTOAUTHLIB_TEST_TNG
select MODULE_CRYPTOAUTHLIB_TEST_ATCACERT
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
config PACKAGE_CRYPTOAUTHLIB
bool "Microchip CryptoAuthentication Library package"
depends on TEST_KCONFIG
select MODULE_AUTO_INIT_SECURITY
select MODULE_CRYPTOAUTHLIB_CONTRIB
config MODULE_CRYPTOAUTHLIB_CONTRIB
bool
depends on TEST_KCONFIG
select MODULE_ZTIMER
select MODULE_ZTIMER_USEC
select MODULE_ZTIMER_PERIPH_TIMER
select MODULE_PERIPH_I2C
select MODULE_PERIPH_I2C_RECONFIGURE if HAS_PERIPH_I2C_RECONFIGURE
config MODULE_CRYPTOAUTHLIB_TEST
bool "Module for cryptoauthlib tests"
depends on TEST_KCONFIG
select MODULE_CRYPTOAUTHLIB_TEST_JWT
select MODULE_CRYPTOAUTHLIB_TEST_TNG
select MODULE_CRYPTOAUTHLIB_TEST_ATCACERT
menuconfig PACKAGE_CRYPTOAUTHLIB
bool "Microchip CryptoAuthentication Library package"
depends on TEST_KCONFIG
select MODULE_AUTO_INIT_SECURITY
select MODULE_CRYPTOAUTHLIB_CONTRIB
if PACKAGE_CRYPTOAUTHLIB
config MODULE_CRYPTOAUTHLIB_TEST
bool "Module for cryptoauthlib tests"
depends on TEST_KCONFIG
select MODULE_CRYPTOAUTHLIB_TEST_JWT
select MODULE_CRYPTOAUTHLIB_TEST_TNG
select MODULE_CRYPTOAUTHLIB_TEST_ATCACERT
endif # PACKAGE_CRYPTOAUTHLIB
config MODULE_CRYPTOAUTHLIB_CONTRIB
bool
depends on TEST_KCONFIG
select MODULE_ZTIMER
select MODULE_ZTIMER_USEC
select MODULE_ZTIMER_PERIPH_TIMER
select MODULE_PERIPH_I2C
select MODULE_PERIPH_I2C_RECONFIGURE if HAS_PERIPH_I2C_RECONFIGURE

If you do it like this, the test option is hidden from the menu until you choose the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the benefit of having it hidden ?

Copy link
Contributor Author

@aabadie aabadie Apr 26, 2022

Choose a reason for hiding this comment

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

I pushed an alternative without the menu (because I don't see the point in having a menu for configuring modules).

Copy link
Contributor

Choose a reason for hiding this comment

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

It is more intuitive to have modules that depend on the package inside the menuconfig. That is the way we have been doing it so far, instead of having a huge flat list that keeps changing every time you enable/disable a module. It does not affect .config users, and helps menuconfig users.

@aabadie aabadie force-pushed the pr/pkg/cryptoauthlib_kconfig branch from 5e11790 to 348c251 Compare April 26, 2022 14:01
@aabadie
Copy link
Contributor Author

aabadie commented Apr 28, 2022

Are we ok to squash this one ?

@aabadie aabadie force-pushed the pr/pkg/cryptoauthlib_kconfig branch from 0bf43aa to 8699fd4 Compare April 28, 2022 08:39
@aabadie aabadie requested a review from MrKevinWeiss as a code owner April 28, 2022 08:39
@aabadie aabadie force-pushed the pr/pkg/cryptoauthlib_kconfig branch from 8699fd4 to 47bf7e2 Compare May 3, 2022 09:10
@aabadie aabadie force-pushed the pr/pkg/cryptoauthlib_kconfig branch from 47bf7e2 to ae530a9 Compare May 3, 2022 14:06
Copy link
Contributor

@MrKevinWeiss MrKevinWeiss left a comment

Choose a reason for hiding this comment

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

ACK! Looks good in menuconfig and makes more sense that what I recommended... 👍

@MrKevinWeiss MrKevinWeiss merged commit 126ed47 into RIOT-OS:master May 4, 2022
@aabadie aabadie deleted the pr/pkg/cryptoauthlib_kconfig branch May 4, 2022 19:49
@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants