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
bug: drivers: ethernet: build as static library breaks frdm_k64f gptp sample application #38571
Comments
This is probably due to initialization priority of the drivers and subsys. Could you check to make sure everything required for GPTP to work are initialized in order? For example, make sure that init priorities are not the same for two drivers where one needs the other to work correctly. |
I will try to look into it anyway, but to be honest, I don't know where I can look for that. Any hint on what file/function I should check, or documentation that could help me understand your observation better would be helpful. I'll report back when I have time to look into it. |
Drivers use |
@ainguraXmarquiegui Thanks a lot for finding this issue. @dcpleung I find change the init level does not help I move the ETH_INIT_PRIORITY to 95 and CONFIG_NET_INIT_PRIO is 90, but it still fails. if I revert your commit then the pass log shows:
whereas the failure log shows
if build out the eth drivers below function will have problem
|
I don't have the board so I cannot debug it on hardware. But from what I can see in the built binary using main, the |
I have the board and I can see what the problem is. The is an implied dependency between two devices being brought up in POST_KERNEL. As @dcpleung indicated, they have the same priority level within the POST_KERNEL so the order their init functions get called can not be depended on. The two devices are net_core.c:net_init() and the ptp clock mux in eth_mux.c. PTP clock needs to be initialized before the net_init occurs. The net_init flow fails to add the PTP interface because the clock hasn't been assigned yet. I'm prepping a PR. |
The net_core device initialization has a subtle dependency on the PTP clock initialization. Adding a Kconfig and set it to a priority level less than net_core. This will ensure the initialization sequence. Fixes zephyrproject-rtos#38571 Signed-off-by: David Leach <david.leach@nxp.com>
@ainguraXmarquiegui I posted a PR. Can you verify in your environment? |
I will have access to the board on Monday. I will test your PR that same day, if that's OK. |
the fix works on my frdm_k64f boards, but there are two questions:
|
The net_core device initialization has a subtle dependency on the PTP clock initialization. Adding a Kconfig and set it to a priority level less than net_core. This will ensure the initialization sequence. Fixes #38571 Signed-off-by: David Leach <david.leach@nxp.com>
@hakehuang, The order is by section name where the individual device inits are assigned a section based on run-level and priority. If multiple devices have the same run-level and priority it is explicitly undefined which order those will occur. We have seen multiple instances where some change with the build system causes the linker to change the order of these. |
You've already had confirmation from others, but just to keep my promise I have verified it on my own hardware. It seems to work. Thank you for the fix!
|
Describe the bug
Commit e912a05 breaks frdm_k64f gptp sample application. Any build from this version or newer results in the demo not working. GPTP no longer completes initialization.
Bulding code on revision b6855b2 or older results in a working demo.
Latest main code also works if I revert that commit, as can be seen here
To Reproduce
Steps to reproduce the behavior:
007-gPTP-PCMasterZephyrSlaveMinChange.cfg.txt
Board stays like this forever:
Expected behavior
If I repeat those steps with this code point everything works as expected:
Impact
Big annoyance. The reference board for GPTP tests stops working.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: