We should update our ESP-IDF anyway, got behind a bit. Maybe there are also some filesystem fixes like a working fflush()? :) I second that internal RAM should be special, not external. But we need to be careful about which components and objects must use internal RAM. I've got a user report of a CAN affecting performance issue. I need to check if that can be resolved by another task priority and/or CPU core allocation scheme, but I think all low level processes should generally remain in internal RAM. If time critical CAN TX get delayed because buffers need to get paged in, that may lead to nasty things. Regards, Michael Am 25.04.2018 um 01:57 schrieb Mark Webb-Johnson:
Steve,
Because of things like this:
https://github.com/espressif/esp-idf/issues/1492
/I tried setting the "SPI RAM access method" to "Make RAM allocatable using malloc() as well", and reducing "Maximum malloc() size, in bytes, to always put in internal memory" to 32 bytes, but get this crash on startup…/ / / /Presumably that is esp_event_loop_init trying to create a FreeRTOS queue, and then objecting because it is not in internal RAM? It seems that the ESP IDF framework is not fully working with SPI RAM yet (due to inherent limitations). It would be better if the memory to be allocated must be internal, it is specifically allocated as internal (rather than just rely on a generic malloc)./
Last time I tried it (earlier this year), the ESP-IDF just simply didn’t work when that menuconfig option was set. When I fixed the above specific bug, it happened in another place.
I know Espressif have been working on it, and perhaps they’ve fixed it now? This commit seems to try to address it in a generic way (at least for the freertos port stuff, if not for all the other libraries that we use):
https://github.com/espressif/esp-idf/commit/16de6bff245dec5e63eee994f53a0825...
IDF 3.0 has officially been released last night.
Regards, Mark.
On 25 Apr 2018, at 4:40 AM, Stephen Casner <casner@acm.org <mailto:casner@acm.org>> wrote:
We've been dancing around the external RAM allocation decision with our own ExtenalRamMalloc() function and extensions to the C++ new allocator to try SPIRAM first but then back off to internal memory if that fails (presumably because of v3.0 hardware rather than because all 4MB of SPIRAM is used up).
Do we need all that? There is already a mechanism in the multi-heap memory system for the defaut malloc to try allocating from SPIRAM for any request with size larger than malloc_alwaysinternal_limit which can be set dynamically with heap_caps_malloc_extmem_enable(). If the allocation from SPIRAM fails (again, presumably only on v3.0 hardware) then the allocation is retried without the MALLOC_CAP_SPIRAM capability, which is just what our ExternalRamMalloc does.
If there are only a few allocations such as stacks that must come from internal memory, and if those allocations (in system code) already use heap_caps_malloc(MALLOC_CAP_INTERNAL) to meet that requirement, then we could probably just set malloc_alwaysinternal_limit to a small number (perhaps 0) so that everything else comes from SPIRAM.
I don't know if any of our application memory uses are sufficiently sensitive to memory performance that we would want to ensure that the memory is internal. My guess is that those would be few and therefore it makes sense to take special action for them rather than for everything else.
For continued support of v3.0 hardware we could even test whether SPIRAM is present and leave malloc_alwaysinternal_limit at its default value of -1 if not.
Opinions?
-- Steve
On Mon, 23 Apr 2018, Mark Webb-Johnson wrote:
Michael,
Do we need ovms_extram.h? Can we just put the namespace directly into ovms.h (where all the other external ram allocation stuff is)?
Regards, Mark
OvmsDev mailing list OvmsDev@lists.openvehicles.com <mailto:OvmsDev@lists.openvehicles.com> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.openvehicles.com http://lists.openvehicles.com/mailman/listinfo/ovmsdev
-- Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal Fon 02333 / 833 5735 * Handy 0176 / 206 989 26