Skip to content

Suggest marking stopWaveForm with ICACHE_RAM_ATTR #5247

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

Closed
chyrtsik opened this issue Oct 14, 2018 · 1 comment
Closed

Suggest marking stopWaveForm with ICACHE_RAM_ATTR #5247

chyrtsik opened this issue Oct 14, 2018 · 1 comment
Assignees

Comments

@chyrtsik
Copy link

int stopWaveform(uint8_t pin) {

I had a problem with custom servo implementation. I am using hardware serial to parallel port extension. Needed to change servo implementation to send serial code for each servo pulse.
Code crashed in case eps is connecting to a wifi at the time when servo is active. If servo is activated after the connection, it works. If it is activated before the wifi connection (my device works with and without connection), it crashes (attached stac traces).

While debugging, I found, that the new ESP core (2.4.2) calls stopWaveForm in each call to a _digitalWrite. This new implementation (comparing to the pwm-one, the old one,

void ICACHE_RAM_ATTR pwm_stop_pin(uint8_t pin)
), does not have method marked with ICACHE_RAM_ATTR. Adding this section definition to a method fixed the crash for me.

Suggest to evaluate this change to be included in the esp core.

stacktrace.txt
stacktrace-parsed.txt

@earlephilhower earlephilhower self-assigned this Oct 14, 2018
earlephilhower added a commit to earlephilhower/Arduino that referenced this issue Oct 14, 2018
Match the behavior of pre-2.4.2 PWM by allowing stopWaveform to be
called from an interrupt.

Fixes esp8266#5247
earlephilhower added a commit that referenced this issue Oct 16, 2018
* Make stopWaveform call interrupt callable

Match the behavior of pre-2.4.2 PWM by allowing stopWaveform to be
called from an interrupt.

Fixes #5247

* Move to O2, save ~500 bytes of code

The actual runtime difference of -O2 vs -O3 is quite small, but -O3
takes ~500 more bytes of code (~300 more in IRAM, ~200 more in PMEM).
@chyrtsik
Copy link
Author

Thank you for the very fast fix!

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

No branches or pull requests

2 participants