Teensy 3.6 vs Teensy 4.1 RAM memory

Status
Not open for further replies.
The code I'm working on uses around 64Kb for global variables on Teensy 3.6 and, the same code, around 172Kb on Teensy 4.1.
How a huge difference like this is possible ?
 
It is likely due to the library having bigger buffers, and overhead in general for the Teensy 4.x new features, etc. Note, the memory layout on the Teensy 4.x is different from the Teensy 3.x.

IIRC, Teensy 3.x has a single unified SRAM memory, plus the flash memory to hold the code.

The Teensy 4.x has 2 SRAM areas, plus flash, plus the optional memory with the Teensy 4.1:
  • The first 512K (RAM1) is used for ITCM (FASTRUN code) and DTCM (initialized data, stack).
  • The second 512K (RAM2) is used for the new/malloc heap, plus things declared explicitly 'DMAMEM'.
  • The flash memory holds the initial values for data and FASTRUN code. It also has the non-FLASHRUN code. In addition, you can put initialized constant memory in there with 'FLASHMEM'.
  • On the Teensy 4.1, you can solder 1 psram (volatile) chip and 1 flash memory chip (non-volatile) or two psram chips
  • Teensy 4.0 memory information: https://www.pjrc.com/store/teensy40.html
  • Teensy 4.1 memory expansion: https://www.pjrc.com/store/teensy41.html
 
On Teensy 4.x, some of the RAM is allocated to hold code (called ITCM) so it can run at the full 600 MHz speed.

If you don't use "FLASHMEM" on functions, by default on Teensy 4.x they get allocated to ITCM.
 
Status
Not open for further replies.
Back
Top