Reputation: 418
I migrate from M3 to M7. M3 used STM32F103VE and has 64 KB of SRAM. The M7 is STM32F746ZG and it has 240KB of SRAM. I moved most of the M3 code to M7. Additional LWIP is being used for the Ethernet function in M7. But I found that heap memory was lacking and increased as below.
#define configTOTAL_HEAP_SIZE ( ( size_t ) (42 * 1024 ) )
When using M3, the following heap size was used.
#define configTOTAL_HEAP_SIZE ( ( size_t ) (15 * 1024 ) )
If I use the heap size of M3, there is a problem because the heap memory is insufficient. And if I set the heap size to 45*1024, the Ethernet function does not work and is not increasing the heap memory. I know that increasing the heap reduces the stack. However, although it has increased the Heap by about three times compared to the M3, it still does not have much to use the MALLOC functions.
Even though the M7 has about four times more memory than the M3, I don't understand why there is so much memory loss. If anyone has had this experience, please give me good advice. I'm using FreeRTOS, LWIP, and HAL for STM32. I want to use Malloc function sufficiently.
Upvotes: 1
Views: 711
Reputation: 486
You can (and should!) configure LWIP to use it´s internal memory manager and not malloc. See http://www.nongnu.org/lwip/2_1_x/mem_8c.html for example.
Upvotes: 1
Reputation: 67476
Do not use malloc. Use freeRTOS malloc functions instead. If you use malloc it uses the standard heap defined in the linker script which is usually about 0x200 bytes long
Memory consumption is the same in any in the both families. It is only a problem with your code
Porting between families is more complex than only changing the defines. You also have to amend the linker script, change the cmsis headers included and very likely your program as well
Upvotes: 2