Skip to content

Add CompositeEMAC support for Nuvoton M480 #459

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

Merged
merged 5 commits into from
May 8, 2025

Conversation

multiplemonomials
Copy link
Collaborator

Summary of changes

Now that I have an M480 board, I figured I would try and upgrade its Ethernet implementation to use the new CompositeEMAC structure. This lets the target-specific part of the code be as small as possible, as most of the work is done in the generic EMAC, PHY, and DMA drivers.

The old driver worked fine, and passed nearly all of the network tests. As far as I could tell, the only omissions were power-down support and multicast support. However, using CompositeEMAC brings new features, such as zero-copy Rx, which should help the code run a little faster. (though sadly zero copy Tx isn't really possible on this device since the hardware doesn't support sending multiple buffers at a time) Also, it just removes duplicated code and helps more of the Ethernet drivers use the same common core.

Impact of changes

Nuvoton M480 Ethernet support now implemented using CompositeEMAC.

Migration actions required

None

Documentation


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR
Test project /home/jamie/Mbed/mbed-os/build/NUMAKER_PFM_M487-Develop
      Start  96: test-mbed-connectivity-mbedtls-multi
 1/18 Test  #96: test-mbed-connectivity-mbedtls-multi ...........................   Passed    9.42 sec
      Start  97: test-mbed-connectivity-mbedtls-sanity
 2/18 Test  #97: test-mbed-connectivity-mbedtls-sanity ..........................***Skipped   0.01 sec
      Start  98: test-mbed-connectivity-mbedtls-selftest
 3/18 Test  #98: test-mbed-connectivity-mbedtls-selftest ........................***Skipped   0.01 sec
      Start  99: test-mbed-connectivity-nfc-eeprom
 4/18 Test  #99: test-mbed-connectivity-nfc-eeprom ..............................***Skipped   0.01 sec
      Start 100: test-mbed-connectivity-netsocket-lwipstack-dns
 5/18 Test #100: test-mbed-connectivity-netsocket-lwipstack-dns .................   Passed   34.52 sec
      Start 101: test-mbed-connectivity-netsocket-nanostack-dns
 6/18 Test #101: test-mbed-connectivity-netsocket-nanostack-dns .................   Passed   33.97 sec
      Start 102: test-mbed-connectivity-netsocket-nidd
 7/18 Test #102: test-mbed-connectivity-netsocket-nidd ..........................***Skipped   0.01 sec
      Start 103: test-mbed-connectivity-netsocket-lwipstack-tcp
 8/18 Test #103: test-mbed-connectivity-netsocket-lwipstack-tcp .................   Passed   68.45 sec
      Start 104: test-mbed-connectivity-netsocket-nanostack-tcp
 9/18 Test #104: test-mbed-connectivity-netsocket-nanostack-tcp .................   Passed   57.28 sec
      Start 105: test-mbed-connectivity-netsocket-lwipstack-tls
10/18 Test #105: test-mbed-connectivity-netsocket-lwipstack-tls .................***Skipped   0.01 sec
      Start 106: test-mbed-connectivity-netsocket-nanostack-tls
11/18 Test #106: test-mbed-connectivity-netsocket-nanostack-tls .................***Skipped   0.01 sec
      Start 107: test-mbed-connectivity-netsocket-lwipstack-udp
12/18 Test #107: test-mbed-connectivity-netsocket-lwipstack-udp .................   Passed   40.00 sec
      Start 108: test-mbed-connectivity-netsocket-nanostack-udp
13/18 Test #108: test-mbed-connectivity-netsocket-nanostack-udp .................   Passed   41.61 sec
      Start 109: test-mbed-connectivity-network-emac
14/18 Test #109: test-mbed-connectivity-network-emac ............................   Passed  179.86 sec
      Start 110: test-mbed-connectivity-netsocket-lwipstack-network-interface
15/18 Test #110: test-mbed-connectivity-netsocket-lwipstack-network-interface ...   Passed   41.75 sec
      Start 111: test-mbed-connectivity-netsocket-nanostack-network-interface
16/18 Test #111: test-mbed-connectivity-netsocket-nanostack-network-interface ...   Passed   73.46 sec
      Start 112: test-mbed-connectivity-network-lwipstack-wifi
17/18 Test #112: test-mbed-connectivity-network-lwipstack-wifi ..................***Skipped   0.01 sec
      Start 113: test-mbed-connectivity-network-nanostack-wifi
18/18 Test #113: test-mbed-connectivity-network-nanostack-wifi ..................***Skipped   0.01 sec

100% tests passed, 0 tests failed out of 18

@multiplemonomials multiplemonomials requested a review from ccli8 May 6, 2025 16:44
Copy link

@ccli8 ccli8 left a comment

Choose a reason for hiding this comment

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

Test the PR locally and OK.

@multiplemonomials
Copy link
Collaborator Author

Thanks for the review! By the way, if you guys are interested in adapting your other target families to use CompositeEMAC, I would be happy to help debug and review! It should reduce the total amount of code that you have to maintain by a fair bit, and provide speed and memory usage improvements.

@multiplemonomials multiplemonomials merged commit adfa239 into master May 8, 2025
52 checks passed
@multiplemonomials multiplemonomials deleted the dev/nu-m480-compositeemac branch May 8, 2025 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants