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

tests/pkg_utensor: model in Kconfig + fix utensor package dependencies #17995

Merged
merged 3 commits into from
Apr 28, 2022

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Apr 25, 2022

Contribution description

This PR adds a Kconfig configuration to the tests/pkg_utensor application. The Kconfig dependency list had to be fixed and extended for this to work.

Note that this PR will fail on Murdock when build for esp32-heltec-lora32-v2. There's a module resolution mismatch with and without TEST_KCONFIG and I couldn't figure out the cause. It seems that libstdcpp dependencies are not resolved the same, adding ztimer deps without TEST_KCONFIG.

Testing procedure

Green Murdock

Issues/PRs references

None

@github-actions github-actions bot added Area: CI Area: Continuous Integration of RIOT components Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: tests Area: tests and testing framework labels Apr 25, 2022
@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 25, 2022
@MrKevinWeiss
Copy link
Contributor

I will try to take a look at the mismatch issue

@aabadie
Copy link
Contributor Author

aabadie commented Apr 26, 2022

I will try to take a look at the mismatch issue

Thanks! (and good luck 🤞 )

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.

You can try

diff --git a/sys/posix/pthread/Kconfig b/sys/posix/pthread/Kconfig
index 38f384d15f..9d88e957ab 100644
--- a/sys/posix/pthread/Kconfig
+++ b/sys/posix/pthread/Kconfig
@@ -8,3 +8,7 @@
 config MODULE_PTHREAD
     bool "Pthread Support"
     depends on TEST_KCONFIG
+    select MODULE_ZTIMER
+    select ZTIMER64_USEC
+    select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT
+    select MODULE_TIMEX

It looks like pthread needs ztimer stuff, cppstdlib needs pthread (only on esps), utensor needs cppstdlib...

@aabadie aabadie force-pushed the pr/tests/pkg_utensor_kconfig branch from f6793c1 to c50ea3f Compare April 26, 2022 09:45
@github-actions github-actions bot added the Area: sys Area: System label Apr 26, 2022
@aabadie aabadie force-pushed the pr/tests/pkg_utensor_kconfig branch from c50ea3f to 0cb482f Compare April 26, 2022 09:46
@aabadie
Copy link
Contributor Author

aabadie commented Apr 26, 2022

You can try

It doesn't seem to be enough (even if already better!):

$ BOARD=esp32-heltec-lora32-v2 make -C tests/pkg_utensor clean info-modules --no-print-directory > /tmp/make-modules && TEST_KCONFIG=1 BOARD=esp32-heltec-lora32-v2 make -C tests/pkg_utensor clean info-modules --no-print-directory > /tmp/kconfig-modules && diff /tmp/make-modules /tmp/kconfig-modules 
1,3c1,3
< rm -rf /work/riot/RIOT/tests/pkg_utensor/bin/esp32-heltec-lora32-v2/pkg-build/esp32_sdk
< rm -rf /work/riot/RIOT/tests/pkg_utensor/bin/esp32-heltec-lora32-v2/pkg-build/esp32_sdk_libs
< rm -rf /work/riot/RIOT/tests/pkg_utensor/bin/esp32-heltec-lora32-v2/pkg-build/utensor
---
> === [ATTENTION] Testing Kconfig dependency modelling ===
> === [ATTENTION] Testing Kconfig dependency modelling ===
> make: Nothing to be done for 'clean'.
7d6
< auto_init_ztimer64
57d55
< periph_init_timer
63d60
< periph_timer
83,84d79
< ztimer64
< ztimer64_init
92d86
< ztimer_periph_timer

Another Kconfig choice effect ?

@aabadie aabadie force-pushed the pr/tests/pkg_utensor_kconfig branch from 0cb482f to 1b64e58 Compare April 26, 2022 09:53
@aabadie
Copy link
Contributor Author

aabadie commented Apr 26, 2022

Ok, 1b64e58 contains the correct list of dependencies required for pthread.
Can someone explain why all indirect dependencies has to be specified explicitly in Kconfig while this is not required in Make:

  • In Make the dependency resolution is just (so 3 USEMODULE lines):
ifneq (,$(filter pthread,$(USEMODULE)))
  USEMODULE += ztimer64_usec
  USEMODULE += timex
  ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE)))
    # requires 64bit ftimestamps
    USEMODULE += ztimer64_xtimer_compat
  endif
endif
  • In Kconfig, the equivalent becomes (8 select):
    select MODULE_PERIPH_TIMER
    select MODULE_TIMEX
    select MODULE_ZTIMER
    select MODULE_ZTIMER_PERIPH_TIMER
    select MODULE_ZTIMER64
    select MODULE_ZTIMER64_INIT
    select MODULE_ZTIMER64_USEC
    select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT

As a user, I would expect ztimer64, ztimer64_init, ztimer* and periph_timer to be selected automatically when ztimer_usec is selected.

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.

Remember we are all on the same team here.

Comment on lines 11 to 13
select MODULE_PERIPH_TIMER
select MODULE_TIMEX
select MODULE_ZTIMER
select MODULE_ZTIMER_PERIPH_TIMER
select MODULE_ZTIMER64
select MODULE_ZTIMER64_INIT
select MODULE_ZTIMER64_USEC
select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT
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_PERIPH_TIMER
select MODULE_TIMEX
select MODULE_ZTIMER
select MODULE_ZTIMER_PERIPH_TIMER
select MODULE_ZTIMER64
select MODULE_ZTIMER64_INIT
select MODULE_ZTIMER64_USEC
select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT
select MODULE_ZTIMER
select ZTIMER64_USEC
select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT
select MODULE_TIMEX

A subtle change can make the difference.

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 think I tried your proposal and there were still missing modules compared to make => that's the reason of my extended changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Due to circular dependancies in the timer abstraction layer we have a non module symbol that brings in many module symbols. This is the ZTIMER64_USEC vs the MODULE_ZTIMER64_USEC.

My guess is you used module version instead of applying the diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My guess is you used module version instead of applying the diff.

Hmm ok, that looked like a typo... but is in fact yet another hack

Copy link
Contributor

Choose a reason for hiding this comment

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

Originally I was thinking to make it more explicit with a CIRCULAR_MODULE_* or something.

This was a tough one, again, we welcome input for a way around it. Ideally we would not have the circular dependency at all.

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, finally applied your initial proposal.

@aabadie aabadie force-pushed the pr/tests/pkg_utensor_kconfig branch from 1b64e58 to a76b7c1 Compare April 27, 2022 09:05
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.

Looks good (soft ACK), please squash and remove the REMOVEME commit.

@aabadie aabadie force-pushed the pr/tests/pkg_utensor_kconfig branch from a76b7c1 to d2b9844 Compare April 28, 2022 06:50
@github-actions github-actions bot removed the Area: CI Area: Continuous Integration of RIOT components label Apr 28, 2022
@aabadie
Copy link
Contributor Author

aabadie commented Apr 28, 2022

Squashed and REMOVEME commit removed.

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

@MrKevinWeiss MrKevinWeiss enabled auto-merge April 28, 2022 07:30
@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 28, 2022
@MrKevinWeiss MrKevinWeiss merged commit 7731e6a into RIOT-OS:master Apr 28, 2022
@aabadie aabadie deleted the pr/tests/pkg_utensor_kconfig branch April 29, 2022 06:57
@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.

3 participants