Skip to content

Conversation

@multiplemonomials
Copy link
Collaborator

@multiplemonomials multiplemonomials commented Oct 10, 2025

Summary of changes

This MR turned into a bit of a bigger project then I originally intended, but... I have noticed for a while that devices with Cypress WHD wi-fi modules hard fault when running the nanostack and EMAC tests. Recently I investigated why, and it turns out that the memory manager code for the wi-fi driver is hardcoded to use LwIP, so it will segfault if used before LwIP has been initialized. This is not the way! Network drivers should use the memory manager interface so that they are agnostic of the network stack in use and so that they can be run with the emac tests.

This MR rewrites the WHD driver's memory manager interface code to talk to a NetStackMemoryManager instance. It also adds new code to the net stack memory manager to provide an equivalent of pbuf_header(), which is a required interface for the network driver.

I also ran into a failure in the TLS tests caused by the RTC not initializing properly to a representable time. I fixed this and added a new test to check for it (though the test only actually catches the issue if it's the first RTC-related test run after a power cycle, sadly).

Impact of changes

  • WHD driver can now be used with Nanostack and the EMAC tests (though nanostack doesn't seem to be fully working yet...)
  • PSoC RTC driver now returns a representable time immediately after being initialized. This means you don't need to manually set the RTC time in order to avoid an assert failure.

Migration actions required

Documentation

None (this is more focused on making something behave in the way it's supposed to according to the docs...)


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
  • All netsocket lwip tests pass
  • netsocket wifi test passes
  • netsocket emac test passes except for the no-memory test case (WHD driver doesn't handle running out of memory well, for now) and the multicast test case (no support for passing all multicast packets :((( )
  • netsocket nanostack tests still fail (something is going wrong with DNS, and I wasn't able to find any obvious reason why, so saving that for another day...)

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