-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Feature public headers #11073
Feature public headers #11073
Conversation
@evedon, thank you for your changes. |
Does it make sense to move all sources under the I don't mind having public header and |
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.
Could we change the doxygen groups structure a bit: having two main groups public-api and internal-api without split per directory seems like something that is easy to reference to and also should be easier to browse. Then having each of the main directories as it's own group (drivers, platforms, etc). Also it would be good to group related APIs together. So having SPI group for spi, spislave and qspi; i2c for i2c and i2cslave; usb for all usb classes (without group per class); timers for all normal and low power timer related classes; uart for all uart and serial; gpio and analog. There probably some other groupings that would make sense so please add them if you spot something.
Is there a way we can check how much we are affecting the character limit as pointed out by Seppo?
Before that goes in could someone have a look at hand generated doxygen and see if there's something obviously broken? Also would be good to run all the nightiles and examples, Qinghao will be able to help here.
I don't think it is unreasonnable to move source files under |
@evedon I've never understood the reasoning for having headers separate from source except to make it slightly easier to to release them with a precompiled binary. Is there any other reasoning i'm missing? |
We discuss this and I decided that it woud be less confusing if the documentation follows the directory structure.
Agreed that this would be a good improvement.
I suggest to flatten the directory structure under
We will check the hand generated doxygen (we checked for each PR but not for this final one). I have also been in touch with Amanda so she can assess the impact on docs and update the internal links.
Agreed. |
This also allows us to move "private" header files under |
Test run: FAILEDSummary: 4 of 4 test jobs failed Failed test jobs:
|
events/internal/equeue.h
Outdated
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
/** \ingroup events */ |
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.
I think that should be a public header. I know it's sort of underlying concept, but in some situations (eg bare metal) people may not want to use C++. We also need to do something smart about the both README files, I would say merge them into one. Starting with the C++ description and then introduce concept of underlying C APIs and that they can be used in bare metal c only projects.
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.
@geky fyi
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.
Well, opinions aside, this just made all the subtrees quite a bit harder to maintain :(
Are we doing the same for littlefs?
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.
I can't even imagine sub-trees being any harder to maintain than they already were when I last tried to use sub trees for dependency management.
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.
Oh really? I'm actually a big fan of subtrees :) Though as I understand the quality of the command has changed quite a bit over the last half-decade.
It works really well at separating version control from other programmer debates such as monorepo/multirepo, build/dependency systems.
It can get complicated, but one of the best things it has going for it is that, all the effort is on the developer making the subtree merge. After that the user never needs to know (unlike submodules) and even other developers can work on merged directory as though it was part of the repo.
Every so often I'll come back through and create another subtree merge pr to bring the code up to date with what's outside the tree (though I've been slow because of littlefs v2 stuff, sorry about that): #7713
Subtrees really seem like a realization of the idea of truly distributed version control. Because of it repos can exist as copies in a bunch of different places with their own quirks and patches.
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.
@evedon, good point. I'll move this to a separate issue.
My vote for equeue public vs internal is to leave it as internal for now. Are we worried this will break code?
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.
Let's not throw the baby out with the bathwater. There's some things the EventQueue does better than other event systems present in mbed-os tree :
To be clear I'm not suggesting we remove EventQueue. Or even remove any features yet.
Just that we rename equeue -> mbed_events (or similar), remove separate between equeue and EventQueue where it makes sense, and let the projects naturally diverge as their features grow/shrink to match their requirements.
How so ? Queuing event will always be relevant and if it can run on x86 it can help for integration and unit testing as well.
I was more referring specifically to the portability/OS-agnostic aspect of equeue.
You're right x86 support has been useful for testing, but IMO x86 testing should somehow be provided for all of Mbed OS. It's the only way to keep this shindig scalable.
FreeRTOS and Windows support have already been removed from the Mbed OS version because it makes less sense here. And there have been several cases of the terminology differences between equeue and the RTOS confusing users.
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.
I agree :D So how about for this PR we:
- Make queue public, as we need C API for bare metal builds
- Merge the readmes so it all still makes sense
- Do not rename anything public so that we don't break compatibility
Going forward:
- @kjbracey-arm is looking at getting all the requirements from all the components so we can finaly have one queue to rule them all (mandatory https://xkcd.com/927/)
- @donatieng @pan- are looking at 2 priorities for the queue and at static allocations
For mbed 6 we will try to force the unification and possible changes to the existing APIs.
I'll catch up with y'all at some point to discuss the plans further.
Does it sound like a plan?
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.
👍
@bulislaw @kjbracey-arm @donatieng @pan
I am looking forward to the discussion of this topic further in the related public issue/issues
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.
I'm a bit confused. My conclusion was that there shouldn't be a single queue. Is there plans to maintain a version outside of mbed-os?
@donatieng @pan- are looking at 2 priorities for the queue and at static allocations
FYI, I am also looking at static allocations, (though intentionally not priorities). A part that plan was to break API compatibility to introduce better error codes. Let me know if you want me to create a PR here as well though.
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.
We also should deal a bit better with the rtos
directory, there's source which matches our current model, but there's also TARGET_CORTEX
which probably should go under the sources
. I don't have strong opinion what to do with the files from TARGET_CORTEX
. And similiar for TARGET_CORTEX_M under platform/
d17fec5
to
24b3ca0
Compare
@bulislaw We have address all comments, except for the following:
We also need to check how much we are affecting the character limit as pointed out by Seppo. |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Compared to master, the command line length when building this branch is reduced by about 400 bytes mostly thanks to the flattening of the USB folder. .includes file size (mbed-cloud-client-example, K64F, GCC_ARM, master) = 26281 bytes |
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.
Looks good, can we run the automated example to verify we don't break our own use cases? @jamesbeyond
@jamesbeyond ran the nightly tests before the last rework and all tests passed. |
Yeah, I'll trigger the test again on this |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
e68557e
to
1031304
Compare
* Modify Doxygen grouping of `drivers` Public/Internal APIs * Correct classification of `mbed_events.h` * Amend name of Doxygen group containing Device Key API * Classify `CallChain.h` as public API and relocate file * Remove Doxygen group from `equeue_platform.h` as it has no Doxygen compliant documentation * Move USB target specific code back to `usb/device/targets`
Rebased and triggered CI. |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Separate drivers, events, and rtos internal APIs from public APIs. * Move source files to source subdirs * Move internal headers to internal subdirs * Add Doxygen comments for documenting internal and public APIs * Remove source code from header files in order to remove include pre-processor directives that included header files not directly used by said header files * Explicitly include header files instead of implicit inclusions via third-party header files. Release Notes This will break user code that was using an internal API as the internal header files have been moved. This will only break if the user was including the header file using a namespace (i.e #include "foo/bar.h" instead of #include "bar.h"
Also includes: * rename `mbed_sleep_manager.c` to `mbed_power_mgmt.c` to match its header file * create Doxygen groups for public and internal APIs * use relative path to include header files where inconsistent * update references to internal APIs throughout libraries * update the copyright year for all modified files
The contents of the usb directory were moved to appropriate locations and the usb directory removed. * Public USB headers moved under drivers/ * Internal USB headers moved under drivers/internal/ * USB Source code moved under drivers/source/usb/ * Moved usb/device/hal/ under hal/usb/ * Moved usb/device/USBPhy/ under hal/usb/ * Merged usb/device/targets/ into targets/ * Separated public and private USB API documentation under Doxygen groups drivers-public-api and drivers-internal-api.
Include the missing header file inclusion to find the added MBED_DEPRECATED macro.
…11105) * Change Doxygen groups structure, splitting first by Public/Internal This commit also does the following: * groups the documentation of related API * moves `events/internal/equeue.h` to `events/equeue.h` * merges `events/source/README.md` to `events/README.md`
* Fix rtos include path in NRFCordioHCIDriver * Flatten USB driver directory structure * Add missing include for us_ticker * Add more missing includes for us_ticker * Fix mbed_hal_fpga_ci_test_shield/uart test * Fix bare-metal build * Fix Watchdog UNITTEST * Fix Mbed OS 2 build for Public/Internal headers relocating
…11114) * Modify compilation API to provide a list of paths to exclude from the build. * `_exclude_files_from_build` becomes a static method * Replace ternary expression with simple `if/else` statement * Make unit test case for dirs exclusion independent of system files
* Modify Doxygen grouping of `drivers` Public/Internal APIs * Correct classification of `mbed_events.h` * Amend name of Doxygen group containing Device Key API * Classify `CallChain.h` as public API and relocate file * Remove Doxygen group from `equeue_platform.h` as it has no Doxygen compliant documentation * Move USB target specific code back to `usb/device/targets`
1031304
to
df85e8e
Compare
Rebased again due to recent conflicting commits on master |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Overnight tests and examples tests all passed on this PR |
@evedon This passes a CI test and is approved by some of the reviewers. Is this ready to go in? Maybe @ARMmbed/mbed-os-core team should also approve. I would not wait too long for all pending reviews, as file renames tend to cause merge conflicts, if we wait too long. |
The code changes for this PR were made collaboratively by mbed-os-core team. |
Description
Separated platform, usb, drivers, events, and rtos internal APIs from public APIs
source
subdirsinternal
subdirsRefactored the
usb
directoryusb
directory were moved to appropriate locations and theusb
directory removeddrivers
drivers/internal/
drivers/source/usb/device
usb/device/hal/
moved underhal/usb/
usb/device/USBPhy/
moved underhal/usb/
usb/device/targets/
intotargets/
Pull request type
Reviewers
@bulislaw
Release Notes
This will break user code that was using an internal API using a prefixed path, for example
#include "foo/bar.h"
instead of#include "bar.h"
.