-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Fix VM Address mask #8440
Fix VM Address mask #8440
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 as size_t
aka unsigned long
and not a fixed size uint32_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?
I often find myself uncertain of these selections. After a quick search, " |
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.
CI failure is simple fix to host test |
@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? |
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.
I am inclined to keep the |
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? |
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 in 2c5885e
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. |
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 |
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();