Remember the T4 (and the other T4.x) boards have a few memory sections as you can see on the product page:
https://www.pjrc.com/store/teensy40.html#memory
If you have a small program that is not using a lot of memory you don't need to worry about it at all. The default memory is the fastest memory on the chip.
However there is whole other 512KB of memory on the board, which you can gain access through typically in two different ways:
In the above you example I mentioned, you could change the memory defined like: DMAMEM uint8_t serial3_extra_buffer[512];
And that variable will have an address in that other memory region. Note: things allocated like this can not be initialized. That is you can not do things like: DMAMEM char mystring[] = "ABCD";
Another way you can use memory out of this region is using a memory allocate function like malloc or new
like:
Code:
uint8_t *serial3_buffer;
...
void setup() {
...
serial3_buffer = (uint8_t *)malloc(512);
Serial3.addMemoryForWrite(serial3_buffer, 512);
...
Warning typed on the fly ... so probably typos... Also I would typically check to make sure malloc succeeded... That is did not return a null pointer.