-
Notifications
You must be signed in to change notification settings - Fork 2.1k
build-system: generate buildinfo/{app,board,cpu,riotver}.h #21954
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
base: master
Are you sure you want to change the base?
Conversation
|
Note: This needs still an update of the Doxygen doc to account for the dynamically generated headers and an update of the |
Murdock results❌ FAILED 634fdf0 build-system: Pass Build failures (21)
Artifacts |
24800cc to
9f0eb1d
Compare
0996f97 to
956427e
Compare
7574fff to
978b778
Compare
e43fb84 to
742b6e8
Compare
External code may assume that RIOT's `sched.h` header is the same as [POSIX's sched.h][1] header. This adds a slim wrapper to not have to patch external code (which in case of glibcxx will be difficult to do). [1]: https://pubs.opengroup.org/onlinepubs/009604299/basedefs/sched.h.html
CPU specific hacks never should go to `core`. This simplifies the hack and moves it to `cpu/native` by providing a custom `sched.h` that adds the workarounds for glibc and adds an `#include_next "sched.h"`. It's a bit of a pity that RIOT's sched.h has a name conflict with POSIX's sched.h - otherwise those hacks wouldn't really be needed.
This changse the build system to expose the board name, the app name, the CPU name, and the RIOT version via dynamically generated headers rather than via `CFLAGS += -D`. The intended goal is to to reduce the entropy of the input of ccache with the hope that for platform independent code, the compiler input to ccache will be often identical for related boards and similar apps. The downside is that code that previously dependent on the macros being predefined by the environment has not to explicitly include the suitable dynamically created header(s). One new macro has also been added: `-DRIOT_OS=1`. Previously a lot of code was checking for `RIOT_VERSION` to compile differently under e.g. Linux and RIOT. The code has been updated to check for `RIOT_OS` instead.
This checks files that use previously globally defined macros without having the correct header included. Also populate GITHUB_RUN_ID in `github_annotate.sh` for compatibility with `set -u`.
This drops the generation of `riotbuild.h` and instead just passes the `-D...` / `-U...` flags via a command line options file to GCC/clang instead. The old `riotbuild.h` now is moved to `core/include` and only contains deprecated aliases and documentation. It is still injected with `-include riotbuild.h`, as otherwise the aliases for dynamic macros injected with `-D` would not be visible.
This adds some `extern char *buildinfo_<NAME>;` to the `riotbuild.h` as alternative to `RIOT_BOARD`, `RIOT_VERSION`, `RIOT_CPU`, and `RIOT_VERSION`. Unlike those macros the object file generated from a compilation unit using the C API do not depend on the actual values, so making them globally available does not impact ccache in any way.
742b6e8 to
d29c445
Compare
|
With https://ci.riot-os.org/details/169027b4b6ff444fb115fedaf0f240bf were are up to 65% cache efficiency on the second build on building For the more realistic test scenario we are still at 0% cache hits: |
| include $(RIOTMAKE)/scan-build.inc.mk | ||
|
|
||
| export RIOTBUILD_CONFIG_HEADER_C = $(BINDIR)/riotbuild/riotbuild.h | ||
| export COMPILER_CLI_PARAMS_FILE = $(BINDIR)/ccparams.txt |
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.
Where does this file come from? I can't find any reference to it anywhere
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.
That is generated here with those three lines: https://github.com/maribu/RIOT/blob/d29c445c560b778643e38d2fea3f63321b474c6e/Makefile.include#L1028-L1030
Contribution description
This changse the build system to expose the board name, the app name, the CPU name, and the RIOT version via dynamically generated headers rather than via
CFLAGS += -D.The intended goal is to to reduce the entropy of the input of ccache with the hope that for platform independent code, the compiler input to ccache will be often identical for related boards and similar apps.
The downside is that code that previously dependent on the macros being predefined by the environment has not to explicitly include the suitable dynamically created header(s).
One new macro has also been added:
-DRIOT_OS=1. Previously a lot of code was checking forRIOT_VERSIONto compile differently under e.g. Linux and RIOT. The code has been updated to check forRIOT_OSinstead.Testing procedure
static-testsfind uses of previously global macrosIssues/PRs references
None