-
Notifications
You must be signed in to change notification settings - Fork 3k
USB drivers and "events" library added to bare metal profile #13805
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
Conversation
… need for a specific “drivers-usb” library. This means that USB drivers will be built by default in bare metal. The "events" library is added to bare metal profile because USB drivers depend on it. This library provides functionality to schedule events without relying on a RTOS and so it is useful to have it enabled by default in the bare metal profile.
FYI @jeromecoutant |
@evedon, thank you for your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How USB can work in baremetal ? I found storage dependency when working with CMake. Some of the USB drivers like MSD depend on blockdevice. We had to disable USB with drivers and make it own library that depends on storage, otherwise it did not compile.
This is how we made USB compile (depends on storage):
target_link_libraries(mbed-os-usb INTERFACE mbed-os-storage)
The USB drivers library compiles in bare metal. The USBMSD driver has a dependency on blockdevice but the blockdevice library is compiled by default in bare metal because it does not have a But you are right that if an application uses the USBMSD driver, it will have to compile with one of the underlying storage driver, for example SPIF. This PR is raised to remove some inconsistencies in the drivers library: USB drivers include files are part of the drivers public API but their associated source files are not compiled by default in bare metal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
If we want to resolve the inconsistency of missing mbed_lib.json for blockdevice, we can create one there (may be named "blockdevice-api" to avoid the impression of dragging the whole stack into bare metal) and remember to add it to bare metal.
That explains it. The docs even state |
IMO blockdevice should not be auto-enabled - even platform and drivers which are more basic are not auto-enabled. Adding mbed_lib.json makes it more consistent and avoids the trouble in CMake. |
Agreed. I will add the missing |
… the bare metal profile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Before I approve, I would like to assure myself everyone is on board with adding these new deps ( as it has implications for a lot of users). Because of usb, we are pulling in events and blockdevice to baremetal. I would understand events to be useful library but usb or storage for baremetal, their use is specific. My understanding of baremetal is the basic functionality and people can add more if they want to. Where we draw a line what is in Mbed Os vs Mbed baremetal? Taken from CMake: In the new CMake world we go to, a user would do Note to myself: I need to get the CMake branch to master, we would see here how it changes what it's building. |
@0xc0170 If I may add my $0.02, I completely agree with you. IMHO, The corollary to this idea is that documentation on how to do so should be cristal clear and gather all the informations needed to follow this process. Based on my personal experience, I tend to add things because I think it would be difficult for people to add them on their own. But if it is, the solution is not to add things, but to rethink the way the system works and make it easy for people to add the things they need for their specific use case. I've never used |
As noted in a previous comment, blockdevice was already in bare metal so it is not added by this PR. |
Note that I don't have a strong opinion on moving USB drivers under |
I will raise two separate PRs then. One to add the missing |
Summary of changes
USB drivers source files are moved under drivers/source/ removing the need for a specific “drivers-usb” library.
This means that USB drivers will be built by default in bare metal.
The "events" library is added to bare metal profile because USB drivers depend on it.
This library provides functionality to schedule events without relying on a RTOS
and so it is useful to have it enabled by default in the bare metal profile.
Impact of changes
USB drivers are built by default in bare metal.
The "events" library is added to the bare metal profile.
Migration actions required
None
Documentation
The following page needs to be updated: https://os.mbed.com/docs/mbed-os/v6.3/bare-metal/using-the-bare-metal-profile.html#2-adding-apis
Pull request type
Test results
Reviewers