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

Order of auto_init functions #13541

Open
jue89 opened this issue Mar 3, 2020 · 5 comments
Open

Order of auto_init functions #13541

jue89 opened this issue Mar 3, 2020 · 5 comments
Labels
Area: sys Area: System Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Comments

@jue89
Copy link
Contributor

jue89 commented Mar 3, 2020

Description

I am using a cryptoauthlib-compatible chip for a board I am working on. It features a user-programmable config zone, which holds the EUI-64 of the device.

I would like to use this as the source for luid_base() to bring the EUI-64 to the attached network interfaces.

I started implementing luid_base() by fetching the EUI-64 from the crypto chip on-the-fly. But after doing so RIOT isn't able to boot.

The problem is luid_base() gets called before the cryptoauthlib auto_init function has been executed resulting in a failed boot-up.

I was able to resolve this problem by reordering the auto_init. The old order:

  • random
  • xtimer
  • cryptoauth

The new order:

  • xtimer
  • cryptoauth (requires xtimer)
  • random (requires luid_base and, thus, cryptoauthlib in my case)

Is anyone else experiencing similar difficulties? Or am I using RIOT wrongly?

@benpicco
Copy link
Contributor

benpicco commented Mar 3, 2020

I think what you really want is #12641
This unfortunately got stuck when it came to the right way to handle multiple netifs and multiple EUIs…

I have a branch where I started assigning unique (ascending) IDs to netifs so those can be used by board_get_eui64() - I should probably finish that.

@jue89
Copy link
Contributor Author

jue89 commented Mar 3, 2020

Nice! This would resolve my conflict. The only remaining problem is that the netif auto_init functions are called before the cryptoauthlib auto_init function. Would it be an acceptable solution to reorder the auto_init functions?

@benpicco
Copy link
Contributor

benpicco commented Mar 3, 2020

The order probably needs a cleanup - there is one ongoing already right now: #13542

@miri64
Copy link
Member

miri64 commented Mar 3, 2020

The order probably needs a cleanup - there is one ongoing already right now: #13542

That one does not reorder the function calls (and since it is already quite big and not very easy to track, I would prefer to do re-ordering in a separate PR).

@benpicco
Copy link
Contributor

benpicco commented Mar 3, 2020

Yes, but if @jue89 wants to re-order something he should probably wait for this PR to go through first, otherwise a nasty merge conflict is guaranteed.

@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: sys Area: System labels Jul 6, 2020
@miri64 miri64 added this to the Release 2020.07 milestone Jul 6, 2020
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: sys Area: System Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

No branches or pull requests

4 participants