@Paul - I don't know if it makes sense to simply add another utility in the build process, that displays more information.
....
Which I know is outputting far too cryptic of data for most people, like recent run of testing the IO pins of the solderless breakout board...
But yes, I think RAM1 is better than the current stuff, although I can also imagine there will be some complaining about, I thought I purchased a board with 1mbs of memory why is there only 512KB...
Talking about FlexSPI, anyone already tried to mmap another SPI device as PSRAM, in another region.
For the SPI flash, is every block/page read cached in the FASTRUN too?
I'm seriously considering doing something like this, though less cryptic, more like Arduino's format.
But running it from the postbuild recipe prints too soon, probably not even visible without scrolling with the default size of Arduino's console. It needs to print together with Arduino's summary.
Yeah, I'm concerned about that too.
FlexRAM section ITCM+DTCM = 512 KB
Config : aaaaaaaf
ITCM : 51600 B (78.74% of 64 KB)
DTCM : 17088 B ( 3.72% of 448 KB)
Available for Stack: 441664
OCRAM: 512KB
DMAMEM: 8272 B ( 1.58% of 512 KB)
Available for Heap: 516016 B (98.42% of 512 KB)
Flash: 64496 B ( 3.17% of 1984 KB)
ILI9488_t3n: (T4) SPI automatically selected
MOSI:11 MISO:12 SCK:13
ILI9488 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark Time (microseconds)
Screen fill 307994
Text 7449
Lines 92433
Horiz/Vert Lines 25838
Rectangles (outline) 14423
Rectangles (filled) 744864
Circles (filled) 99631
Circles (outline) 79308
Triangles (outline) 19609
Triangles (filled) 235923
Rounded rects (outline) 32314
Rounded rects (filled) 817065
Done!
FlexRAM section ITCM+DTCM = 512 KB
Config : aaaaaaaf
ITCM : 48208 B (73.56% of 64 KB)
DTCM : 17088 B ( 3.72% of 448 KB)
Available for Stack: 441664
OCRAM: 512KB
DMAMEM: 8272 B ( 1.58% of 512 KB)
Available for Heap: 516016 B (98.42% of 512 KB)
Flash: 64688 B ( 3.18% of 1984 KB)
enchmark Time (microseconds)
Screen fill 307987
Text 7503
Lines 92546
Horiz/Vert Lines 25846
Rectangles (outline) 14430
Rectangles (filled) 744884
Circles (filled) 99789
Circles (outline) 78841
Triangles (outline) 19697
Triangles (filled) 235983
Rounded rects (outline) 32279
Rounded rects (filled) 817101
Done!
memory_copy(&_stext, &_stextload, &_etext);
where::
_stext = ADDR(.text.itcm);
_etext = ADDR(.text.itcm) + SIZEOF(.text.itcm);
_stextload = LOADADDR(.text.itcm);
uint32_t *SomeMemPtr = _stext + _etext;
uint32_t SizeOfSomeMem = (64*1024) - _etext;
SizeOfSomeMem=15685 [KB=15] SizeLeft_etext=15689 len ITCM=3644801719
stext=0 _stextload=0 etext=3644801719
extern unsigned long _stextload;
extern unsigned long _stext;
extern unsigned long _etext;
void setup() {
while (!Serial); // Wait for Arduino Serial Monitor to open
unsigned long SizeLeft_etext = (32 * 1024) - ((_etext-_stext)%(32*1024));
unsigned long *SomeMemPtr = (unsigned long*)((_etext+4)%4);
unsigned long SizeOfSomeMem = SizeLeft_etext -4;
Serial.printf( "\nSizeOfSomeMem=%u [KB=%u]\tSizeLeft_etext=%u \tlen ITCM=%u\n", SizeOfSomeMem,SizeOfSomeMem/1024, SizeLeft_etext, (_etext-_stext) );
Serial.printf( "stext=%u \t_stextload=%u\tetext=%u \n", _stext, _stextload, _etext );
}
void loop() {}
extern unsigned long _stextload;
extern unsigned long _stext;
extern unsigned long _etext;
void setup() {
while (!Serial); // Wait for Arduino Serial Monitor to open
unsigned long SizeLeft_etext = (32 * 1024) - ((_etext - _stext) % (32 * 1024));
unsigned long *SomeMemPtr = (unsigned long*)((_etext + 4) % 4);
unsigned long SizeOfSomeMem = SizeLeft_etext - 4;
Serial.printf( "\nSizeOfSomeMem=%u [KB=%u]\tSizeLeft_etext=%u \tlen ITCM=%u\n", SizeOfSomeMem, SizeOfSomeMem / 1024, SizeLeft_etext, (_etext - _stext) );
Serial.printf( "stext=%u \t_stextload=%u\tetext=%u \n", _stext, _stextload, _etext );
SizeLeft_etext = (32 * 1024) - (((uint32_t)&_etext - (uint32_t)&_stext) % (32 * 1024));
SomeMemPtr = (unsigned long*)((_etext + 4) % 4);
SizeOfSomeMem = SizeLeft_etext - 4;
Serial.printf( "\nSizeOfSomeMem=%u [KB=%u]\tSizeLeft_etext=%u \tlen ITCM=%u\n", SizeOfSomeMem, SizeOfSomeMem / 1024, SizeLeft_etext,
((uint32_t)&_etext - (uint32_t)&_stext) );
Serial.printf( "&stext=%x(%u) \t&_stextload=%x(%u)\t&etext=%x(%u) \n",
(uint32_t)&_stext, (uint32_t)&_stext, (uint32_t)&_stextload, (uint32_t)&_stextload,
(uint32_t)&_etext, (uint32_t)&_etext );
}
void loop() {}
SizeOfSomeMem=11000 [KB=10] SizeLeft_etext=11004 len ITCM=3985822980
stext=0 _stextload=0 etext=3985822980
SizeOfSomeMem=9756 [KB=9] SizeLeft_etext=9760 len ITCM=23008
&stext=0(0) &_stextload=60001790(1610618768) &etext=59e0(23008)
Hi @defragster - It is the addresses of these names that is important... So I hacked a second part onto your program:
// Initialize memory
GPIO7_DR_SET = (1<<3); // digitalWrite(13, HIGH);
memory_copy(&_stext, &_stextload, &_etext);
GPIO7_DR_CLEAR = (1<<3); // digitalWrite(13, LOW);
memory_copy(&_sdata, &_sdataload, &_edata);
GPIO7_DR_SET = (1<<3); // digitalWrite(13, HIGH);
memory_clear(&_sbss, &_ebss);
GPIO7_DR_CLEAR = (1<<3); // digitalWrite(13, LOW);
md /c "D:\\arduino-1.8.10\\hardware\\teensy\\..\\tools\\arm\\bin\\arm-none-eabi-gcc-nm -n C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_434165\\bar.ino.elf | D:\\GITHUB\\imxrt-size\\Debug\\imxrt-size.exe"
FlexRAM section ITCM+DTCM = 512 KB
Config : aaaaaaab
ITCM : 23008 B (70.21% of 32 KB)
DTCM : 12992 B ( 2.64% of 480 KB)
Available for Stack: 478528
OCRAM: 512KB
DMAMEM: 8272 B ( 1.58% of 512 KB)
Available for Heap: 516016 B (98.42% of 512 KB)
Flash: 32528 B ( 1.60% of 1984 KB)
@defragster - I am not sure if it is valid or not to be able to write into the ITCM memory area or not...
...
@defragster - I am not sure if it is valid or not to be able to write into the ITCM memory area or not...
...
// _________________________________________________________________________
// GET and SHOW FreeITCM RAM :: uint32_t *ptrFreeITCM and sizeofFreeITCM
uint32_t *ptrFreeITCM; // Set to Usable ITCM free RAM
uint32_t sizeofFreeITCM; // sizeof free RAM in uint32_t units.
uint32_t SizeLeft_etext;
extern unsigned long _stextload; // FROM LINKER
extern unsigned long _stext;
extern unsigned long _etext;
void getFreeITCM() { // end of CODE ITCM, skip full 32 bits
SizeLeft_etext = (32 * 1024) - (((uint32_t)&_etext - (uint32_t)&_stext) % (32 * 1024));
sizeofFreeITCM = SizeLeft_etext - 4;
sizeofFreeITCM /= sizeof(ptrFreeITCM[0]);
ptrFreeITCM = (uint32_t *) ( (uint32_t)&_stext + (uint32_t)&_etext + 4 );
}
void showNumsITCM() {
// sizeofFreeITCM=9180 [#uint32_t=2295] SizeLeft_etext=9184 len ITCM=23584
Serial.printf( "\n\nsizeofFreeITCM=%u [#uint32_t=%u]\tSizeLeft_etext=%u \tlen ITCM=%u\n", sizeofFreeITCM * sizeof(uint32_t),
sizeofFreeITCM, SizeLeft_etext, ((uint32_t)&_etext - (uint32_t)&_stext) );
// &stext=0(0) &_stextload=60001720(1610618656) &etext=5c20(23584)
Serial.printf( "\n&stext=%x(%u) \t&_stextload=%x(%u)\t&etext=%x(%u) \n",
(uint32_t)&_stext, (uint32_t)&_stext, (uint32_t)&_stextload, (uint32_t)&_stextload,
(uint32_t)&_etext, (uint32_t)&_etext );
// &stext=0(0) &etext=5c20(23584) ptrFreeITCM[0]=5c24(23588) pLast=8000(32768)
Serial.printf( "\n&stext=%x(%u) \t&etext=%x(%u) \tptrFreeITCM[0]=%x(%u) \tpLast=%x(%u) \n",
(uint32_t)&_stext, (uint32_t)&_stext, (uint32_t)&_etext, (uint32_t)&_etext,
(uint32_t)ptrFreeITCM, (uint32_t)ptrFreeITCM,
(uint32_t)ptrFreeITCM + sizeofFreeITCM * sizeof(uint32_t), (uint32_t)ptrFreeITCM + sizeofFreeITCM * sizeof(uint32_t) );
}
// GET and SHOW FreeITCM RAM :: uint32_t *ptrFreeITCM and sizeofFreeITCM
// _________________________________________________________________________
void setup() {
while (!Serial); // Wait for Arduino Serial Monitor to open
Serial.println("\n\n++++++++++++++++++++++");
getFreeITCM();
showNumsITCM();
}
#define NUM_SHOW sizeofFreeITCM
void loop() {
uint32_t ii;
for ( ii = 0; ii < NUM_SHOW; ii++ ) {
if ( !(ii % 5) ) Serial.printf( "\npITCM@%x \t", (ptrFreeITCM) + ii );
Serial.printf( "%3u=%x\t", ii, ptrFreeITCM[ii] );
}
Serial.printf( "\nLast pITCM@%x \t", (ptrFreeITCM) + ii - 1 );
for ( ii = 0; ii < NUM_SHOW; ii++ ) {
ptrFreeITCM[ii] = micros();
}
Serial.println("\n ============================");
for ( ii = 0; ii < NUM_SHOW; ii++ ) {
if ( !(ii % 5) ) Serial.printf( "\npITCM@%x \t", (ptrFreeITCM) + ii );
Serial.printf( "%3u=%u\t", ii, ptrFreeITCM[ii] );
}
Serial.printf( "\nLast pITCM@%x \t", (ptrFreeITCM) + ii - 1 );
showNumsITCM();
while (1);
}
…
pITCM@7fdc 2270=671af 2271=671af 2272=671af 2273=671af 2274=671af
pITCM@7ff0 2275=671af 2276=671af 2277=671af 2278=671af
Last pITCM@7ffc
============================
pITCM@5c64 0=419260 1=419260 2=419260 3=419260 4=419260
pITCM@5c78 5=419260 6=419260 7=419260 8=419260 9=419260
pITCM@5c8c 10=419261 11=419261 12=419261 13=419261 14=419261
…
pITCM@7fc8 2265=417411 2266=417411 2267=417411 2268=417411 2269=417411
pITCM@7fdc 2270=417411 2271=417411 2272=417411 2273=417411 2274=417411
pITCM@7ff0 2275=417411 2276=417411 2277=417412 2278=417412
Last pITCM@7ffc
sizeofFreeITCM=9116 [#uint32_t=2279] SizeLeft_etext=9120 len ITCM=23648
&stext=0(0) &_stextload=60001720(1610618656) &etext=5c60(23648)
&stext=0(0) &etext=5c60(23648) ptrFreeITCM[0]=5c64(23652) pLast=8000(32768)
SCB_MPU_RBAR = 0x20200000 | REGION(3); // RAM (AXI bus)
SCB_MPU_RASR = MEM_CACHE_WBWA | READWRITE | NOEXEC | SIZE_1M;
Doing that across a block too large to cache, or scattered in turn across multiple RAM2/DMAMEM blocks might show the write rate if different than for RAM1. Those could catch a cache flush delay or MCU might choose write throughfor ( ii = 0; ii < NUM_SHOW; ii++ ) {
ptrFreeITCM[ii] = ARM_DWT_CYCCNT;
}
// Flush data from cache to memory
static inline void arm_dcache_flush(void *addr, uint32_t size)
// Delete data from the cache, without touching memory
static inline void arm_dcache_delete(void *addr, uint32_t size)
// Flush data from cache to memory, and delete it from the cache
static inline void arm_dcache_flush_delete(void *addr, uint32_t size)
Thanks for doing it.Again sorry for rambling on this.... (again)
#define DMA_SIZE 9000
DMAMEM uint32_t pDMA[3][DMA_SIZE];
pDMA[0]@20208ca0 after CNT of 2 Diff CycCnt is 6 with 409571276!=409571282
pDMA[0]@2021a5e0 after CNT of 2 Diff CycCnt is 2 with 409571288!=409571290
pDMA[0]@20223280 after CNT of 1 Diff CycCnt is 8 with 409571290!=409571298
pDMA[0]@2022bf20 after CNT of 1 Diff CycCnt is 2 with 409571298!=409571300
pDMA[0]@204d97e0 after CNT of 78 Diff CycCnt is 11 with 409571454!=409571465
pDMA[0]@204e2480 after CNT of 1 Diff CycCnt is 2 with 409571465!=409571467
pDMA[0]@204eb120 after CNT of 1 Diff CycCnt is 6 with 409571467!=409571473
pDMA[0]@204f3dc0 after CNT of 1 Diff CycCnt is 2 with 409571473!=409571475
pDMA[0]@2051fce0 after CNT of 5 Diff CycCnt is 14 with 409571483!=409571497
pDMA[0]@20528980 after CNT of 1 Diff CycCnt is 2 with 409571497!=409571499
...
pDMA[1]@20208ca0 after CNT of 2 Diff CycCnt is 2 with 409607138!=409607140
pDMA[1]@2023d860 after CNT of 6 Diff CycCnt is 3 with 409607150!=409607153
pDMA[1]@20246500 after CNT of 1 Diff CycCnt is 2 with 409607153!=409607155
pDMA[1]@20260ae0 after CNT of 3 Diff CycCnt is 18 with 409607159!=409607177
pDMA[1]@20269780 after CNT of 1 Diff CycCnt is 2 with 409607177!=409607179
pDMA[1]@20272420 after CNT of 1 Diff CycCnt is 6 with 409607179!=409607185
pDMA[1]@2027b0c0 after CNT of 1 Diff CycCnt is 2 with 409607185!=409607187
pDMA[1]@202b8920 after CNT of 7 Diff CycCnt is 18 with 409607199!=409607217
pDMA[1]@202c15c0 after CNT of 1 Diff CycCnt is 2 with 409607217!=409607219
pDMA[1]@202ed4e0 after CNT of 5 Diff CycCnt is 14 with 409607227!=409607241
pDMA[1]@202f6180 after CNT of 1 Diff CycCnt is 2 with 409607241!=409607243
pDMA[1]@202fee20 after CNT of 1 Diff CycCnt is 6 with 409607243!=409607249
pDMA[1]@20307ac0 after CNT of 1 Diff CycCnt is 2 with 409607249!=409607251
pDMA[1]@20345320 after CNT of 7 Diff CycCnt is 10 with 409607263!=409607273
pDMA[1]@2034dfc0 after CNT of 1 Diff CycCnt is 2 with 409607273!=409607275
...
pDMA[2]@20208ca0 after CNT of 2 Diff CycCnt is 2 with 409644423!=409644425
pDMA[2]@20272420 after CNT of 12 Diff CycCnt is 22 with 409644447!=409644469
pDMA[2]@2027b0c0 after CNT of 1 Diff CycCnt is 2 with 409644469!=409644471
pDMA[2]@202b8920 after CNT of 7 Diff CycCnt is 18 with 409644483!=409644501
pDMA[2]@202c15c0 after CNT of 1 Diff CycCnt is 2 with 409644501!=409644503
pDMA[2]@202ed4e0 after CNT of 5 Diff CycCnt is 14 with 409644511!=409644525
pDMA[2]@202f6180 after CNT of 1 Diff CycCnt is 2 with 409644525!=409644527
pDMA[2]@202fee20 after CNT of 1 Diff CycCnt is 6 with 409644527!=409644533
pDMA[2]@20307ac0 after CNT of 1 Diff CycCnt is 2 with 409644533!=409644535
pDMA[2]@20345320 after CNT of 7 Diff CycCnt is 10 with 409644547!=409644557
pDMA[0]@20009bb0 after CNT of 2 Diff CycCnt is 6 with 263201668!=263201674
pDMA[0]@2001b4f0 after CNT of 2 Diff CycCnt is 2 with 263201680!=263201682
pDMA[0]@20024190 after CNT of 1 Diff CycCnt is 8 with 263201682!=263201690
pDMA[0]@2002ce30 after CNT of 1 Diff CycCnt is 2 with 263201690!=263201692
DONE after CNT of 8994 Diff CycCnt is 2 with 263219678!=263219680
============================
pDMA[1]@20009bb0 after CNT of 2 Diff CycCnt is 2 with 263219697!=263219699
DONE after CNT of 8998 Diff CycCnt is 2 with 263237693!=263237695
============================
pDMA[2]@20009bb0 after CNT of 2 Diff CycCnt is 2 with 263237709!=263237711
[B]pDMA[2]@287d2790 after CNT of 3955 Diff CycCnt is 902 with 263245619!=263246521[/B]
pDMA[2]@287db430 after CNT of 1 Diff CycCnt is 2 with 263246521!=263246523
pDMA[2]@28cde770 after CNT of 146 Diff CycCnt is 3 with 263246813!=263246816
pDMA[2]@28ce7410 after CNT of 1 Diff CycCnt is 2 with 263246816!=263246818
DONE after CNT of 4895 Diff CycCnt is 2 with 263256606!=263256608
============================
But where is it documented that mortals will find it and do it?
what speed is RAM2 that it needs to be cached?
============================ [B]DMA TEST Single[/B]
Avg CycCnt for 9000 is 3.983444
============================
Avg CycCnt for 9000 is 4.155334
============================
Avg CycCnt for 9000 is 3.998778
============================
============================ [B]DMA TEST short Repeat[/B]
Avg CycCnt for 900 is 2.765556
============================
Avg CycCnt for 900 is 2.490000
============================
Avg CycCnt for 900 is 2.192222
============================
============================ [B]RAM TEST[/B]
pRAM[0]@20001080 after run of 2 Diff CycCnt is 7 with 390861160!=390861167
pRAM[0]@20001088 after run of 2 Diff CycCnt is 2 with 390861174!=390861176
pRAM[0]@2000108c after run of 1 Diff CycCnt is 9 with 390861176!=390861185
pRAM[0]@20001090 after run of 1 Diff CycCnt is 2 with 390861185!=390861187
DONE after run of 8994 Diff CycCnt is 2 with 390879173!=390879175
Avg CycCnt for 9000 is 2.001889
============================
pRAM[1]@20009d20 after run of 2 Diff CycCnt is 2 with 390879193!=390879195
DONE after run of 8998 Diff CycCnt is 2 with 390897189!=390897191
Avg CycCnt for 9000 is 2.000000
============================
pRAM[2]@200129c0 after run of 2 Diff CycCnt is 2 with 390897204!=390897206
pRAM[2]@200168f4 after run of 4045 Diff CycCnt is 783 with 390905294!=390906077
pRAM[2]@200168f8 after run of 1 Diff CycCnt is 2 with 390906077!=390906079
pRAM[2]@20016b38 after run of 144 Diff CycCnt is 3 with 390906365!=390906368
pRAM[2]@20016b3c after run of 1 Diff CycCnt is 2 with 390906368!=390906370
DONE after run of 4807 Diff CycCnt is 2 with 390915982!=390915984
Avg CycCnt for 9000 is 2.086889
============================
============================ [B]RAM TEST[/B]
pRAM[0]@20001080 after run of 2 Diff CycCnt is 7 with 391222645!=391222652
pRAM[0]@20001088 after run of 2 Diff CycCnt is 2 with 391222659!=391222661
pRAM[0]@2000108c after run of 1 Diff CycCnt is 9 with 391222661!=391222670
pRAM[0]@20001090 after run of 1 Diff CycCnt is 2 with 391222670!=391222672
DONE after run of 8994 Diff CycCnt is 2 with 391240658!=391240660
Avg CycCnt for 9000 is 2.001889
============================
pRAM[1]@20009d20 after run of 2 Diff CycCnt is 2 with 391240678!=391240680
DONE after run of 8998 Diff CycCnt is 2 with 391258674!=391258676
Avg CycCnt for 9000 is 2.000000
============================
pRAM[2]@200129c0 after run of 2 Diff CycCnt is 2 with 391258689!=391258691
pRAM[2]@200166bc after run of 3903 Diff CycCnt is 711 with 391266495!=391267206
pRAM[2]@200166c0 after run of 1 Diff CycCnt is 2 with 391267206!=391267208
DONE after run of 5094 Diff CycCnt is 2 with 391277394!=391277396
Avg CycCnt for 9000 is 2.078778
============================
============================ [B]RAM TEST[/B]
pRAM[0]@20001080 after run of 2 Diff CycCnt is 6 with 391571329!=391571335
pRAM[0]@20001088 after run of 2 Diff CycCnt is 2 with 391571341!=391571343
pRAM[0]@2000108c after run of 1 Diff CycCnt is 8 with 391571343!=391571351
pRAM[0]@20001090 after run of 1 Diff CycCnt is 2 with 391571351!=391571353
pRAM[0]@200028ac after run of 1543 Diff CycCnt is 3 with 391574437!=391574440
pRAM[0]@200028b0 after run of 1 Diff CycCnt is 2 with 391574440!=391574442
DONE after run of 7450 Diff CycCnt is 2 with 391589340!=391589342
Avg CycCnt for 9000 is 2.001667
============================
pRAM[1]@20009d20 after run of 2 Diff CycCnt is 2 with 391589358!=391589360
DONE after run of 8998 Diff CycCnt is 2 with 391607354!=391607356
Avg CycCnt for 9000 is 2.000000
============================
pRAM[2]@200129c0 after run of 2 Diff CycCnt is 2 with 391607369!=391607371
pRAM[2]@20016acc after run of 4163 Diff CycCnt is 773 with 391615695!=391616468
pRAM[2]@20016ad0 after run of 1 Diff CycCnt is 2 with 391616468!=391616470
DONE after run of 4834 Diff CycCnt is 2 with 391626136!=391626138
Avg CycCnt for 9000 is 2.085667
============================
imxrt-size.exe - System Error
---------------------------
The code execution cannot proceed because VCRUNTIME140D.dll was not found. Reinstalling the program may fix this problem.
FlexRAM section ITCM+DTCM = 512 KB
Config : aaaaaaab
ITCM : 23200 B (70.80% of 32 KB)
DTCM : 12992 B ( 2.64% of 480 KB)
Available for Stack: 478528
OCRAM: 512KB
DMAMEM: 8272 B ( 1.58% of 512 KB)
Available for Heap: 516016 B (98.42% of 512 KB)
Flash: 32768 B ( 1.61% of 1984 KB)