- Notifications
You must be signed in to change notification settings - Fork13.3k
Fix VM Address mask#8440
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Fix VM Address mask#8440
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Adjust VM Address mask to allow up to 8M Byte parts.Allow for free heap size values over 64K ESP.getHeapStats(, uint32_t,) uint32_t getMaxFreeBlockSize();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
lgtm, since values are invalid otherwise
but, we still end up ambiguous with typing of the variables -size_t umm_max_block_size_core() which is declared assize_t akaunsigned long and not a fixed sizeuint32_t. not sure why umm decided on size_t here, nothing in it's internals prevents 64bit ints for example?
(edit) ...do we want size_t instead as the output, since it is a platform specific value?
mhightower83 commentedJan 7, 2022
I often find myself uncertain of these selections. After a quick search, " |
earlephilhower left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Great fix,@mhightower83 ! I'm surprised anyone but me has tried this out. I was so stoked at first, but with the new ESP chips with larger RAM I never really did anything w/the VM.
One thing I might caution, though, is that you can expect more WDT errors if you do go to 8MB simply because the UMM now has over 100x the space to process and if you hit fragmentation or something it can wnd up following some loooong chains to find allocation spaces...
-edit-Just remembered that the UMM blocksize needs to change or it can't physically access 8MB, anyway, due to overflowing the bits available in it's header. So, ignore prior comment.
earlephilhower commentedJan 7, 2022
CI failure is simple fix to host test |
mhightower83 commentedJan 7, 2022
@earlephilhower - Yes I ran into some issues starting with All of this is to ask. If you see value in adding this I will finish it off as a PR later. First, I need to finish a PR that completes folding in the new upstream version of umm_malloc? |
mcspr commentedJan 7, 2022
Would be consistent with the umm itself, where it is preferred to use size_t (or generic uint instead of something fixed size). POSIX seems to prefer platform-specific size_t, things like freebsd or esp-idf / freertos as well. idk how much this would change for this, though, it might as well touch much more things than just the stats |
Updated boards.txt to show correct External memory size and Heap size.
mhightower83 commentedJan 9, 2022
I am inclined to keep the |
mcspr commentedJan 10, 2022
True, but note that getFreeHeap() will still use the idf function returning size_t It is done feature wise though, next one is fixing umm block cfg? |
mhightower83 commentedJan 11, 2022
okay
Hmm, that would help portability between platforms. I am concerned about Side note, It is possible to enable/disable icache around
I don't know how that would work. The upstream code is ".c". Before I started maintaining I believe the extension was changed to gain better error checking from the compiler. I am concerned about how it would affect updating with the upstream changes. I think one obstacle is the heap needs to be up before the SDK is started. (Previously it started on the first malloc from the SDK early in its init code. Arduino/cores/esp8266/core_esp8266_main.cpp Lines 304 to 311 in2c5885e
I guess we could handle Internal RAM, DRAM, with low-level C code. Then, we could have some kind of C++ wrapper for the other (IRAM and External RAM). At the moment I don't see a value add. |
mcspr commentedJan 11, 2022
Yes, but we don't necessarily need anything initializing through c++ objects, just utilize the fact that we can generate types and do certain overloads at compile time. We are effectively creating heap contexts at runtime, but it may be done statically up until we really need runtime data like section pointers in case of iram. We do have a pre-defined set of heap types as well, so this may also refer to them directly instead of another runtime search and runtime 'stacked' heaps (e.g. a tuple of the available contexts, or I wonder if this could be a vtables use-case) How that would really be done is another question though, I am just speculating. And dealing with c++ vs. c runtime, I'd also look at the way allocators are used throughout the stdlib |
* Fix VM Address maskAdjust VM Address mask to allow up to 8M Byte parts.Allow for free heap size values over 64K ESP.getHeapStats(, uint32_t,) uint32_t getMaxFreeBlockSize();* Fix example* Update MockEsp.cpp for uint32_t on EspClass::getMaxFreeBlockSize()* Added comment about heap size limitation and static_assert to verify.Updated boards.txt to show correct External memory size and Heap size.
Adjust VM Address mask to allow up to 8M Byte parts.
Allow for free heap size values over 64K
ESP.getHeapStats(, uint32_t,)uint32_t getMaxFreeBlockSize();