Thanks @jwatte,
Awhile ago, I started a thread that talked about some of the different memory regions and some of the sections and the like:
https://forum.pjrc.com/threads/57326...ferent-regions
Sometimes the easiest place to find examples is to look in the released code.
PROGMEM - Sort of like the old AVR days with the T4.x. (Sort of) In particular when you define a variable with PROGMEM, the variable is left up in the Flash memory and not copied down to the faster, but more limited in size memory DTCM (Data Tightly Coupled Memory). Note however unlike AVR processors, which have different addressing spaces, the ARM processor has one Address space, so you don't need all of those screwy macros and the like to then access the memory.
Again as mentioned by default all of your code is copied out of Flash into the same 512kb fast memory ITCM (Instruction Tightly coupled memory). That 512kb is divided into DTCM or ITCM by 32KB blocks. So if your code is under 32KB only one of the 16 32kb blocks will be used for instructions, the rest for data ....
So to mark a function to not bring down to the faster memory, you can mark it with FLASHMEM. Example in startup.c
Code:
FLASHMEM void configure_cache(void)
{
...
Now if you have large buffers and the like that are not initialized and you don't mind it being slower. You can access the other 512KB of memory on the board. It is slower but there is a hardware cache that speeds it up.
You can set these up, by using the DMAMEM keyword, like: DMAMEM uint8_t frame_buffer[320*240*2];
In this case that is size for ILI9341 display... Note: if you do any malloc operations, this also comes out of this 512KB.
New to the T4.1 - If you install external memory on your T4.1 - you can declare stuff to be created there,
by using the keyword: EXTMEM.
Example I have code for playing with ILI9486 with 4 bytes per pixel and 320x480...
So far I don't think it supports initialized variables here. But comments in startup code looks like it might soon.
Not sure if I covered everything, but hope that helps