Go Down

Topic: Replacing UMM memory manager for ESP8266 (Read 252 times) previous topic - next topic

cmarrin

I am building an interpreter based system for ESP8266 (https://github.com/cmarrin/m8rscript). I have my own memory manager which is gc based and I want to use it for all memory allocation. I have a standalone version that gets the heapstart directly from the .ld file. But I really want to use the Arduino IDE to build.

I can't find any #defines to set to override UMM. Has anyone tried doing this? Is there a way, short of hacking the Arduino SDK for ESP8266? My next step is to try to do that hack. But I'd like to use something official if I can

cmarrin

FYI, I've experimented with getting this to work. I went into the ESP8266 SDK and renamed heap.cpp and umm_malloc.cpp to keep them from compiling. Then I created a replacement .cpp file in my own app to implement malloc() and friends as well as the ESP pvPortMalloc() set of calls and a couple of other.

Seems like a reasonable hack. But eventually I'd like to see if I can do this in a  more supportable way

pert

The exact details of what you're doing are way over my head, but if I were to try to do something like this in "a more supportable way", I'd look into using a build hook in platform.txt to run the script:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#pre-and-post-build-hooks-since-ide-165

There is a feature where you can define additions and overrides to platform.txt in a file named platform.local.txt, which makes it easy to modify the behavior of the hardware package without needing to modify its platform.txt after every update (you just need to copy your platform.local.txt file into it):
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#platformlocaltxt

Another option is to create a custom hardware package that references the resources of the ESP8266 core, but adds in your customizations:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#referencing-another-core-variant-or-tool
Although I have a good deal of general experience using the reference feature, I've never done it with the ESP8266 core. I seem to remember forum member Juraj telling me that there is something about the ESP8266 core that is problematic for this. I don't remember exactly what the problem was, and I could even be misremembering it completely.

Juraj

https://github.com/esp8266/Arduino/pulls?utf8=%E2%9C%93&q=UMM

cmarrin

The exact details of what you're doing are way over my head, but if I were to try to do something like this in "a more supportable way", I'd look into using a build hook in platform.txt to run the script:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#pre-and-post-build-hooks-since-ide-165

There is a feature where you can define additions and overrides to platform.txt in a file named platform.local.txt, which makes it easy to modify the behavior of the hardware package without needing to modify its platform.txt after every update (you just need to copy your platform.local.txt file into it):
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#platformlocaltxt

Another option is to create a custom hardware package that references the resources of the ESP8266 core, but adds in your customizations:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#referencing-another-core-variant-or-tool
Although I have a good deal of general experience using the reference feature, I've never done it with the ESP8266 core. I seem to remember forum member Juraj telling me that there is something about the ESP8266 core that is problematic for this. I don't remember exactly what the problem was, and I could even be misremembering it completely.
Thanks for all the great tips. Hopefully I don't have to resort to a completely new platform, but the hooks look like they could bear some fruit

Go Up