ååã®èšäºã§ã¯ãããã»ããµãã£ãã·ã¥ã䜿çšããŠãEmboxã®ãã€ã¯ãã³ã³ãã¥ãŒã¿ã®ã°ã©ãã£ãã¯ã¹ãé«éåããŸããããã®å Žåããã©ã€ãã¹ã«ãŒãã¢ãŒãã䜿çšããŸããã次ã«ããã©ã€ãã¹ã«ãŒãã¢ãŒãã«é¢é£ããããã€ãã®é·æãšçæã«ã€ããŠèª¬æããŸããããããã¯å€§ãŸããªæŠèŠã«ãããŸããã§ããããã®èšäºã§ã¯ãçŽæã©ãããARMãã€ã¯ãããã»ããµã®ãã£ãã·ã¥ã®çš®é¡ã詳ãã調ã¹ãŠæ¯èŒããããšæããŸãããã¡ãããããã¯ãã¹ãŠããã°ã©ããŒã®èŠ³ç¹ããæ€èšãããŸãããã®èšäºã§ã¯ãã¡ã¢ãªãŒã³ã³ãããŒã©ãŒã®è©³çŽ°ã«ã€ããŠã¯èª¬æããŸããã
ååã®èšäºã§åæ¢ãããšãããã€ãŸããã©ã€ãããã¯ãã¢ãŒããšãã©ã€ãã¹ã«ãŒãã¢ãŒãã®éãããå§ããŸãããããã®2ã€ã®ã¢ãŒããæãé »ç¹ã«äœ¿çšãããããã§ããèŠããã«ïŒ
- "è¿äºãæžã"ãæžã蟌ã¿ããŒã¿ã¯ãã£ãã·ã¥ã«ã®ã¿éãããŸããã¡ã¢ãªãžã®å®éã®æžã蟌ã¿ã¯ããã£ãã·ã¥ããã£ã±ãã«ãªããæ°ããããŒã¿çšã®ã¹ããŒã¹ãå¿ èŠã«ãªããŸã§å»¶æãããŸãã
- ãã©ã€ãã¹ã«ãŒãããã£ãã·ã¥ãšã¡ã¢ãªãžã®æžã蟌ã¿ã¯ãåæã«ãè¡ãããŸãã
ã©ã€ãã¹ã«ãŒ
ã©ã€ãã¹ã«ãŒã®å©ç¹ã¯äœ¿ããããã§ãããšèããããŠããããšã©ãŒãæžããå¯èœæ§ããããŸããå®éããã®ã¢ãŒãã§ã¯ãã¡ã¢ãªã¯åžžã«æ£ããç¶æ ã«ãããè¿œå ã®æŽæ°æé ã¯å¿ èŠãããŸããã
ãã¡ãããããã¯ããã©ãŒãã³ã¹ã«å€§ããªåœ±é¿ãäžããã¯ãã§ããããã®ããã¥ã¡ã³ãã®STMèªäœã¯ãããã§ã¯ãªããšè¿°ã¹ãŠããŸãã
Write-through: triggers a write to the memory as soon as the contents on the cache line are written to. This is safer for the data coherency, but it requires more bus accesses. In practice, the write to the memory is done in the background and has a little effect unless the same cache set is being accessed repeatedly and very quickly. It is always a tradeoff.ã€ãŸããæåã¯æžã蟌ã¿ãã¡ã¢ãªãžã®æžã蟌ã¿ã§ãããããæžã蟌ã¿æäœã®ããã©ãŒãã³ã¹ã¯ãã£ãã·ã¥ããªãå Žåãšã»ãŒåãã§ãããèªã¿åããç¹°ãè¿ãããããã«äž»ãªã²ã€ã³ãçºçãããšæ³å®ããŠããŸããããã ããSTMã¯ããã«ç°è°ãå±ããã¡ã¢ãªå ã®ããŒã¿ã¯ãããã¯ã°ã©ãŠã³ããã«ãªããããæžã蟌ã¿ããã©ãŒãã³ã¹ã¯ãã©ã€ãããã¯ãã¢ãŒããšã»ãŒåãã§ãããšè¿°ã¹ãŠããŸããããã¯ãç¹ã«ãã¡ã¢ãªã³ã³ãããŒã©ïŒFMCïŒã®å éšãããã¡ã«äŸåããå ŽåããããŸãã
ãã©ã€ãã¹ã«ãŒãã¢ãŒãã®ãã¡ãªããïŒ
- åãã¡ã¢ãªãžã®ã·ãŒã±ã³ã·ã£ã«ã§é«éãªã¢ã¯ã»ã¹ã¯ãããã©ãŒãã³ã¹ãäœäžãããå¯èœæ§ããããŸãããã©ã€ãããã¯ãã¢ãŒãã§ã¯ãéã«ãåãã¡ã¢ãªãžã®é£ç¶ããé »ç¹ãªã¢ã¯ã»ã¹ã¯ãã©ã¹ã«ãªããŸãã
- ãã©ã€ãããã¯ãã®å Žåãšåæ§ã«ãDMAæäœã®çµäºåŸã«ãã£ãã·ã¥ã®ç¡å¹åãè¡ãå¿ èŠããããŸãã
- Cortex-M7ã®äžéšã®ããŒãžã§ã³ã§ããäžé£ã®ã©ã€ãã¹ã«ãŒã¹ãã¢ããã³ããŒãã§ã®ããŒã¿ç Žæãã®ãã°ãããã¯ãããææã«ç§ãã¡LVGLã®éçºè ã®äžäººã§ã
è¿äºãæžã
äžèšã®ããã«ããã®ã¢ãŒãã§ã¯ïŒãã©ã€ãã¹ã«ãŒããšã¯å¯Ÿç §çã«ïŒãããŒã¿ã¯éåžžãæžã蟌ã¿ã«ãã£ãŠã¡ã¢ãªã«å ¥ãã®ã§ã¯ãªãããã£ãã·ã¥ã«å ¥ãã ãã§ããã©ã€ãã¹ã«ãŒãšåæ§ã«ããã®æŠç¥ã«ã¯2ã€ã®ãµããªãã·ã§ã³ããããŸãã1ïŒæžã蟌ã¿å²ãåœãŠã2ïŒæžã蟌ã¿å²ãåœãŠãªãããããã®ãªãã·ã§ã³ã«ã€ããŠããã«èª¬æããŸãã
æžã蟌ã¿å²ãåœãŠ
ååãšããŠããèªã¿åãå²ãåœãŠãã¯åžžã«ãã£ãã·ã¥ã§äœ¿çšãããŸããã€ãŸããèªã¿åãã®ãã£ãã·ã¥ãã¹ãçºçãããšãããŒã¿ãã¡ã¢ãªãããã§ããããããã£ãã·ã¥ã«é 眮ãããŸããåæ§ã«ãæžã蟌ã¿ãã¹ãçºçããå ŽåãããŒã¿ããã£ãã·ã¥ã«ããŒãããïŒãæžã蟌ã¿å²ãåœãŠãïŒããããŒãããªãïŒãæžã蟌ã¿å²ãåœãŠãªããïŒããšãã§ããŸãã
éåžžãå®éã«ã¯ããã©ã€ãããã¯æžã蟌ã¿å²ãåœãŠããŸãã¯ãã©ã€ãã¹ã«ãŒæžã蟌ã¿å²ãåœãŠãªããã®çµã¿åããã䜿çšãããŸããããã«ãã¹ãã§ã¯ããæžã蟌ã¿å²ãåœãŠãã䜿çšããç¶æ³ãšãæžã蟌ã¿å²ãåœãŠãªããã䜿çšããç¶æ³ã«ã€ããŠãããå°ã詳ãã確èªããŸãã
MPU
å®éã®éšåã«é²ãåã«ãã¡ã¢ãªé åã®ãã©ã¡ãŒã¿ãèšå®ããæ¹æ³ãç解ããå¿ èŠããããŸããARMv7-Mã¢ãŒããã¯ãã£ã®ã¡ã¢ãªã®ç¹å®ã®é åã«å¯ŸããŠãã£ãã·ã¥ã¢ãŒããéžæïŒãŸãã¯ç¡å¹åïŒããã«ã¯ãMPUïŒã¡ã¢ãªä¿è·ãŠãããïŒã䜿çšããŸãã
MPUã³ã³ãããŒã©ã¯ãã¡ã¢ãªé åã®èšå®ããµããŒãããŠããŸããå ·äœçã«ã¯ãARMV7-Mã¢ãŒããã¯ãã£ã§ã¯ãæ倧16ã®ãªãŒãžã§ã³ãååšããå¯èœæ§ããããŸãããããã®ãªãŒãžã§ã³ã§ã¯ãéå§ã¢ãã¬ã¹ããµã€ãºãã¢ã¯ã»ã¹æš©ïŒèªã¿åã/æžã蟌ã¿/å®è¡ãªã©ïŒãå±æ§-TEXããã£ãã·ã¥å¯èœããããã¡å¯èœãå ±æå¯èœãããã³ãã®ä»ã®ãã©ã¡ãŒã¿ãåå¥ã«èšå®ã§ããŸããç¹ã«ããã®ãããªã¡ã«ããºã ã䜿çšãããšãç¹å®ã®ãªãŒãžã§ã³ã«å¯ŸããŠä»»æã®ã¿ã€ãã®ãã£ãã·ã³ã°ãå®çŸã§ããŸããããšãã°ããã¹ãŠã®DMAæäœã«ã¡ã¢ãªã®é åãå²ãåœãŠããã®ã¡ã¢ãªããã£ãã·ã¥äžå¯ãšããŠããŒã¯ããã ãã§ãcache_clean / cache_invalidateãåŒã³åºãå¿ èŠããªããããšãã§ããŸãã
MPUã䜿çšããéã®æ³šæç¹ïŒ
ãªãŒãžã§ã³ã®ããŒã¹ã¢ãã¬ã¹ããµã€ãºãããã³å±æ§ã¯ãã¹ãŠæ§æå¯èœã§ãããäžè¬çãªã«ãŒã«ã§ã¯ããã¹ãŠã®ãªãŒãžã§ã³ãèªç¶ã«æŽåãããŸããããã¯æ¬¡ã®ããã«ã€ãŸããã¡ã¢ãªé åã®éå§ã¢ãã¬ã¹ãç¬èªã®ãµã€ãºã«æããå¿ èŠããããŸããããšãã°ã16 Kbã®é åãããå Žåã¯ã16Kbã§äœçœ®åããããå¿ èŠããããŸããã¡ã¢ãªé åã64Kbã®å Žåã¯ã64Kbã«æããŸããçã ããããè¡ãããªãå ŽåãMPUã¯ãéå§ã¢ãã¬ã¹ã«å¯Ÿå¿ãããµã€ãºã«é åãèªåçã«ãããªãã³ã°ãã§ããŸãïŒå®éã«ãã¹ãæžã¿ïŒã
è¡šãããšãã§ããŸããRegionBaseAddress[ïŒN-1ïŒïŒ0] = 0ãããã§Nã¯log2ïŒSizeofRegion_in_bytesïŒ
ã¡ãªã¿ã«ãSTM32Cubeã«ã¯ããã€ãã®ãã°ããããŸããäŸãã°ïŒ
MPU_InitStruct.BaseAddress = 0x20010000;
MPU_InitStruct.Size = MPU_REGION_SIZE_256KB;
éå§ã¢ãã¬ã¹ã64KBã«æããããŠããããšãããããŸãããŸããé åã®ãµã€ãºã256KBã«ããå¿ èŠããããŸãããã®å Žåãæåã®64 Kbã2çªç®ã®128 Kbã3çªç®ã®64Kbã®3ã€ã®é åãäœæããå¿ èŠããããŸãã
æšæºã®ããããã£ãšã¯ç°ãªãé åãæå®ããã ãã§æžã¿ãŸããå®éã«ã¯ãããã»ããµãã£ãã·ã¥ãæå¹ã«ãªã£ãŠããå Žåã®ãã¹ãŠã®ã¡ã¢ãªã®å±æ§ã¯ãARMã¢ãŒããã¯ãã£ã§èšè¿°ãããŠããŸããããããã£ã®æšæºã»ããããããŸãïŒããšãã°ããããSTM32F7 SRAMã«ããã©ã«ãã§ãã©ã€ãããã¯æžã蟌ã¿å²ãåœãŠãã¢ãŒããããçç±ã§ãïŒããããã£ãŠãäžéšã®ã¡ã¢ãªã«éæšæºã¢ãŒããå¿ èŠãªå Žåã¯ãMPUãä»ããŠããããã£ãèšå®ããå¿ èŠããããŸãããã®å ŽåããªãŒãžã§ã³å ã§ãç¬èªã®ããããã£ãæã€ãµããªãŒãžã§ã³ãèšå®ã§ããŸãããã®ãªãŒãžã§ã³å ã§ãå¿ èŠãªããããã£ãæã€åªå 床ã®é«ãå¥ã®ãµããªãŒãžã§ã³ã匷調衚瀺ããŸãã
TCM
ããã¥ã¡ã³ãïŒã»ã¯ã·ã§ã³2.3çµã¿èŸŒã¿SRAMïŒ ãããããããã«ãSTM32F7ã®SRAMã®æåã®64KBã¯ãã£ãã·ã¥ã§ããŸãããARMv7-Mã¢ãŒããã¯ãã£èªäœã§ã¯ãSRAMã¯0x20000000ã«ãããŸããTCMã¯SRAMãæããŸãããæ®ãã®ã¡ã¢ãªïŒSRAM1ããã³SRAM2ïŒãšã¯ç°ãªããã¹äžã«ãããããã»ããµã®ãè¿ããã«ãããŸãããã®ããããã®ã¡ã¢ãªã¯éåžžã«é«éã§ãããå®éããã£ãã·ã¥ãšåãé床ã§ãããã®ããããã£ãã·ã¥ã¯äžèŠã§ããããã®é åããã£ãã·ã¥å¯èœã«ããããšã¯ã§ããŸãããå®éãTCMããã®ãããªãã£ãã·ã¥ã§ãã
åœä»€ãã£ãã·ã¥
äžèšã§èª¬æãããã®ã¯ãã¹ãŠãããŒã¿ãã£ãã·ã¥ïŒD-CacheïŒãåç §ããŠããããšã«æ³šæããŠãã ããããã ããARMv7-Mã¯ãããŒã¿ãã£ãã·ã¥ã«å ããŠãåœä»€ãã£ãã·ã¥ïŒåœä»€ãã£ãã·ã¥ïŒI-CacheïŒïŒãæäŸããŸããI-Cacheã䜿çšãããšãå®è¡å¯èœãªïŒããã³åŸç¶ã®ïŒåœä»€ã®äžéšããã£ãã·ã¥ã«è»¢éã§ããŸããããã«ãããããã°ã©ã ãå€§å¹ ã«é«éåã§ããŸããç¹ã«ãQSPIãªã©ãã³ãŒããFLASHãããé ãã¡ã¢ãªã«ããå Žåã
以äžã®ãã£ãã·ã¥ã䜿çšãããã¹ãã§ã®äºæž¬äžå¯èœæ§ãæžããããã«ãæå³çã«I-Cacheãç¡å¹ã«ããããŒã¿ã®ã¿ãèæ ®ããŸãã
åæã«ãI-Cacheããªã³ã«ããããšã¯éåžžã«ç°¡åã§ãããD-Cacheãšã¯ç°ãªããMPUããã®è¿œå ã®ã¢ã¯ã·ã§ã³ãå¿ èŠãšããªãããšã«æ³šæããããšæããŸãã
åæãã¹ã
çè«çãªéšåã«ã€ããŠèª¬æããåŸãç¹å®ã®ã¢ãã«ã®éããšé©çšç¯å²ãããããç解ããããã«ããã¹ãã«ç§»ããŸããããäžã§è¿°ã¹ãããã«ãI-Cacheãç¡å¹ã«ããD-Cacheã§ã®ã¿æ©èœããŸãããŸãããã¹ãã®ã«ãŒããæé©åãããªãããã«ãæå³çã«-O0ã䜿çšããŠã³ã³ãã€ã«ããŸããå€éšSDRAMã¡ã¢ãªãä»ããŠãã¹ãããŸãã MPUã®å©ããåããŠã64 KBã®é åã«ããŒã¯ãä»ãããã®é åã«å¿ èŠãªå±æ§ãå ¬éããŸãã
ãã£ãã·ã¥ã䜿çšãããã¹ãã¯éåžžã«æ°ãŸããã§ãããã·ã¹ãã å ã®ãã¹ãŠã®ãã®ãšãã¹ãŠã®äººã®åœ±é¿ãåãããããã³ãŒããç·åœ¢ã§é£ç¶çã«ããŸãããããããè¡ãã«ã¯ãå²ã蟌ã¿ãç¡å¹ã«ããŸãããŸããã¿ã€ããŒã§ã¯æéã枬å®ããŸããããããã»ããµãµã€ã¯ã«ã®32ãããã«ãŠã³ã¿ãåããDWTïŒããŒã¿ãŠã©ãããã€ã³ãããã³ãã¬ãŒã¹ãŠãããïŒã枬å®ããŸãããã®äžã§ïŒã€ã³ã¿ãŒãããäžã§ïŒäººã ã¯ãã©ã€ããŒã«ãã€ã¯ãç§ã®é 延ãäœããŸããã«ãŠã³ã¿ã¯216MHzã®ã·ã¹ãã åšæ³¢æ°ã§ããã«ãªãŒããŒãããŒããŸãããæ倧20ç§ãŸã§æž¬å®ã§ããŸããããã念é ã«çœ®ããŠããã®æéééã§ãã¹ããè¡ããéå§ããåã«ã¯ããã¯ã«ãŠã³ã¿ãŒãäºåã«ãŒãã«ããŸãã
å®å šãªãã¹ãã³ãŒãã¯ããã§ç¢ºèªã§ããŸãããã¹ãŠã®ãã¹ãã¯ã32F769IDISCOVERYããŒãã§å®è¡ãããŸããã
ãã£ãã·ã¥äžå¯èœãªã¡ã¢ãªVSãè¿äºãæžã
ããã§ã¯ãããã€ãã®éåžžã«ç°¡åãªãã¹ãããå§ããŸãããã
äžè²«ããŠã¡ã¢ãªã«æžã蟌ã¿ãŸãã
dst = (uint8_t *) DATA_ADDR;
for (i = 0; i < ITERS * 8; i++) {
for (j = 0; j < DATA_LEN; j++) {
*dst = VALUE;
dst++;
}
dst -= DATA_LEN;
}
ãŸããã¡ã¢ãªã«é çªã«æžã蟌ã¿ãŸãããäžåºŠã«1ãã€ãã§ã¯ãããŸããããã«ãŒããå°ãæ¡åŒµããŸãã
for (i = 0; i < ITERS * BLOCKS * 8; i++) {
for (j = 0; j < BLOCK_LEN; j++) {
*dst = VALUE;
*dst = VALUE;
*dst = VALUE;
*dst = VALUE;
dst++;
}
dst -= BLOCK_LEN;
}
ãŸããã¡ã¢ãªã«é 次æžã蟌ã¿ãŸãããããã§èªã¿åããè¿œå ããŸãã
for (i = 0; i < ITERS * BLOCKS * 8; i++) {
dst = (uint8_t *) DATA_ADDR;
for (j = 0; j < BLOCK_LEN; j++) {
val = VALUE;
*dst = val;
val = *dst;
dst++;
}
}
ããã3ã€ã®ãã¹ãããã¹ãŠå®è¡ãããšãã©ã®ã¢ãŒããéžæããŠãããŸã£ããåãçµæãåŸãããŸãã
mode: nc, iters=100, data len=65536, addr=0x60100000
Test1 (Sequential write):
0s 728ms
Test2 (Sequential write with 4 writes per one iteration):
7s 43ms
Test3 (Sequential read/write):
1s 216ms
ãããŠãããã¯åççã§ããç¹ã«ãSDRAMãæ¥ç¶ãããŠããFMCã®å éšãããã¡ãŒãèæ ®ãããšãSDRAMã¯ããã»ã©é ãã¯ãããŸãããããã«ãããããããç§ã¯æ°ã®ããããªå€åãäºæ³ããŸããããããããã¯ãããã®ãã¹ãã«ãªãã£ãããšãããããŸãããããŠãããã«èããŠã¿ãŸãããã
èªã¿åããšæžã蟌ã¿ãçµã¿åãããŠãSDRAMã®å¯¿åœããå°ç¡ããã«ããŠã¿ãŸãããããããè¡ãã«ã¯ãã«ãŒããæ¡åŒµããŠãå®éã«ã¯é åèŠçŽ ã®å¢åãªã©ã®äžè¬çãªãã®ãè¿œå ããŸãããã
for (i = 0; i < ITERS * BLOCKS; i++) {
for (j = 0; j < BLOCK_LEN; j++) {
// 16 lines
arr[i]++;
arr[i]++;
***
arr[i]++;
}
}
çµæïŒ
: 4s 743ms
Write-back: : 4s 187ms
ãã§ã«åªããŠããŸã-ãã£ãã·ã¥ã䜿çšãããšã0.5ç§éããªãããšãããããŸããããã¹ããããã«è€éã«ããŠã¿ãŸãããããã¹ããŒã¹ãã€ã³ããã¯ã¹ã«ããã¢ã¯ã»ã¹ãè¿œå ããŸããããšãã°ã1ã€ã®ã€ã³ããã¯ã¹ãããå ŽåïŒ
for (i = 0; i < ITERS * BLOCKS; i++) {
for (j = 0; j < BLOCK_LEN; j++) {
arr[i + 0 ]++;
***
arr[i + 3 ]++;
arr[i + 4 ]++;
arr[i + 100]++;
arr[i + 6 ]++;
arr[i + 7 ]++;
***
arr[i + 15]++;
}
}
çµæïŒ
: 11s 371ms
Write-back: : 4s 551ms
ããã§ããã£ãã·ã¥ãšã®éããç®ç«ã€ããã«ãªããŸãããããã«ããã®ãããª2çªç®ã®ã€ã³ããã¯ã¹ã玹ä»ããŸãã
for (i = 0; i < ITERS * BLOCKS; i++) {
for (j = 0; j < BLOCK_LEN; j++) {
arr[i + 0 ]++;
***
arr[i + 4 ]++;
arr[i + 100]++;
arr[i + 6 ]++;
***
arr[i + 9 ]++;
arr[i + 200]++;
arr[i + 11]++;
arr[i + 12]++;
***
arr[i + 15]++;
}
}
çµæïŒ
: 12s 62ms
Write-back: : 4s 551ms
ãã£ãã·ã¥ãããŠããªãã¡ã¢ãªã®æéãã»ãŒ1ç§å¢å ãããã£ãã·ã¥ã®å Žåã¯åããŸãŸã§ããããšãããããŸãã
æžã蟌ã¿å²ãåœãŠVSãæžã蟌ã¿å²ãåœãŠãªã
ããã§ã¯ããæžã蟌ã¿å²ãåœãŠãã¢ãŒããæ±ããŸããããããã§éãã確èªããã®ã¯ããã«å°é£ã§ãããã£ãã·ã¥ãããŠããªãã¡ã¢ãªãšãã©ã€ãããã¯ãã®éã®ç¶æ³ã§ã4çªç®ã®ãã¹ããããã§ã«æ確ã«è¡šç€ºãããŠããå Žåããæžã蟌ã¿å²ãåœãŠããšãæžã蟌ã¿å²ãåœãŠãªããã®éãã¯ãã¹ãã«ãã£ãŠãŸã æããã«ãããŠããŸãããèããŠã¿ãŸããã-ãæžã蟌ã¿å²ãåœãŠããéããªãã®ã¯ãã€ã§ããïŒããšãã°ãã·ãŒã±ã³ã·ã£ã«ã¡ã¢ãªäœçœ®ãžã®æžã蟌ã¿ãå€ãããããã®ã¡ã¢ãªäœçœ®ããã®èªã¿åããå°ãªãå Žåã§ãããã®å Žåããæžã蟌ã¿å²ãåœãŠãªããã¢ãŒãã§ã¯ãåžžã«ãã¹ãçºçããèªã¿åãã«ãã£ãŠééã£ãèŠçŽ ããã£ãã·ã¥ã«ããŒããããŸãããã®ç¶æ³ãã·ãã¥ã¬ãŒãããŠã¿ãŸãããã
for (i = 0; i < ITERS * BLOCKS; i++) {
for (j = 0; j < BLOCK_LEN; j++) {
arr[j + 0 ] = VALUE;
***
arr[j + 7 ] = VALUE;
arr[j + 8 ] = arr[i % 1024 + (j % 256) * 128];
arr[j + 9 ] = VALUE;
***
arr[j + 15 ] = VALUE;
}
}
ããã§ã¯ã16ã¬ã³ãŒãã®ãã¡15ã¬ã³ãŒããVALUEå®æ°ã«èšå®ãããèªã¿åãã¯ç°ãªãïŒæžã蟌ã¿ãšã¯é¢ä¿ã®ãªãïŒèŠçŽ ããå®è¡ãããŸãarr [iïŒ 1024 +ïŒjïŒ 256ïŒ* 128]ãæžã蟌ã¿å²ãåœãŠãªãã®æŠç¥ã§ã¯ããããã®èŠçŽ ã®ã¿ããã£ãã·ã¥ã«ããŒããããããšãããããŸãããã®ãããªã€ã³ããã¯ã¹ã䜿çšãããçç±ïŒiïŒ 1024 +ïŒjïŒ 256ïŒ* 128ïŒã¯ãFMC / SDRAMã®ãé床äœäžãã§ããå€§å¹ ã«ç°ãªãïŒéé 次ïŒã¢ãã¬ã¹ã§ã®ã¡ã¢ãªã¢ã¯ã»ã¹ã¯ãäœæ¥é床ã«å€§ããªåœ±é¿ãäžããå¯èœæ§ãããããã§ãã
çµæïŒ
Write-back : 4s 720ms
Write-back no write allocate: : 4s 888ms
æåŸã«ãããã»ã©ç®ç«ããªããã®ã®ããã§ã«ç®ã«èŠããéãããããŸãããã€ãŸããç§ãã¡ã®ä»®èª¬ã確èªãããŸããã
ãããŠæåŸã«ãç§ã®æèŠã§ã¯ãæãé£ããã±ãŒã¹ã§ãããæžã蟌ã¿å²ãåœãŠãªããããæžã蟌ã¿å²ãåœãŠããããåªããŠããå Žåãç解ããããšæããŸããè¿ãå°æ¥ã«äœ¿çšããªãã¢ãã¬ã¹ããé »ç¹ã«ãåç §ããå Žåã¯ãæåã®æ¹ãé©ããŠããŸãããã®ãããªããŒã¿ããã£ãã·ã¥ããå¿ èŠã¯ãããŸããã
次ã®ãã¹ãã§ã¯ããæžã蟌ã¿å²ãåœãŠãã®å ŽåãããŒã¿ã¯èªã¿åããšæžã蟌ã¿ã§å ¥åãããŸãã64KBã®é åãarr2ããäœæããã®ã§ãæ°ããããŒã¿ã亀æããããã«ãã£ãã·ã¥ããã©ãã·ã¥ãããŸãããæžã蟌ã¿å²ãåœãŠãªããã®å Žåã4096ãã€ãã®ãarrãé åãäœæããŸããããããã ãããã£ãã·ã¥ã«å ¥ããŸããã€ãŸãããã£ãã·ã¥ããŒã¿ã¯ã¡ã¢ãªã«ãã©ãã·ã¥ãããŸããããã®ãããå°ãªããšãå°ããªåå©ãç®æããŸãã
arr = (uint8_t *) DATA_ADDR;
arr2 = arr;
for (i = 0; i < ITERS * BLOCKS; i++) {
for (j = 0; j < BLOCK_LEN; j++) {
arr2[i * BLOCK_LEN ] = arr[j + 0 ];
arr2[i * BLOCK_LEN + j*32 + 1 ] = arr[j + 1 ];
arr2[i * BLOCK_LEN + j*64 + 2 ] = arr[j + 2 ];
arr2[i * BLOCK_LEN + j*128 + 3] = arr[j + 3 ];
arr2[i * BLOCK_LEN + j*32 + 4 ] = arr[j + 4 ];
***
arr2[i * BLOCK_LEN + j*32 + 15] = arr[j + 15 ];
}
}
çµæïŒ
Write-back : 7s 601ms
Write-back no write allocate: : 7s 599ms
ãã©ã€ãããã¯ããã©ã€ãã¢ãã±ãŒã·ã§ã³ãã¢ãŒãã®æ¹ããããã«é«éã§ããããšãããããŸããããããéèŠãªããšã¯ãããããéããšããããšã§ãã
ãã以äžã®ãã¢ã³ã¹ãã¬ãŒã·ã§ã³ã¯åŸãããŸããã§ããããéããããæ確ã«ãªãå®éçãªç¶æ³ããããšç¢ºä¿¡ããŠããŸããèªè ã¯èªåã®ãªãã·ã§ã³ãææ¡ããããšãã§ããŸãïŒ
å®äŸ
åæã®äŸããå®éã®äŸã«ç§»ããŸãããã
ping
æãç°¡åãªãã®ã®1ã€ã¯pingã§ããéå§ã¯ç°¡åã§ãæéã¯ãã¹ãã§çŽæ¥è¡šç€ºã§ããŸããEmboxã¯-O2æé©åã§æ§ç¯ãããŸãããããã«çµæããäŒãããŸãããã
: ~0.246 c
Write-back : ~0.140 c
Opencv
ãã£ãã·ã¥ãµãã·ã¹ãã ãè©ŠããŠã¿ããã£ãå®éã®åé¡ã®ãã1ã€ã®äŸã¯ãSTM32F7ã®OpenCVã§ãããã®èšäºã§ã¯ãèµ·åã¯ããªãå¯èœã§ããããšã瀺ãããŠããŸããããããã©ãŒãã³ã¹ã¯ããªãäœãã£ãã§ãããã¢ã³ã¹ãã¬ãŒã·ã§ã³ã§ã¯ãCannyãã£ã«ã¿ãŒã«åºã¥ããŠå¢çç·ãæœåºããæšæºçãªäŸã䜿çšããŸãããã£ãã·ã¥ïŒDãã£ãã·ã¥ãšIãã£ãã·ã¥ã®äž¡æ¹ïŒãããå Žåãšãªãå Žåã®å®è¡æéã枬å®ããŠã¿ãŸãããã
gettimeofday(&tv_start, NULL);
cedge.create(image.size(), image.type());
cvtColor(image, gray, COLOR_BGR2GRAY);
blur(gray, edge, Size(3,3));
Canny(edge, edge, edgeThresh, edgeThresh*3, 3);
cedge = Scalar::all(0);
image.copyTo(cedge, edge);
gettimeofday(&tv_cur, NULL);
timersub(&tv_cur, &tv_start, &tv_cur);
ãã£ãã·ã¥ãªãïŒ
> edges fruits.png 20
Processing time 0s 926ms
Framebuffer: 800x480 32bpp
Image: 512x269; Threshold=20
ãã£ãã·ã¥ããïŒ
> edges fruits.png 20
Processing time 0s 134ms
Framebuffer: 800x480 32bpp
Image: 512x269; Threshold=20
ã€ãŸãã926msãš134msã®å éã¯ã»ãŒ7åã§ãã
å®éãSTM32ã®OpenCVã«ã€ããŠãç¹ã«ããã©ãŒãã³ã¹ã«ã€ããŠããå°ããããŸããFPSã¯ç¢ºãã«é«ãã¯ãããŸãããã1ç§ããã5ãã¬ãŒã ãååŸããã®ã¯éåžžã«çŸå®çã§ãã
ãã£ãã·ã¥å¯èœãŸãã¯ãã£ãã·ã¥ãããã¡ã¢ãªã§ã¯ãããŸãããããã£ãã·ã¥ãç¡å¹ã«ããŸããïŒ
å®éã®ããã€ã¹ã§ã¯ãDMAãåºã䜿çšãããŠããŸããããã©ã€ãã¹ã«ãŒãã¢ãŒãã§ãã¡ã¢ãªãåæããå¿ èŠããããããåœç¶ãDMAã«ã¯åé¡ã䌎ããŸãããã£ãã·ã¥ãããªãã¡ã¢ãªãåã«å²ãåœãŠãŠãDMAã䜿çšãããšãã«ããã䜿çšããããšããã®ã¯åœç¶ã®ããšã§ããå°ãæ°ãæ£ãã Linuxã§ã¯ãããã¯dma_coherent_allocïŒïŒãä»ããé¢æ°ã«ãã£ãŠå®è¡ãããŸããã¯ããããã¯éåžžã«å¹æçãªæ¹æ³ã§ããããšãã°ãOSã§ãããã¯ãŒã¯ãã±ãããæäœããå ŽåããŠãŒã¶ãŒããŒã¿ã¯ãã©ã€ããŒã«å°éããåã«åŠçã®å€§ããªæ®µéãçµãŠããã©ã€ããŒã§ã¯ããã¹ãŠã®ããããŒãå«ãæºåãããããŒã¿ãããã£ãã·ã¥ãããŠããªãã¡ã¢ãªã䜿çšãããããã¡ãŒã«ã³ããŒãããŸãã
DMAãåãããã©ã€ããŒã§ã¯ãªãŒã³/ç¡å¹åãæãŸããå Žåã¯ãããŸããïŒã¯ããããŸããããšãã°ãç§ãã¡ãä¿ãããããªã¡ã¢ãªcacheïŒïŒãã©ã®ããã«æ©èœãããã詳ããèŠãŠã¿ãŸããããããã«ãããã¡ãªã³ã°ã¢ãŒãã§ã¯ãã·ã¹ãã ã«ã¯2ã€ã®ãããã¡ããããããã«é çªã«åŒã蟌ãŸãããããªã³ã³ãããŒã©ã«æž¡ãããŸãããã®ãããªã¡ã¢ãªããã£ãã·ã¥äžå¯ã«ãããšãããã©ãŒãã³ã¹ãäœäžããŸãããããã£ãŠããããã¡ããããªã³ã³ãããŒã©ã«éä¿¡ããåã«ãã¯ãªãŒã³ã¢ãããå®è¡ããããšããå§ãããŸãã
çµè«
ARMv7mã®ããŸããŸãªã¿ã€ãã®ãã£ãã·ã¥ã«ã€ããŠå°ãç解ããŸãããã©ã€ãããã¯ãã©ã€ãã¹ã«ãŒãããã³ãæžã蟌ã¿å²ãåœãŠããšãæžã蟌ã¿å²ãåœãŠãªããã®èšå®ã§ããããã¢ãŒããä»ã®ã¢ãŒããããåªããŠããããšã確èªããããã®åæãã¹ããäœæããpingãšOpenCVã䜿çšããå®éçãªäŸãæ€èšããŸãããEmboxã§ã¯ããã®ãããã¯ã«åãçµãã§ããã ããªã®ã§ã察å¿ãããµãã·ã¹ãã ã¯ãŸã æ€èšäžã§ãããã ãããã£ãã·ã¥ã䜿çšããå©ç¹ã¯ééããªãé¡èã§ãã
ãã¹ãŠã®äŸã¯ããªãŒãã³ãªããžããªããEmboxããã«ãããããšã§è¡šç€ºããã³è€è£œã§ããŸãã
PS
ããªãã¯ãã·ã¹ãã ã®ããã°ã©ãã³ã°ãšOSDevã®è©±é¡ã«èå³ãããå Žåã¯ãOSã®æ¥ã®äŒè°ãææ¥éå¬ãããŸãïŒä»å¹Žã¯ãªã³ã©ã€ã³ã§ãã®ã§ããèŠéããªãïŒEmboxã¯ææ¥12.00ã«æŒå¥ããŸã