-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Want to get a method to configure task stack to use external memory which is under the amazon-freertos branch #2179
Comments
Hi @doothez Thank you for bring up this topic. The proposed change makes sense to me, and you are right that our current implementation doesn't support such. I've forwarded the thread to the responsible party, and they may get back to you with details later. Regards |
To improve my above post a little bit on behalf of my colleagues... To the original problem — "mbedtls_x509 module which needs to be called in OTA job is using so many local buffers which is more than 4k"... A possible workaround is to map mbedTLS malloc/free to platform malloc/free. And in FreeRTOS kernel, use heap_5.c to map external memory as the second bank of FreeRTOS heap.
With this, user cannot really predict where the task stack would be. Whether on-chip or off-chip, it'll be managed by memory allocation layer which is heap_5.c. (Unlike your solution, you have control for where the task stack is, which may be better for safety/isolation reason.) So, in summary, even without any change to OTA, it seems similar functionality can be achieved. Though, I'd agree that user may want to have fine control on where the task stack/TCB memory is allocate from... I'll leave it to them to get back to you on this point. Reference:
|
@yuhui-zheng , Thank you for your quick & kind support. I think we are already using "CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y" option in sdkconfig, so dynamic allocation code is currently using external memory based on below routines.
But the problem is just like below routines, as you can see these kind of routines are cannot be configured with certain method.
Let me share our sdkconfig about mbedtls first, please advice me if there is something can be changed for getting more free internal memory.
|
@yuhui-zheng Are there any feedback about my above report ? |
If you can upgrade x509write_crt.c, x509write_csr.c files to use dynamic buffer instead of huge local buffer, it will also be very helpful to me. |
Are there any update ?
|
Following are few platform specific suggestions that might be helpful:
Hope this helps. Mahavir |
Is your feature request related to a problem? Please describe.
We are using ESP32 chipset and using 4MB external memory because our software needed many features which is not enough with current internal memory which ESP32 having.
As time goes on, additional features comes in and lack of internal memory issues are happening.
We've already changed all the possible tasks which we are creating to use external memory as stack.
And we also optimized almost all the possible huge static variables to use EXT_RAM_ATTR keyword to allocate it to external memory.
But recently CDF feature need to be added and we found that we need to increase OTA task stack like below.
That was because of mbedtls_x509 module which need to be called in OTA job is using so many local buffers which is more than 4k.
(If mbedtls_x509 module can be configured or converted to use malloc() (external memory) instead of just local buffer that would be fantastic !)
And we still need more features to add to our ESP32 software in the future so we need a method to get or optimize free internal memory.
Describe the solution you would like.
This is one of example that we are currently using for configuring our tasks to use external memory as stack.
If amazon can provide similar way or method to configure the tasks under the amazon-freertos branch, we could utilize it for optimizing free internal memory.
(As you know, we are just referencing amazon-freertos certain branch or TAG and cannot change routines in that branch based on our company's source code management rule.)
OTA task and Logging task could be candidate for it.
If Amazon wants, we can provide more candidate task list.
Thank you!
The text was updated successfully, but these errors were encountered: