-
Notifications
You must be signed in to change notification settings - Fork 13.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
Fix NO_GLOBAL_INSTANCES #8184
Fix NO_GLOBAL_INSTANCES #8184
Conversation
Is it better as static or as a regular stack variable? Since it only occupies 1 byte. |
@dok-net Can you review it after the Serial changes? I fear it may cause breaking changes since it will force people to define Serial when they didn't have to before. |
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.
ArduinoCore-avr does void serialEventRun(void)
differently, I suggest adopting that implementation:
Implement void serialEventRun(void)
in HardwareSerial.cpp
unconditionally, that is, outside the #if
block. In turn, enclose the code inside the function body in the same preprocessor conditional directive.
One could potentially add serialEvent1
, too, in the same way.
I've undone the Serial changes, because it seems is a more complex issue that doesn't need to block this PR. We can talk about this more in the issue and if it makes sense, doesn't break compatibility and we find all the other declaration that are not defined we can make a new PR. |
Declaring symbols that are not defined is an error, don't you think so? Your reversal simply could cause the compile phase to succeed, but then linking will fail. I'm speaking from my perception that it's all about NO_GLOBALS in general, not devnull in particular, of course. As to my remark involving the
|
I added it again |
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.
Thanks for trying to fix multiple things, but it’s really neat if you do one change per PR, please. Can you remove the unrelated hardware serial stuff?
@earlephilhower If it were a mistake, it would be on me, I've asked the submitter to add it back in. You would have to try and see it from a different angle: The issue is not to create the devnull, but the fact that There are NO further issues in this core regarding So, isn't it best to rename this PR, instead of splitting it up into extraordinarily small chunks? Besides, it's a simple fix for HardwareSerial, nothing else, or what could possible be the point in declaring something |
Awaiting further instructions. I'm OK with both approaches, just ping me and I will edit the PR accordingly (or make a new PR to split the changes). But I don't have much to contribute to the discussion. I agree that this could become a PR to fix all the problems related to NO_GLOCAL_INSTANCES, but I haven't ensured those are the only ones, they are the ones I found while maintaining our system. |
@paulocsanz I grepped all |
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.
OK, I'm convinced. LGTM.
Fixes #8183
It's not clear to me if this is the best solution. This is just a first draft so the community can debate on a better solution.
But it seems a fairly simple thing to fix. But something needed, if something is used internally it should be declared + defined.
It's not clear to me if we should create it when
NO_GLOBAL_STREAMDEV
is specifically defined.