Hi!
Please explain how to use the memory on Teensy4.1. correctly. I have a very large code with a lot of libraries and the issue of memory usage arose.
My typical situation is
Memory Usage on Teensy 4.1:
FLASH: code:620644, data:104436, headers:9124 free for files:7392260
RAM1: variables:116320, code:377656, padding:15560 free for local variables:3541
RAM2: variables:66752 free for malloc/new:457536
As you can see, there is very little free space for local variables, so I want to make more use of RAM2 and FLASH features.
I used FLASHMEM for all my functions and DMAMEM for global variables, but that's not enough, the code still takes up a lot of space. What else can I do?
I see that the connected libraries also use RAM1.
This is a simple example
If i use Ethernet.h - memory usage is
FLASH: code:19584, data:3016, headers:9140 free for files:8094724
RAM1: variables:3936, code:16880, padding:15888 free for local variables:487584
RAM2: variables:12416 free for malloc/new:511872
With using NativeEthernet.h it is
FLASH: code:209928, data:73160, headers:8748 free for files:7834628
RAM1: variables:29056, code:71560, padding:26744 free for local variables:396928
RAM2: variables:12448 free for malloc/new:511840
And with using QNEthernet.h
FLASH: code:137572, data:20424, headers:8912 free for files:7959556
RAM1: variables:24896, code:133044, padding:30796 free for local variables:335552
RAM2: variables:55616 free for malloc/new:468672
Are there any memory allocation options?
Thanks a lot for answers!!
Please explain how to use the memory on Teensy4.1. correctly. I have a very large code with a lot of libraries and the issue of memory usage arose.
My typical situation is
Memory Usage on Teensy 4.1:
FLASH: code:620644, data:104436, headers:9124 free for files:7392260
RAM1: variables:116320, code:377656, padding:15560 free for local variables:3541
RAM2: variables:66752 free for malloc/new:457536
As you can see, there is very little free space for local variables, so I want to make more use of RAM2 and FLASH features.
I used FLASHMEM for all my functions and DMAMEM for global variables, but that's not enough, the code still takes up a lot of space. What else can I do?
I see that the connected libraries also use RAM1.
This is a simple example
C++:
#include <SPI.h>
//#include <Ethernet.h>
//#include <NativeEthernet.h>
#include <QNEthernet.h>
using namespace qindesign::network;
EthernetClient g_ethClient1;
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
If i use Ethernet.h - memory usage is
FLASH: code:19584, data:3016, headers:9140 free for files:8094724
RAM1: variables:3936, code:16880, padding:15888 free for local variables:487584
RAM2: variables:12416 free for malloc/new:511872
With using NativeEthernet.h it is
FLASH: code:209928, data:73160, headers:8748 free for files:7834628
RAM1: variables:29056, code:71560, padding:26744 free for local variables:396928
RAM2: variables:12448 free for malloc/new:511840
And with using QNEthernet.h
FLASH: code:137572, data:20424, headers:8912 free for files:7959556
RAM1: variables:24896, code:133044, padding:30796 free for local variables:335552
RAM2: variables:55616 free for malloc/new:468672
Are there any memory allocation options?
Thanks a lot for answers!!