[Ovmsdev] Getting CONFIG_OVMS_HW_SPIMEM_AGGRESSIVE to work properly

Mark Webb-Johnson mark at webb-johnson.net
Mon Jun 11 13:41:07 HKT 2018


I finally got CONFIG_OVMS_HW_SPIMEM_AGGRESSIVE working properly. It seems we need to include sdkconfig.h to access these CONFIG_* variables (if we don’t include other esp libraries that do that already). Other than that change, the rest was easy.

For my running config (a car, a v2 server connected, and wifi), I originally had this:

OVMS# module memory
Free 8-bit 87484/230708, 32-bit 7296/11532, SPIRAM 4079552/4194252

Now, with CONFIG_OVMS_HW_SPIMEM_AGGRESSIVE working properly, I get this:

OVMS# module memory
Free 8-bit 104640/230700, 32-bit 7296/11532, SPIRAM 4062400/4194252

OVMS# test spiram
Metrics (0x3f802024) are in SPI RAM

With that config option enabled, all the C++ allocations are by default in SPI RAM, and we gain about 17KB of conventional RAM.

A quick ‘fgrep -r alloc main components’ shows about 1,000 uses of calloc/malloc in our system. I’ve got a large number of them now done, but probably a few more still to do. For example, changing wolf ssh/ssl to use it means most of the incremental allocations are from SPI RAM. Duktape would be a good win (but non-trivial, I think).

Even with bluetooth compiled in, and running, I now have:

OVMS# module memory
Free 8-bit 76476/230696, 32-bit 7296/11532, SPIRAM 4033960/4194252

OVMS# module tasks
Number of Tasks = 21      Stack:  Now   Max Total    Heap 32-bit SPIRAM
3FFCFF98  1 Blk esp_timer         388   628  4096   23928    644  44632
3FFD1C38  2 Blk eventTask         436  1876  4608       0      0      0
3FFD4158  3 Blk OVMS Events       436  3124  8192   73960      0  22128
3FFD56C0  4 Blk OVMS CanRx        428   476  1024       0      0      0
3FFBC3D4  5 Blk ipc0              400   480  1024    7776      0      0
3FFBC9D4  6 Blk ipc1              400   496  1024      12      0      0
3FFBD5E8  9 Rdy IDLE              372   548  1024       0      0      0
3FFBD768 10 Rdy IDLE              372   548  1024       0      0      0
3FFBD8E8 11 Blk Tmr Svc           344   888  3072      88      0      0
3FFBCCAC 16 Blk tiT               496  1504  3072     696      0    884
3FFB7A2C 17 Blk OVMS SIMCOM       464   512  4096       0      0      0
3FFB7D58 18 Blk wifi              432  2384  4096     360      0   1576
3FFDAD44 19 Blk OVMS Vehicle      460   508  6144       0      0      0
3FFDF718 20 Rdy OVMS Console      740  2612  6144    9072   3488  24044
3FFDFBC0 21 Blk mdns              456  1384  4096     108      0      4
3FFE37BC 22 Blk OVMS NetMan       728  2552  8192     104      0   1136
3FFE79B0 23 Blk btController      444  1980  4096      88      0      0
3FFE8CA0 24 Blk Btc_task          412  2572  3584   14924      0   1688
3FFE9EEC 25 Blk hciHostT          408   744  2560       0      0      0
3FFEAFF0 26 Blk hciH4T            412   604  2560       0      0      0
3FFEC854 27 Blk btuT              416  2016  4608    2760      0  23996

That seems very workable.

Regards, Mark

> Begin forwarded message:
> 
> From: GitHub <noreply at github.com>
> Subject: [openvehicles/Open-Vehicle-Monitoring-System-3] c2d3f7: Add a test spiram command to show whether SPI RAM ...
> Date: 11 June 2018 at 12:51:21 PM HKT
> 
>  Branch: refs/heads/master
>  Home:   https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3
>  Commit: c2d3f7f7ae8655d9d2809e15ad6f989a3459c8df
>      https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/commit/c2d3f7f7ae8655d9d2809e15ad6f989a3459c8df
>  Author: Mark Webb-Johnson <mark at webb-johnson.net>
>  Date:   2018-06-11 (Mon, 11 Jun 2018)
> 
>  Changed paths:
>    M vehicle/OVMS.V3/main/test_framework.cpp
> 
>  Log Message:
>  -----------
>  Add a test spiram command to show whether SPI RAM is being globally used or not
> 
> 
>  Commit: c1f96e71dd51c44f9aeff9cf5940982b939a8b24
>      https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/commit/c1f96e71dd51c44f9aeff9cf5940982b939a8b24
>  Author: Mark Webb-Johnson <mark at webb-johnson.net>
>  Date:   2018-06-11 (Mon, 11 Jun 2018)
> 
>  Changed paths:
>    M vehicle/OVMS.V3/main/ovms.cpp
>    M vehicle/OVMS.V3/main/ovms.h
> 
>  Log Message:
>  -----------
>  Fix CONFIG_OVMS_HW_SPIMEM_AGGRESSIVE

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20180611/ad8e26a4/attachment.html>


More information about the OvmsDev mailing list