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

memmove_P does not support IRAM #10

Closed
mhightower83 opened this issue Aug 7, 2020 · 0 comments · Fixed by #11
Closed

memmove_P does not support IRAM #10

mhightower83 opened this issue Aug 7, 2020 · 0 comments · Fixed by #11

Comments

@mhightower83
Copy link

Copied over from esp8266/Arduino#7060 (comment)

memmove_P does not support IRAM

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <umm_malloc/umm_malloc.h>
#include <umm_malloc/umm_heap_select.h>

//#define memmove_P ets_memmove

char str[] = "Move over";

void setup() {
  WiFi.persistent(false);
  WiFi.mode(WIFI_OFF);
  Serial.begin(115200);
  delay(10);
  Serial.printf_P(PSTR("\r\nBegin ...\r\n"));

  {
    HeapSelectIram ephemeral;
    size_t sz = strlen(str) + 1;
    char *newstr = (char *)malloc(sz + 8);
    memcpy(newstr, str, sz);
    Serial.println(newstr);
    memmove_P(&newstr[1], newstr, sz);
    newstr[0] = ' ';
    Serial.println(newstr);
    free(newstr);
  }
}

void loop() {}

Prints:

Begin ...
Move over
 MMMMMMMMMM

Works when not using IRAM or using ets_memmove with a non32-bit access handler.

Your comment about the issue: esp8266/Arduino#7060 (comment)

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 a pull request may close this issue.

1 participant