-
Notifications
You must be signed in to change notification settings - Fork 3k
TARGET_STM/qspi_api.c: fix build error on bare metal #13617
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
|
I'm slightly surprised we never caught this issue before. Unless I missed something... |
| #else | ||
| #define tr_info(...) | ||
| #define tr_error(...) | ||
| #endif // MBED_CONF_MBED_TRACE_ENABLE |
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.
In the long run, I personally think we should avoid using mbed-trace altogether in platform, drivers and targets which are bare-minimal parts of mbed-os available to the bare metal profile by default.
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.
mbed trace is fundamental enough that surely it should be in platform, or at least be included as a component by default, in which case it would provide its own dummy definitions.
It doesn't make sense to start scattering local dummy definitions everywhere,
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.
Tracing should be no-op if disabled but available for everyone (part of platform).
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.
@0xc0170 mbed_trace.h already contains dummy definitions (no-op), this is correct. The mbed-trace library isn't available to bare metal (unless the user adds it to mbed_app.json), and #include "mbed-trace/mbed_trace.h" fails.
One option is to add mbed-trace to
mbed-os/platform/bare_metal/mbed_lib.json
Lines 1 to 4 in 0db72d0
| { | |
| "name": "bare-metal", | |
| "requires": ["platform", "drivers", "rtos-api"] | |
| } |
@kjbracey-arm said trace is fundamental enough, so shall we have it by default for bare metal? @evedon
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.
By default tracing is disabled and so there is no memory cost for it. I agree that it is fundamental enough to be included 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.
You can add a dummy "present" option to the mbed_lib.json for nanostack-libservice, then check its macro (MBED_CONF_NANOSTACK_LIBSERVICE_PRESENT). That's how we detect RTOS or RTOS API presence.
Then fea-ipv6 = truecould only take effect if that is turned on too.
Or, even more fancy, change the default for fea-ipv6 to null, which is interpreted as "on if libservice present". If the user explicitly sets it to true, then you can give an error telling them to add libservice if it's not present.
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 add that config to mbed-client-libservice (part of https://github.com/ARMmbed/nanostack-libservice), but this needs to be communicated with the client team who fetch libraries from standalone repos sometimes. Maybe the change needs to be "upstreamed".
Or, even more fancy, change the default for
fea-ipv6tonull, which is interpreted as "on if libservice present".
It is already null 😉
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.
Okay, yes, there are a few wrinkles there. The header defaults to IPv6 on if the MBED_CONF_MBED_TRACE_FEA_IPV6 is unset, which it is for null in Mbed OS, or if not using Mbed OS config.
You could distinguish that further by TARGET_LIKE_MBED - if that's defined, then check the MBED_CONF_NANOSTACK_LIBSERVICE_PRESENT, else assume on.
Still, could have a version mismatch where they get a new mbed trace from upstream but use it with old Mbed OS. Not sure if that's a possibility.
In non-Mbed OS builds, libservice is always there - it's Mbed OS that's being the odd thing out by potentially having mbed trace without libservice. Would it be the end of the world to add the dependency and add 10(?) more small source files to the bare build? Still shouldn't add code.
It is already null
Hmph. There's a bad habit of making boolean options be null/true, when they should be false/true. null should only be used for "none" (which would normally be in place of a number or string), or "default" - which could apply to booleans, but is only worth doing if it's some sort of "dynamic" setting, not just a constant true or false.
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 going to make a PR with the minimum amount of check, and ping the client team.
Hmph. There's a bad habit of making boolean options be
null/true, when they should befalse/true.nullshould only be used for "none" (which would normally be in place of a number or string), or "default" - which could apply to booleans, but is only worth doing if it's some sort of "dynamic" setting, not just a constant true or false.
In fact, the code respects true/false set by users, and treats null as true otherwise. So now it's super easy for us to add the check for nanostack-libservice...
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.
#13649 created
|
@LDong-Arm, 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.
Shouldn't we fix mbed-trace rather ? As it is in platform, it is available in baremetal or not?
I agree, I am starting full non regression tests using baremetal for each mbed-os-6 label without any issues... |
mbed-trace is part of baremetal test config: https://github.com/ARMmbed/mbed-os/blob/master/TESTS/configs/baremetal.json#L16 |
Yes, the test config specifies |
I agree. This PR should be closed |
|
@jeromecoutant @0xc0170 As I said in my inline comment, the fix in mbed-trace is to disable ipv6 printing by default which depends on a network library. But that will break some existing applications. I wonder what we should do. @evedon |
|
Replaced by #13649 |
Summary of changes
mbed-os-example-blinky-baremetal fails to build on DISCO_L475VG_IOT01A (and presumably a few other targets) because
TARGET_STM/qspi_api.cassumesmbed-traceto be available, which is not true with the bare metal profile (unless the user enables it in theirmbed_app.json). This PR fixes the issue.Impact of changes
None.
Migration actions required
None.
Documentation
None.
Pull request type
Test results
Reviewers
@ARMmbed/mbed-os-hal @ARMmbed/team-st-mcd