Skip to content
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: HardwareSerial interrupt callback code not in IRAM #1610

Merged
merged 1 commit into from
Feb 11, 2019

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Feb 9, 2019

Supersedes #1604, fixes #1520 and possibly #1602

Lambda inherits code segment of enclosing statement, i.e. flash. Adding IRAM_ATTR doesn't work, even if it's separated out into a different statement. However, placing the entire updateUartCallback method into IRAM_ATTR does work, but is wasteful of RAM. Therefore reverted to regular static callback handler.

Lambda inherits code segment of enclosing statement, i.e. flash. Adding IRAM_ATTR doesn't work, even if it's separated out into a different statement. However, placing the entire `updateUartCallback` method into IRAM_ATTR _does_ work, but is wasteful of RAM. Therefore reverted to regular static callback handler.
@mikee47 mikee47 changed the title Put HardwareSerial interrupt callback code in IRAM Fix: HardwareSerial interrupt callback code not in IRAM Feb 9, 2019
@etmmahi
Copy link
Contributor

etmmahi commented Feb 10, 2019

Well spotted. I tested this fix and it works flawless on my board.
I will close my pull request with the interrupt fix (#1604)
Pse merge with develop

@mikee47
Copy link
Contributor Author

mikee47 commented Feb 10, 2019

I didn't try adding [[section(".iram.text")]] to the lambda, which is apparently the correct syntax. I'll try it and report back - this would be a simpler change if it works.

UPDATE: Tried it, didn't work. Oh well. Using static callback would seem to be the safest option.

SmingCore/HardwareSerial.cpp: In member function 'bool HardwareSerial::updateUartCallback()':
SmingCore/HardwareSerial.cpp:171:62: warning: 'section' attribute directive ignored [-Wattributes]
    [](uart_t* uart, uint32_t status) [[section(".iram.text")]] {                                                              ^

@slaff slaff added this to the 3.7.2 milestone Feb 11, 2019
@slaff
Copy link
Contributor

slaff commented Feb 11, 2019

@mikee47 Anything more to be done for this PR or it is tested and complete?

@mikee47
Copy link
Contributor Author

mikee47 commented Feb 11, 2019

@slaff All done, tested and complete.

@slaff slaff merged commit 2e2fc56 into SmingHub:develop Feb 11, 2019
@slaff
Copy link
Contributor

slaff commented Feb 11, 2019

Pse merge with develop

@etmmahi the PR is merged in develop so please update your develop branch and test.

@slaff slaff removed the 3 - Review label Feb 11, 2019
@mikee47 mikee47 deleted the fix/serial_interrupt_bug branch February 11, 2019 20:36
@slaff slaff mentioned this pull request Feb 27, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

problem with OTA in Basic_rBoot
3 participants