Skip to content

Conversation

leandrolanzieri
Copy link
Contributor

Contribution description

As our drivers guide states:

The idea is that this file can be overridden by an application or a board, by simply putting a file with the same name in the application's or the board's include folders, while RIOT's build system takes care of preferring those files instead of the default params file.

For some reason this doesn't seem to be working. I'm not sure whether there was some uncaught regression at some point. Currently, when one places a <driver>_params.h this doesn't override the one define by RIOT, and is simply ignored.

This PR fixes the issue by including the APPDIR in the considered include paths, so that it has priority.

Testing procedure

  • On some driver test application, attempt to override default parameters by defining a <driver>_params.h file in your app directory.

Issues/PRs references

None

@github-actions github-actions bot added the Area: build system Area: Build system label Jun 11, 2024
@leandrolanzieri leandrolanzieri added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed Area: build system Area: Build system labels Jun 11, 2024
@riot-ci
Copy link

riot-ci commented Jun 12, 2024

Murdock results

✔️ PASSED

6247c10 tests/drivers/mrf24j40: rename common.h

Success Failures Total Runtime
151284 0 151284 02h:21m:56s

Artifacts

@leandrolanzieri
Copy link
Contributor Author

Hmm it's failing on a test that tries to override the irq.h file. Seems like an existing issue.

@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Jun 12, 2024
@leandrolanzieri
Copy link
Contributor Author

I included a commit that seems to fix this (at least this failing case) locally.

@leandrolanzieri leandrolanzieri requested a review from miri64 as a code owner June 12, 2024 11:47
@leandrolanzieri leandrolanzieri requested a review from maribu June 12, 2024 11:48
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

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

ACK. Thanks for fixing this! ❤️

@@ -399,6 +399,7 @@ ifneq (,$(IOTLAB_NODE))
endif

# Add standard include directories
INCLUDES += -I$(APPDIR)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for fixing this! I have falling into this pitfall numerous times when I needed to quickly test something, but never really traced it down but instead did a quick-and-dirty hack of the system header instead.

I'm glad that next time I need to quickly test something, I won't fall into that pitfall again ❤️

@leandrolanzieri
Copy link
Contributor Author

I wonder if the irq.h header introduced in #17066 ever had an effect. Currently seems to be breaking for some builds, and even some prototypes are not correct. Was the idea to prevent inline implementations from some platforms? Do you know @maribu ?

@maribu
Copy link
Member

maribu commented Jun 13, 2024

I'm almost certain that header was never included before, so it can be safely removed.

I think the idea was to have the signatures of the IRQ functions available, so that setting up the mockup wrapper functions is possible. Since the mock wrapper functions replace the actual calls, having a working IRQ header included was not needed. They just would need to match the API. (For the mock ups it would not matter if they are static inline or real symbol generating functions.)

But as the test worked just fine with wrapping the IRQ functions using the real signatures (including static inline for most platforms), I'd personally just drop the irq.h from the test without giving it a second thought.

@leandrolanzieri
Copy link
Contributor Author

After some fiddling around, it turns out it's not so straight forward. Removing the header seems to uncover other issues:

  • Currently there's no way to override IRQ_API_INLINED
  • Most of the platforms include irq_arch.h directly instead of irq.h

IIUC the "official" interface is to always go through irq.h, which in turn includes irq_arch.h on platforms that set IRQ_API_INLINED. We'd also need to change that.

The test would then define IRQ_API_INLINED to 0, which would allow to provide mock implementations from the application.

@maribu
Copy link
Member

maribu commented Jun 13, 2024

Ah, OK. So irq.h was included, but only from the tests C source (as #include "irq.h" would also search the current folder).

Now, the header is overriding the systems irq.h.

Maybe just copy-paste the contents of irq.h in the test source file and drop the header then?

@leandrolanzieri leandrolanzieri force-pushed the pr/makefile_include/include-app-headers branch from 42212cd to 78413fe Compare June 15, 2024 18:17
@leandrolanzieri
Copy link
Contributor Author

Maybe just copy-paste the contents of irq.h in the test source file and drop the header then?

Now this is implemented on 78413fe. It feels a bit off, but the alternative (I believe) would be a whole restructuring of how irq.h and irq_arch.h are included throughout multiple CPUs, just to mock this.

Copy link
Contributor

@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks! Do you know what was failing in the last Murdock build? Any chance we can get this in before hard-feature freeze next week?

@Teufelchen1
Copy link
Contributor

@leandrolanzieri what do you need to move this forward?

@mguetschow mguetschow added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 3, 2025
@mguetschow mguetschow added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 24, 2025
*
* @return Length of @p out.
*/
size_t hex2ints(uint8_t *out, const char *in);
Copy link
Member

Choose a reason for hiding this comment

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

This could be replaced with calls to scn_buf_hex() now, but this could also be a follow-up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that goes a bit out of scope

@leandrolanzieri leandrolanzieri force-pushed the pr/makefile_include/include-app-headers branch from 3120b0c to 6010fb4 Compare May 6, 2025 15:28
@leandrolanzieri
Copy link
Contributor Author

Rebased and applied changes to fix the latest CI errors.

@leandrolanzieri leandrolanzieri force-pushed the pr/makefile_include/include-app-headers branch from 6010fb4 to 6eb59fc Compare May 15, 2025 11:41
@leandrolanzieri
Copy link
Contributor Author

Rebased and applied changes to fix the latest CI errors.

Again

Copy link
Contributor

@Teufelchen1 Teufelchen1 left a comment

Choose a reason for hiding this comment

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

👍

@Teufelchen1 Teufelchen1 added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@leandrolanzieri
Copy link
Contributor Author

:(

To avoid name clash, rename this application header file to
test_common.h
To avoid name clash, rename this application header file to
test_common.h.
To avoid name clash, rename this application header file to
test_common.h.
@crasbe crasbe added CI: full build disable CI build filter CI: no fast fail don't abort PR build after first error and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 15, 2025
@leandrolanzieri leandrolanzieri force-pushed the pr/makefile_include/include-app-headers branch from 6eb59fc to 6247c10 Compare May 15, 2025 12:51
@crasbe crasbe added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label May 15, 2025
@crasbe crasbe added this pull request to the merge queue May 15, 2025
Merged via the queue into RIOT-OS:master with commit 65a8b47 May 15, 2025
26 checks passed
@maribu
Copy link
Member

maribu commented May 15, 2025

Nice! Thx a lot! ❤️

@leandrolanzieri leandrolanzieri deleted the pr/makefile_include/include-app-headers branch May 16, 2025 06:55
@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: tests Area: tests and testing framework CI: full build disable CI build filter CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants