fix umm memory managment#1630
Conversation
|
pvPortMalloc and friends are already defined here: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/heap.c, and corresponding functions from libmain.a are marked as weak, so is additional wrapping required? |
|
Regarding printf: sorry for breaking the build, but let's fix the real issue (printf not compiling) instead of replacing it with ets_printf. |
|
I use umm without any wrapping at all. Have just the Port stuff weakened and overwritten. All has been working nice since some time before you even introduced it in the main repo. Have additionally added alignment check and put all in RAM and that's about it. :) 2 bytes poison and integrity check are on |
|
yes the wrapping is needed some of my projects only boot when the wrapping is here. |
|
to get printf work it is normally not more then this: int putchar_cpp(int c) {
if(Serial.write(c)){
return c;
}
return -1;
}
extern "C" {
int putchar(int c) {
return putchar_cpp(int c);
}
}but i think debug an error messages are better in os_printf since it easy to disable the output when serial is needed for something else, and we have already many debug out at os_printf. |
|
Okay, figured that out. The issue has actually been triggered by 737f6c2, where i have replaced calls to TL;DR: Depending on the libraries used by the sketch, weakening pvPortMalloc/vPortFree may be not sufficient. Here is a simple sketch which will fail to run (stripped down version of the one provided by @Links2004): #include <Arduino.h>
#include <ESP8266WiFi.h>
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();
Serial.println();
Serial.println();
for(uint8_t t = 4; t > 0; t--) {
Serial.printf("[SETUP] BOOT WAIT %d...\n", t);
delay(1000);
}
Serial.printf("[SETUP] HEAP: %d\n", ESP.getFreeHeap());
WiFi.mode(WIFI_AP);
WiFi.softAP("ESP_SLDT", "yesSecureHere");
}
void loop() { }At the same time, more complex sketches (e.g. FSBrowser sample) seem to work fine. I'm going to remove mem_manager.o from libmain.a completely, so that the "right" symbols are always used. |
wrap all SDK memory functions in all libs, to get umm to work
fix umm_malloc.c:1708: undefined reference to `putchar'